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: 58134 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp681446lbb; Wed, 9 Dec 2015 05:51:45 -0800 (PST) X-Received: by 10.66.159.38 with SMTP id wz6mr8160285pab.12.1449669105237; Wed, 09 Dec 2015 05:51:45 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s12si12906112pfi.64.2015.12.09.05.51.44; Wed, 09 Dec 2015 05:51:45 -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 S1754730AbbLINvo (ORCPT + 4 others); Wed, 9 Dec 2015 08:51:44 -0500 Received: from mail-lb0-f178.google.com ([209.85.217.178]:35503 "EHLO mail-lb0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754087AbbLINvo (ORCPT ); Wed, 9 Dec 2015 08:51:44 -0500 Received: by lbpu9 with SMTP id u9so30159883lbp.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=augjLEojAGs81NFOR5VHQio8LaW+9sxHpAkqS11nVp4924wCQT3cqUD1UzoamFltik 4jbOgYnRK9BPyF9OTC+pIlakwB03GYB/QnyPEw+VjBeJx+VilHbWMKhupNezm3UlGqio JMLjEmKPkX/eXoyitrBZsMfbcpu3CXrZmBJvLCJV4Qd7/+qhWxIgQF8kqARq5si8W2zw 74Jqt/t3O/q6qJVnb8FUi8BbnTdww8X2iAbrUdO9+yZ6xC4GkyJ41+6D5InNayhj0zmV 6YgI8tRHarr9gGpfnYdpyGJ3c2s4iiB+GgK+6rAXrcZwoz2CR6mLTOkm7/hUpXv4395q P4+w== X-Gm-Message-State: ALoCoQmBTGdBgV01MELHts9lvaUSNOhBmje+w2mdOzLsESxGbOarTAUL1gog2QicO6jUqEKvUOn3C9EuVWzWrrrPPp3cNVIGSQ== 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 Cc: Linus Walleij , alsa-devel@alsa-project.org Subject: [PATCH 178/182] ASoC: wm8903: use gpiochip data pointer 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 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/codecs/wm8903.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 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: Charles Keepax Acked-by: Mark Brown 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); }