Commit f7cb5120 authored by Linus Walleij's avatar Linus Walleij

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: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent c2aea142
...@@ -59,8 +59,7 @@ static void soc_ac97_device_release(struct device *dev) ...@@ -59,8 +59,7 @@ static void soc_ac97_device_release(struct device *dev)
#ifdef CONFIG_GPIOLIB #ifdef CONFIG_GPIOLIB
static inline struct snd_soc_codec *gpio_to_codec(struct gpio_chip *chip) static inline struct snd_soc_codec *gpio_to_codec(struct gpio_chip *chip)
{ {
struct snd_ac97_gpio_priv *gpio_priv = struct snd_ac97_gpio_priv *gpio_priv = gpiochip_get_data(chip);
container_of(chip, struct snd_ac97_gpio_priv, gpio_chip);
return gpio_priv->codec; return gpio_priv->codec;
} }
...@@ -98,8 +97,7 @@ static int snd_soc_ac97_gpio_get(struct gpio_chip *chip, unsigned offset) ...@@ -98,8 +97,7 @@ static int snd_soc_ac97_gpio_get(struct gpio_chip *chip, unsigned offset)
static void snd_soc_ac97_gpio_set(struct gpio_chip *chip, unsigned offset, static void snd_soc_ac97_gpio_set(struct gpio_chip *chip, unsigned offset,
int value) int value)
{ {
struct snd_ac97_gpio_priv *gpio_priv = struct snd_ac97_gpio_priv *gpio_priv = gpiochip_get_data(chip);
container_of(chip, struct snd_ac97_gpio_priv, gpio_chip);
struct snd_soc_codec *codec = gpio_to_codec(chip); struct snd_soc_codec *codec = gpio_to_codec(chip);
gpio_priv->gpios_set &= ~(1 << offset); gpio_priv->gpios_set &= ~(1 << offset);
...@@ -145,7 +143,7 @@ static int snd_soc_ac97_init_gpio(struct snd_ac97 *ac97, ...@@ -145,7 +143,7 @@ static int snd_soc_ac97_init_gpio(struct snd_ac97 *ac97,
gpio_priv->gpio_chip.parent = codec->dev; gpio_priv->gpio_chip.parent = codec->dev;
gpio_priv->gpio_chip.base = -1; gpio_priv->gpio_chip.base = -1;
ret = gpiochip_add(&gpio_priv->gpio_chip); ret = gpiochip_add_data(&gpio_priv->gpio_chip, gpio_priv);
if (ret != 0) if (ret != 0)
dev_err(codec->dev, "Failed to add GPIOs: %d\n", ret); dev_err(codec->dev, "Failed to add GPIOs: %d\n", ret);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment