Merge tag 'sound-4.7-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
[sfrench/cifs-2.6.git] / sound / soc / codecs / rt5677.c
index b3f1db5bae4a279ec2b03ed09b1a6bee367b97b0..da9483c1c6fbbf53edbf78c6570618815ace8d69 100644 (file)
@@ -4506,14 +4506,9 @@ static int rt5677_set_bias_level(struct snd_soc_codec *codec,
 }
 
 #ifdef CONFIG_GPIOLIB
-static inline struct rt5677_priv *gpio_to_rt5677(struct gpio_chip *chip)
-{
-       return container_of(chip, struct rt5677_priv, gpio_chip);
-}
-
 static void rt5677_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 {
-       struct rt5677_priv *rt5677 = gpio_to_rt5677(chip);
+       struct rt5677_priv *rt5677 = gpiochip_get_data(chip);
 
        switch (offset) {
        case RT5677_GPIO1 ... RT5677_GPIO5:
@@ -4534,7 +4529,7 @@ static void rt5677_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 static int rt5677_gpio_direction_out(struct gpio_chip *chip,
                                     unsigned offset, int value)
 {
-       struct rt5677_priv *rt5677 = gpio_to_rt5677(chip);
+       struct rt5677_priv *rt5677 = gpiochip_get_data(chip);
 
        switch (offset) {
        case RT5677_GPIO1 ... RT5677_GPIO5:
@@ -4558,7 +4553,7 @@ static int rt5677_gpio_direction_out(struct gpio_chip *chip,
 
 static int rt5677_gpio_get(struct gpio_chip *chip, unsigned offset)
 {
-       struct rt5677_priv *rt5677 = gpio_to_rt5677(chip);
+       struct rt5677_priv *rt5677 = gpiochip_get_data(chip);
        int value, ret;
 
        ret = regmap_read(rt5677->regmap, RT5677_GPIO_ST, &value);
@@ -4570,7 +4565,7 @@ static int rt5677_gpio_get(struct gpio_chip *chip, unsigned offset)
 
 static int rt5677_gpio_direction_in(struct gpio_chip *chip, unsigned offset)
 {
-       struct rt5677_priv *rt5677 = gpio_to_rt5677(chip);
+       struct rt5677_priv *rt5677 = gpiochip_get_data(chip);
 
        switch (offset) {
        case RT5677_GPIO1 ... RT5677_GPIO5:
@@ -4624,7 +4619,7 @@ static void rt5677_gpio_config(struct rt5677_priv *rt5677, unsigned offset,
 
 static int rt5677_to_irq(struct gpio_chip *chip, unsigned offset)
 {
-       struct rt5677_priv *rt5677 = gpio_to_rt5677(chip);
+       struct rt5677_priv *rt5677 = gpiochip_get_data(chip);
        struct regmap_irq_chip_data *data = rt5677->irq_data;
        int irq;
 
@@ -4683,7 +4678,7 @@ static void rt5677_init_gpio(struct i2c_client *i2c)
        rt5677->gpio_chip.parent = &i2c->dev;
        rt5677->gpio_chip.base = -1;
 
-       ret = gpiochip_add(&rt5677->gpio_chip);
+       ret = gpiochip_add_data(&rt5677->gpio_chip, rt5677);
        if (ret != 0)
                dev_err(&i2c->dev, "Failed to add GPIOs: %d\n", ret);
 }