Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: ac97: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: alsa-devel@alsa-project.org
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

+3 -5
+3 -5
sound/soc/soc-ac97.c
··· 59 59 #ifdef CONFIG_GPIOLIB 60 60 static inline struct snd_soc_codec *gpio_to_codec(struct gpio_chip *chip) 61 61 { 62 - struct snd_ac97_gpio_priv *gpio_priv = 63 - container_of(chip, struct snd_ac97_gpio_priv, gpio_chip); 62 + struct snd_ac97_gpio_priv *gpio_priv = gpiochip_get_data(chip); 64 63 65 64 return gpio_priv->codec; 66 65 } ··· 97 98 static void snd_soc_ac97_gpio_set(struct gpio_chip *chip, unsigned offset, 98 99 int value) 99 100 { 100 - struct snd_ac97_gpio_priv *gpio_priv = 101 - container_of(chip, struct snd_ac97_gpio_priv, gpio_chip); 101 + struct snd_ac97_gpio_priv *gpio_priv = gpiochip_get_data(chip); 102 102 struct snd_soc_codec *codec = gpio_to_codec(chip); 103 103 104 104 gpio_priv->gpios_set &= ~(1 << offset); ··· 143 145 gpio_priv->gpio_chip.parent = codec->dev; 144 146 gpio_priv->gpio_chip.base = -1; 145 147 146 - ret = gpiochip_add(&gpio_priv->gpio_chip); 148 + ret = gpiochip_add_data(&gpio_priv->gpio_chip, gpio_priv); 147 149 if (ret != 0) 148 150 dev_err(codec->dev, "Failed to add GPIOs: %d\n", ret); 149 151 return ret;