From patchwork Wed Dec 9 13:51:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 7808801 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 10ADE9F39B for ; Wed, 9 Dec 2015 13:54:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EF91720490 for ; Wed, 9 Dec 2015 13:54:10 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id C1BA920457 for ; Wed, 9 Dec 2015 13:54:09 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C8F5526070A; Wed, 9 Dec 2015 14:54:08 +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 6808026156A; Wed, 9 Dec 2015 14:52:37 +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 32A41261564; Wed, 9 Dec 2015 14:52:36 +0100 (CET) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com [209.85.217.175]) by alsa0.perex.cz (Postfix) with ESMTP id E29F02606F9 for ; Wed, 9 Dec 2015 14:51:42 +0100 (CET) Received: by lbpu9 with SMTP id u9so30159885lbp.2 for ; Wed, 09 Dec 2015 05:51:42 -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=MMX3zdY852O7dB/aLti2VMu1M3aUIes2bHfo7CubCwI=; b=JShiHS0Y9K8n3ahzFEIZUSfixvPV6UQsBVtdubCJ+zSKjGAV6Md9WpqBFGiwQ/Nd3L 8mqe9gJCGdIL2F/7FEMzfcDpfjA6gfsj0NF+Q2fpK76bQuOJkUtTNJwYDft7LcBh5YZ+ 2SPbQTbRsM2BvFdGSJMAjVrvuiNcS659suyugJf/pizn+d9KBP+e0JjZ8uZfx1QTT2G9 havzspS5jbmU+pE2IDgMUQglN0luyEVKiLHXZbmkjiraGg4cZDO8g53GX8kLFfraqNz+ imlVCTTf8dCSPsA/J3tkM7j/tnfsdelf3BzEKO82t7y5TR6U2CGV8CUtxGqI4km/vvDK GhoA== 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=MMX3zdY852O7dB/aLti2VMu1M3aUIes2bHfo7CubCwI=; b=mxVJe4iHBcKCn/k3qAMK/pPh7lBtxH/Dmx7GVFhruVF6z9wSaglAWVMSZZJTsMVvpC rSkBes9iYKIsSkz/CUyQVfRtYI1G3VQAvrt7KbTsyuSZ8ECs+C126ytIHnXJps1MahkX 6LpEikf7IrjsXGDqykoPuMIfIzqQEvUjjjNy6hyyS7Fv2xeNOFDBZquXSSuMT7+PQv7e AR6fLs93mDyUb3Dol9WIYX9uLbPO3Zmp18GIOx2KAn6IK+m/kZ+cXImkFg4s29mWAhpo lcx/7OGfvoGcTB6qv6o/DxRcVbOrRArl6jFiNHGTRIYaGFK6tEkhPgdkLFqddJgQ8gBW hjeg== X-Gm-Message-State: ALoCoQlaW4efoF6JbuaAmLig/JgFFk+z7eM3GenFukaESKl3Fxxjl4WYz0m0I1vpZSBE4/YqeAZK7c0NB/BJdp1n2a5T6qin9g== X-Received: by 10.112.218.5 with SMTP id pc5mr2467412lbc.76.1449669102542; Wed, 09 Dec 2015 05:51:42 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id m64sm1410309lfd.45.2015.12.09.05.51.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:51:41 -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:51:37 +0100 Message-Id: <1449669097-7214-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 178/182] ASoC: wm8903: 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: Charles Keepax Acked-by: Mark Brown --- Liam/Mark: please ACK this so I can merge it into the GPIO tree. --- sound/soc/codecs/wm8903.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 2512def0d349..d1315ce5f0a9 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include @@ -1766,11 +1766,6 @@ static int wm8903_resume(struct snd_soc_codec *codec) } #ifdef CONFIG_GPIOLIB -static inline struct wm8903_priv *gpio_to_wm8903(struct gpio_chip *chip) -{ - return container_of(chip, struct wm8903_priv, gpio_chip); -} - static int wm8903_gpio_request(struct gpio_chip *chip, unsigned offset) { if (offset >= WM8903_NUM_GPIO) @@ -1781,7 +1776,7 @@ static int wm8903_gpio_request(struct gpio_chip *chip, unsigned offset) static int wm8903_gpio_direction_in(struct gpio_chip *chip, unsigned offset) { - struct wm8903_priv *wm8903 = gpio_to_wm8903(chip); + struct wm8903_priv *wm8903 = gpiochip_get_data(chip); unsigned int mask, val; int ret; @@ -1799,7 +1794,7 @@ static int wm8903_gpio_direction_in(struct gpio_chip *chip, unsigned offset) static int wm8903_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct wm8903_priv *wm8903 = gpio_to_wm8903(chip); + struct wm8903_priv *wm8903 = gpiochip_get_data(chip); unsigned int reg; regmap_read(wm8903->regmap, WM8903_GPIO_CONTROL_1 + offset, ®); @@ -1810,7 +1805,7 @@ static int wm8903_gpio_get(struct gpio_chip *chip, unsigned offset) static int wm8903_gpio_direction_out(struct gpio_chip *chip, unsigned offset, int value) { - struct wm8903_priv *wm8903 = gpio_to_wm8903(chip); + struct wm8903_priv *wm8903 = gpiochip_get_data(chip); unsigned int mask, val; int ret; @@ -1828,7 +1823,7 @@ static int wm8903_gpio_direction_out(struct gpio_chip *chip, static void wm8903_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct wm8903_priv *wm8903 = gpio_to_wm8903(chip); + struct wm8903_priv *wm8903 = gpiochip_get_data(chip); regmap_update_bits(wm8903->regmap, WM8903_GPIO_CONTROL_1 + offset, WM8903_GP1_LVL_MASK, @@ -1860,7 +1855,7 @@ static void wm8903_init_gpio(struct wm8903_priv *wm8903) else wm8903->gpio_chip.base = -1; - ret = gpiochip_add(&wm8903->gpio_chip); + ret = gpiochip_add_data(&wm8903->gpio_chip, wm8903); if (ret != 0) dev_err(wm8903->dev, "Failed to add GPIOs: %d\n", ret); }