From patchwork Wed Dec 9 13:52:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58137 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp681695lbb; Wed, 9 Dec 2015 05:52:09 -0800 (PST) X-Received: by 10.98.43.67 with SMTP id r64mr13114735pfr.3.1449669129240; Wed, 09 Dec 2015 05:52:09 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g5si12937085pfd.25.2015.12.09.05.52.09; Wed, 09 Dec 2015 05:52:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754760AbbLINwI (ORCPT + 4 others); Wed, 9 Dec 2015 08:52:08 -0500 Received: from mail-lb0-f175.google.com ([209.85.217.175]:34675 "EHLO mail-lb0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754778AbbLINwH (ORCPT ); Wed, 9 Dec 2015 08:52:07 -0500 Received: by lbbcs9 with SMTP id cs9so30297859lbb.1 for ; Wed, 09 Dec 2015 05:52:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=+EIVv9+XiPj6W1K6tLsYpxQeBioOoLGsNLwwX9a9oko=; b=0p5jGRMS0Mcbv1/9O1M5GhdPKM9Fd5pl9q6PVhjs4KeRphJQJv1xWuBp/m6yXQZrfN 2ApDuJoTw/TvULvztfaF4zJH+jz0i/UbB37ziw8qiLEH0WSLI7H3vpj/qq5ReTHv1nBO MskFY8nDKCrFFpUH93IUsq9c7WhM2MqiIrLbstGaeeM3KbfqccHrdi/3u1lUQ00vYN0R rn2zOTvU2YkUJqAKB3IrLJ8MfLvyUXB2Zv/Jn1FKCgkpQQ8Zontlmin1K9xOQfyydIv9 VxdrwUT/sVxlmWiav2EaOc+1iRkt/mwTwy1P6ajb5v7zlZMrFViI+vlmTIf+2Fg/zzD6 uYew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+EIVv9+XiPj6W1K6tLsYpxQeBioOoLGsNLwwX9a9oko=; b=P8ApEt0U0EWO3mjXR5kgYzkTEu9AIkl4rF2910CpJ7yrnPa/hX5mt6+8sTP0s30chS 1VliA7I2EbxZORyzwBaBYFFXEqSx+gjwhfM44N/0LfdMnf44AQSOCoht8S9b+2ReMUTe 8NTcaC3figMuh0o2JFWlGTiHpqPW7X0tm0ea880k0skklkGIk+56kvTidddf57TpYxp7 sQaY7JbEJwf5JXdsCcNpX+PZlLRwFPznMUSGsSBNiTjES/8MlKfAhC0QXM+6RwnTALiA tE27ou7f085TkXszJIGBTXBxDoOjA9WNuCqDJXwOqkHXr0l5XEfuChrvQKpu/Ow4a6Lm 8NPA== X-Gm-Message-State: ALoCoQlhwQln7K7G86kHck6NgcrRwICY54AwdV3prpOWiTt93gzS4oXip0BVb1HpRFZG8a2c8aHzw43RR1HvH0+d+Gga4vFsPA== X-Received: by 10.112.12.73 with SMTP id w9mr2396393lbb.36.1449669124930; Wed, 09 Dec 2015 05:52:04 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id re5sm1442588lbb.22.2015.12.09.05.52.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:52:04 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann , Liam Girdwood , Mark Brown Cc: Linus Walleij , alsa-devel@alsa-project.org Subject: [PATCH 181/182] ASoC: ac97: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:52:01 +0100 Message-Id: <1449669121-7366-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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 Cc: Mark Brown Cc: alsa-devel@alsa-project.org Signed-off-by: Linus Walleij --- Liam/Mark: please ACK this so I can merge it into the GPIO tree. --- sound/soc/soc-ac97.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Acked-by: Mark Brown diff --git a/sound/soc/soc-ac97.c b/sound/soc/soc-ac97.c index a2012652f212..eaec7177eab2 100644 --- a/sound/soc/soc-ac97.c +++ b/sound/soc/soc-ac97.c @@ -59,8 +59,7 @@ static void soc_ac97_device_release(struct device *dev) #ifdef CONFIG_GPIOLIB static inline struct snd_soc_codec *gpio_to_codec(struct gpio_chip *chip) { - struct snd_ac97_gpio_priv *gpio_priv = - container_of(chip, struct snd_ac97_gpio_priv, gpio_chip); + struct snd_ac97_gpio_priv *gpio_priv = gpiochip_get_data(chip); return gpio_priv->codec; } @@ -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, int value) { - struct snd_ac97_gpio_priv *gpio_priv = - container_of(chip, struct snd_ac97_gpio_priv, gpio_chip); + struct snd_ac97_gpio_priv *gpio_priv = gpiochip_get_data(chip); struct snd_soc_codec *codec = gpio_to_codec(chip); gpio_priv->gpios_set &= ~(1 << offset); @@ -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.base = -1; - ret = gpiochip_add(&gpio_priv->gpio_chip); + ret = gpiochip_add_data(&gpio_priv->gpio_chip, gpio_priv); if (ret != 0) dev_err(codec->dev, "Failed to add GPIOs: %d\n", ret); return ret;