From patchwork Wed Dec 9 13:51:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 7808781 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1F08FBEEE1 for ; Wed, 9 Dec 2015 13:51:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 33A86204AB for ; Wed, 9 Dec 2015 13:51:45 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id DABC020457 for ; Wed, 9 Dec 2015 13:51:43 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 77C692605D8; Wed, 9 Dec 2015 14:51:37 +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 29CE6260609; Wed, 9 Dec 2015 14:51:33 +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 9AFD3260609; Wed, 9 Dec 2015 14:51:32 +0100 (CET) Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com [209.85.215.54]) by alsa0.perex.cz (Postfix) with ESMTP id 601E12605D8 for ; Wed, 9 Dec 2015 14:51:25 +0100 (CET) Received: by lfs39 with SMTP id 39so34822950lfs.3 for ; Wed, 09 Dec 2015 05:51:24 -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=QLhq8GVvvYa75XM4Fq4gJExTzFEMrirp33FrAGJicWs=; b=DjEdOx1FOyLk1Z5byBTD/KH5vc8cft/6+YIKUyw+OY9PCyOwxSqS04pyRcgZp2ZNyK gwz/Spo6PJQclAYPgm7sVYyJ2efn9KzkyOBysDQ3r3OML1TC98X0QSdg6EUg4ir0VLAe +Y8eaq01Sgn3SGIGSRLCw/Qncc6SXdNbgLXl5rBSnPBkTepHZMnag/gOD7Mm1aLM4naF xpe6Bn6W99QuO2AvRgH2jcgD98rQaw4q+WUOVt3RtsXtB8Ty/gQSUGZ6DItErMM37FZs A/2zI2rSZMESQwJfJEjmVTBdWe4LIg32fR2G1U2VHuB4UnVVyQOW2jt8fY3TqXNyfVky 9/Fw== 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=QLhq8GVvvYa75XM4Fq4gJExTzFEMrirp33FrAGJicWs=; b=hwE+rQXSranDiXHZclpK1NckHAOxIoyyjE/3I7bnD75azAg+J04pAeLbS7NnHh17+j kWzgYuwR8jyETlxq3tz0GEFFRWIQVvM4Em+myXx+GQ0usMlg2BQXwLakoPy9uGR8KBMG 7Vt7Hwo2obgnTDlSqPj1WTzP3NuR8VnRdXDVsSvE5D1ONw8NPydHxGBkycZiYGPPxWKt 2OOI+jXiK7KeFtFeOEuXKE32ylg+HjUnOTE9pbm+eH5WS9ysWagRnfb6g0j9+eE7IMUo GfPSnTdP2N2ALbJ/uxrV5/IIkkzx1gNBI2f1MK4oMTqBndqt1uLJVSVpX3jMrIWY4GG0 aNug== X-Gm-Message-State: ALoCoQmAxVGEDXHGHrFp4HNT3cybmFV+NpBYfobR1BTmncbXJ+c8D+HZAk2xZbuk9FK4FO+Qh1OJ0pRzJoRgfK98ZhNSUd4eug== X-Received: by 10.25.166.146 with SMTP id p140mr2494258lfe.51.1449669084818; Wed, 09 Dec 2015 05:51:24 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id h196sm1451095lfb.48.2015.12.09.05.51.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:51:24 -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:19 +0100 Message-Id: <1449669079-7119-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 Cc: Oder Chiou , Bard Liao , Linus Walleij , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 176/182] ASoC: rt5677: 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: Bard Liao Cc: Oder Chiou Cc: Liam Girdwood Cc: Mark Brown Cc: alsa-devel@alsa-project.org Signed-off-by: Linus Walleij Acked-by: Mark Brown --- Liam/Mark: please ACK this so I can merge it into the GPIO tree. --- sound/soc/codecs/rt5677.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 1f590b5a6718..89dda8962c7c 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@ -4500,14 +4500,9 @@ static int rt5677_set_bias_level(struct snd_soc_codec *codec, } #ifdef CONFIG_GPIOLIB -static inline struct rt5677_priv *gpio_to_rt5677(struct gpio_chip *chip) -{ - return container_of(chip, struct rt5677_priv, gpio_chip); -} - static void rt5677_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct rt5677_priv *rt5677 = gpio_to_rt5677(chip); + struct rt5677_priv *rt5677 = gpiochip_get_data(chip); switch (offset) { case RT5677_GPIO1 ... RT5677_GPIO5: @@ -4528,7 +4523,7 @@ static void rt5677_gpio_set(struct gpio_chip *chip, unsigned offset, int value) static int rt5677_gpio_direction_out(struct gpio_chip *chip, unsigned offset, int value) { - struct rt5677_priv *rt5677 = gpio_to_rt5677(chip); + struct rt5677_priv *rt5677 = gpiochip_get_data(chip); switch (offset) { case RT5677_GPIO1 ... RT5677_GPIO5: @@ -4552,7 +4547,7 @@ static int rt5677_gpio_direction_out(struct gpio_chip *chip, static int rt5677_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct rt5677_priv *rt5677 = gpio_to_rt5677(chip); + struct rt5677_priv *rt5677 = gpiochip_get_data(chip); int value, ret; ret = regmap_read(rt5677->regmap, RT5677_GPIO_ST, &value); @@ -4564,7 +4559,7 @@ static int rt5677_gpio_get(struct gpio_chip *chip, unsigned offset) static int rt5677_gpio_direction_in(struct gpio_chip *chip, unsigned offset) { - struct rt5677_priv *rt5677 = gpio_to_rt5677(chip); + struct rt5677_priv *rt5677 = gpiochip_get_data(chip); switch (offset) { case RT5677_GPIO1 ... RT5677_GPIO5: @@ -4618,7 +4613,7 @@ static void rt5677_gpio_config(struct rt5677_priv *rt5677, unsigned offset, static int rt5677_to_irq(struct gpio_chip *chip, unsigned offset) { - struct rt5677_priv *rt5677 = gpio_to_rt5677(chip); + struct rt5677_priv *rt5677 = gpiochip_get_data(chip); struct regmap_irq_chip_data *data = rt5677->irq_data; int irq; @@ -4677,7 +4672,7 @@ static void rt5677_init_gpio(struct i2c_client *i2c) rt5677->gpio_chip.parent = &i2c->dev; rt5677->gpio_chip.base = -1; - ret = gpiochip_add(&rt5677->gpio_chip); + ret = gpiochip_add_data(&rt5677->gpio_chip, rt5677); if (ret != 0) dev_err(&i2c->dev, "Failed to add GPIOs: %d\n", ret); }