From patchwork Wed Dec 9 13:51:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58135 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp681520lbb; Wed, 9 Dec 2015 05:51:53 -0800 (PST) X-Received: by 10.98.72.133 with SMTP id q5mr12925779pfi.157.1449669112770; Wed, 09 Dec 2015 05:51:52 -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.52; Wed, 09 Dec 2015 05:51:52 -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 S1754087AbbLINvw (ORCPT + 4 others); Wed, 9 Dec 2015 08:51:52 -0500 Received: from mail-lb0-f178.google.com ([209.85.217.178]:35568 "EHLO mail-lb0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753942AbbLINvv (ORCPT ); Wed, 9 Dec 2015 08:51:51 -0500 Received: by lbpu9 with SMTP id u9so30162176lbp.2 for ; Wed, 09 Dec 2015 05:51:50 -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=g+iofM5zcCe+qpmxI1knl/zKgNAic7V/eJZCXN5TxSQ=; b=i2d4bs/WDZPcJDo41HPwmB9xU71z3KVqor8rWTTsOHxruXVX2Gg0snZT2TmwTVL2+s NOCXmA0fsPtUTSiN+YWO1EjIoE4hgfiIoYWdmg6rEAN6/li5Zi7waowDmvCgmIMuigxK 8ONrTE5fHAAnpHMwXm7Ej2yWAWzt/ywe93cqtwGhogSSfi9M/eTJdtZ3st5jkowstp9D zr+ifHA2enlU4j8/m+ZjWQ4Z0W91iIUN7MboHrtw7FGDeRsS5iuj3GJ/ekHHjMm97V8Q lcjz0u0m/oseenapMIAM8ypCQbe+897WXgVIVI6p9S6nNRVHLSaVjpLBp9HK1vfnjlBQ 7/cA== 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=g+iofM5zcCe+qpmxI1knl/zKgNAic7V/eJZCXN5TxSQ=; b=aG8i9ImxkhTIkiRFAgU3dMAUzxRX8QEHOprR+H/+xt79OEjHJV9XIFL3VKHOR4sjV+ akfqw4UL/zk0+PVzlVf2k+7zzWEUOtMZx388xLjA2ycNOwmR9Wry4NMAjGWh5I39D3g/ r6VwtgAzR2fGEyPEhXhMqBlsJtdR00OeguvWK7LvjAurpHYyDkv/jj89qqLfDipX8MuV 0rcnSD8G7dWKIcteLrHN4DNoeMykYvVf1AlIstPIRABseuVTUGz6FWjc9hlQb609Bm7x uEEGI6z8yS/2pUdNQ0Mo4AgCnNJjMIOOoQUhM6mfGRQLeWHI0l6Cs0VG1cQF0x6dI5G7 xX8A== X-Gm-Message-State: ALoCoQnjNOThZW2+tIYvcckswftMNPPPt7gwLHkny410dzZeJR2ced1POPXgCQiwRK5eE7Qpj6XM1j7vlSp/2KjNLIv8bJKuEQ== X-Received: by 10.112.160.169 with SMTP id xl9mr2459092lbb.40.1449669110255; Wed, 09 Dec 2015 05:51:50 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 42sm1477453lfv.29.2015.12.09.05.51.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:51:49 -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 179/182] ASoC: wm8962: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:51:47 +0100 Message-Id: <1449669107-7264-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/wm8962.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 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/wm8962.c b/sound/soc/codecs/wm8962.c index b563d6746ac4..1577d2e62e76 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include @@ -3308,14 +3308,9 @@ static void wm8962_set_gpio_mode(struct wm8962_priv *wm8962, int gpio) } #ifdef CONFIG_GPIOLIB -static inline struct wm8962_priv *gpio_to_wm8962(struct gpio_chip *chip) -{ - return container_of(chip, struct wm8962_priv, gpio_chip); -} - static int wm8962_gpio_request(struct gpio_chip *chip, unsigned offset) { - struct wm8962_priv *wm8962 = gpio_to_wm8962(chip); + struct wm8962_priv *wm8962 = gpiochip_get_data(chip); /* The WM8962 GPIOs aren't linearly numbered. For simplicity * we export linear numbers and error out if the unsupported @@ -3338,7 +3333,7 @@ static int wm8962_gpio_request(struct gpio_chip *chip, unsigned offset) static void wm8962_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct wm8962_priv *wm8962 = gpio_to_wm8962(chip); + struct wm8962_priv *wm8962 = gpiochip_get_data(chip); struct snd_soc_codec *codec = wm8962->codec; snd_soc_update_bits(codec, WM8962_GPIO_BASE + offset, @@ -3348,7 +3343,7 @@ static void wm8962_gpio_set(struct gpio_chip *chip, unsigned offset, int value) static int wm8962_gpio_direction_out(struct gpio_chip *chip, unsigned offset, int value) { - struct wm8962_priv *wm8962 = gpio_to_wm8962(chip); + struct wm8962_priv *wm8962 = gpiochip_get_data(chip); struct snd_soc_codec *codec = wm8962->codec; int ret, val; @@ -3387,7 +3382,7 @@ static void wm8962_init_gpio(struct snd_soc_codec *codec) else wm8962->gpio_chip.base = -1; - ret = gpiochip_add(&wm8962->gpio_chip); + ret = gpiochip_add_data(&wm8962->gpio_chip, wm8962); if (ret != 0) dev_err(codec->dev, "Failed to add GPIOs: %d\n", ret); }