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: 7808841 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9EAF9BEEE1 for ; Wed, 9 Dec 2015 13:56:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C618020490 for ; Wed, 9 Dec 2015 13:56:28 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 936B520462 for ; Wed, 9 Dec 2015 13:56:27 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id BF6AA261A95; Wed, 9 Dec 2015 14:56:26 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 908F626145E; Wed, 9 Dec 2015 14:53:14 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id B3F35261498; Wed, 9 Dec 2015 14:53:13 +0100 (CET) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) by alsa0.perex.cz (Postfix) with ESMTP id 544CB2614C2 for ; Wed, 9 Dec 2015 14:52:05 +0100 (CET) Received: by lbblt2 with SMTP id lt2so30488086lbb.3 for ; Wed, 09 Dec 2015 05:52:04 -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=dBTvJBnlfbUo//2eSgVuvjTCC+fTjFrkXoe8iuggCgwdNUoMJZ76uFfmVnzo6iviE8 pnn1paWJsQNAsiAWgWKJKd0x7VIzsuknQjqGdHpg9WetDtL4lkGCNqljjotsyjE/gwzr oAOzBMZnAuduYi4m+sprvpOj+EVZbp3s/6MdrLhMJ4t7Qdc493Y2XtmLkbgV/W1pCRYi FobJdlWy5qwKk4Tf1uJcdkaGIDGN5CINR/kJ46Vly48iJdqLMJjOSA48DAChfaCoHQK3 GqRcGSCqJw+sSYxYrMvVZ/5fFXBJNbBcZ6waO9754EPX2LPNP2Ep1apEOBxbRZnnel55 k1FQ== X-Gm-Message-State: ALoCoQkwNY/Qgrjz/DwSVDxKUPiBJ/5SffM2cTdXdm49JJjYBl6SmV2GtqosowIvXBbIoH4P6BdoaLOuRpHfCqNonuKlKzfvcA== 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 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 Cc: Linus Walleij , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 181/182] ASoC: ac97: use gpiochip data pointer X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Mark Brown --- 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(-) 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;