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: 7808811 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 57A4D9F39B for ; Wed, 9 Dec 2015 13:55:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7B77A20490 for ; Wed, 9 Dec 2015 13:55:07 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 2FCDE20457 for ; Wed, 9 Dec 2015 13:55:06 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3243D2614C4; Wed, 9 Dec 2015 14:55:05 +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 D7877261293; Wed, 9 Dec 2015 14:52:43 +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 BBF3D2615F7; Wed, 9 Dec 2015 14:52:42 +0100 (CET) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com [209.85.217.181]) by alsa0.perex.cz (Postfix) with ESMTP id C32132612C6 for ; Wed, 9 Dec 2015 14:51:50 +0100 (CET) Received: by lbbkw15 with SMTP id kw15so30375588lbb.0 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=BBwnF5iNJ0VdUnpYw+NXK2Efv2L4oazsTuu9jO08bttLhgvn0/aaEojjQk4qabrW0p CkdbLwmaa6S081QW808ZazZ0vNtptjzyQxMXxdEiCKDz8O6Bgv18wfEnbtHxXdtQWgvO 1kpqr2PRB7a4EnLqhNdorH3FzyHtoVMGh0GORwsKnEKV0sRdsxmmTnAiYxkVAdJWgBH+ BJLyelyaBndDsGo1Hsz1K1CvBpXwonO9Xzs9yNWL7bdYFoJzmA7oXmwkXn23A0JZFgm8 6tHEF0uO1yd3wnVE7fwfV2RydsQVHtBflVNkz5f1LzQQoc0qt/OVspBXNWfzdGe6skig JG+g== X-Gm-Message-State: ALoCoQmo4tISHNit5wMEg9dLIlxheBhPYWfze/5lftPkL0ZlflXarujn+hOqhRb8RKlWNYxFkXxtz3g9TYo5FUs9ify91yQ2Jw== 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 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 Cc: Linus Walleij , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 179/182] ASoC: wm8962: 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/wm8962.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) 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); }