From patchwork Wed Dec 9 13:51:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 7808821 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 8EDD69F350 for ; Wed, 9 Dec 2015 13:55:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ADB6F204A9 for ; Wed, 9 Dec 2015 13:55:39 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 7DE3520457 for ; Wed, 9 Dec 2015 13:55:38 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 53CB32612DF; Wed, 9 Dec 2015 14:55:31 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 3589C2612D7; Wed, 9 Dec 2015 14:53:01 +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 0B2412612D7; Wed, 9 Dec 2015 14:53:00 +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 mail-lb0-f180.google.com (mail-lb0-f180.google.com [209.85.217.180]) by alsa0.perex.cz (Postfix) with ESMTP id B28AF26065A for ; Wed, 9 Dec 2015 14:51:58 +0100 (CET) Received: by lbbkw15 with SMTP id kw15so30377801lbb.0 for ; Wed, 09 Dec 2015 05:51:57 -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=FRIvkwne7V7VpplZnx7/eNsF/5/cXrJqo3ur+XHMvIs=; b=X3sZx6CY2mUWpIIXp/Sd56e5NL+K3WA262NzrqMdXuQKVx99TnHD9AOjMuS1RPEfSB x1xxPmyOZ83EBQZ5ljdxA/wfuvjEmSdYJs/e27aQWh0e8FHcIG5ErfVvxsSVj5AYqBM7 yzypy05LuTa3ELGi8tjRhtf31/T+v1al5c+MUXtQGzo0c+t4CQ3p6ha2y9dMrJpgBiKk 1/8tMKaanABjwaAO6Sdi86LNJg4flhPddT/39P3JCcaKJdAv2HZ0B0Car70Ylycjr9Lm 0R2mSKxSIUL3ry4nLPMruLM+O3gRQu9BUtDiaBQKMI62EQLrnOC6UZaxFBpCq/qDq63k rrOQ== 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=FRIvkwne7V7VpplZnx7/eNsF/5/cXrJqo3ur+XHMvIs=; b=GVqWerlAo/Ga1X4GEZ4HAI+uo9fg6VitnvvKcHj3Lwz8WFYyqmsD6vukMbIaMxh1PC WgZxUHsyYZT401af1UVKXSNPzvh7V3dRHmpS29Clp6MO4WzezJYX22OERVy8aFTq1J5k B6otrM7g8mmLdeRToNYXMYymP4Kwq1Evsu7m+lPpxBkxZdaDEq2QvCI7ClOdVsV7NSkQ XuvTJD9cP+xiZ2xlXUfLQWAlmWsSu+gGwvO10PTPrA7EVx4oiLuCe2AJToJ5/ac894rK WUGKBUfmVWUsnLn8RIjfCRnZrrlA/NZ7yhldAB/FyvtqlEQ8oNnkT4uYFXPQEKKJlvGD oCAA== X-Gm-Message-State: ALoCoQniWC6yAwk9XkAe9mEfRMAKNAYf3FKGN8T1S8xZFb3RYpGUGZrQdLGFHBAkEyVLRE9nupbtifrR2IPUiAeksFMQrgB+ig== X-Received: by 10.112.16.162 with SMTP id h2mr2043461lbd.89.1449669117888; Wed, 09 Dec 2015 05:51:57 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id e9sm1434088lbs.13.2015.12.09.05.51.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:51:57 -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:54 +0100 Message-Id: <1449669114-7317-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 180/182] ASoC: wm8996: 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/wm8996.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index 8d7d6c01a2f7..f9656df9dccc 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -2139,14 +2140,9 @@ static int wm8996_set_fll(struct snd_soc_codec *codec, int fll_id, int source, } #ifdef CONFIG_GPIOLIB -static inline struct wm8996_priv *gpio_to_wm8996(struct gpio_chip *chip) -{ - return container_of(chip, struct wm8996_priv, gpio_chip); -} - static void wm8996_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct wm8996_priv *wm8996 = gpio_to_wm8996(chip); + struct wm8996_priv *wm8996 = gpiochip_get_data(chip); regmap_update_bits(wm8996->regmap, WM8996_GPIO_1 + offset, WM8996_GP1_LVL, !!value << WM8996_GP1_LVL_SHIFT); @@ -2155,7 +2151,7 @@ static void wm8996_gpio_set(struct gpio_chip *chip, unsigned offset, int value) static int wm8996_gpio_direction_out(struct gpio_chip *chip, unsigned offset, int value) { - struct wm8996_priv *wm8996 = gpio_to_wm8996(chip); + struct wm8996_priv *wm8996 = gpiochip_get_data(chip); int val; val = (1 << WM8996_GP1_FN_SHIFT) | (!!value << WM8996_GP1_LVL_SHIFT); @@ -2167,7 +2163,7 @@ static int wm8996_gpio_direction_out(struct gpio_chip *chip, static int wm8996_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct wm8996_priv *wm8996 = gpio_to_wm8996(chip); + struct wm8996_priv *wm8996 = gpiochip_get_data(chip); unsigned int reg; int ret; @@ -2180,7 +2176,7 @@ static int wm8996_gpio_get(struct gpio_chip *chip, unsigned offset) static int wm8996_gpio_direction_in(struct gpio_chip *chip, unsigned offset) { - struct wm8996_priv *wm8996 = gpio_to_wm8996(chip); + struct wm8996_priv *wm8996 = gpiochip_get_data(chip); return regmap_update_bits(wm8996->regmap, WM8996_GPIO_1 + offset, WM8996_GP1_FN_MASK | WM8996_GP1_DIR, @@ -2211,7 +2207,7 @@ static void wm8996_init_gpio(struct wm8996_priv *wm8996) else wm8996->gpio_chip.base = -1; - ret = gpiochip_add(&wm8996->gpio_chip); + ret = gpiochip_add_data(&wm8996->gpio_chip, wm8996); if (ret != 0) dev_err(wm8996->dev, "Failed to add GPIOs: %d\n", ret); }