struct gpio_chip gpio_chip;
};
-static inline struct wm8994_gpio *to_wm8994_gpio(struct gpio_chip *chip)
-{
- return container_of(chip, struct wm8994_gpio, gpio_chip);
-}
-
static int wm8994_gpio_request(struct gpio_chip *chip, unsigned offset)
{
- struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip);
+ struct wm8994_gpio *wm8994_gpio = gpiochip_get_data(chip);
struct wm8994 *wm8994 = wm8994_gpio->wm8994;
switch (wm8994->type) {
static int wm8994_gpio_direction_in(struct gpio_chip *chip, unsigned offset)
{
- struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip);
+ struct wm8994_gpio *wm8994_gpio = gpiochip_get_data(chip);
struct wm8994 *wm8994 = wm8994_gpio->wm8994;
return wm8994_set_bits(wm8994, WM8994_GPIO_1 + offset,
static int wm8994_gpio_get(struct gpio_chip *chip, unsigned offset)
{
- struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip);
+ struct wm8994_gpio *wm8994_gpio = gpiochip_get_data(chip);
struct wm8994 *wm8994 = wm8994_gpio->wm8994;
int ret;
static int wm8994_gpio_direction_out(struct gpio_chip *chip,
unsigned offset, int value)
{
- struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip);
+ struct wm8994_gpio *wm8994_gpio = gpiochip_get_data(chip);
struct wm8994 *wm8994 = wm8994_gpio->wm8994;
if (value)
static void wm8994_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{
- struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip);
+ struct wm8994_gpio *wm8994_gpio = gpiochip_get_data(chip);
struct wm8994 *wm8994 = wm8994_gpio->wm8994;
if (value)
static int wm8994_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
{
- struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip);
+ struct wm8994_gpio *wm8994_gpio = gpiochip_get_data(chip);
struct wm8994 *wm8994 = wm8994_gpio->wm8994;
return regmap_irq_get_virq(wm8994->irq_data, offset);
static void wm8994_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
{
- struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip);
+ struct wm8994_gpio *wm8994_gpio = gpiochip_get_data(chip);
struct wm8994 *wm8994 = wm8994_gpio->wm8994;
int i;
else
wm8994_gpio->gpio_chip.base = -1;
- ret = gpiochip_add(&wm8994_gpio->gpio_chip);
+ ret = gpiochip_add_data(&wm8994_gpio->gpio_chip, wm8994_gpio);
if (ret < 0) {
dev_err(&pdev->dev, "Could not register gpiochip, %d\n",
ret);