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: 58132 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp681310lbb; Wed, 9 Dec 2015 05:51:28 -0800 (PST) X-Received: by 10.66.144.65 with SMTP id sk1mr7916440pab.126.1449669088436; Wed, 09 Dec 2015 05:51:28 -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.28; Wed, 09 Dec 2015 05:51:28 -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 S1754739AbbLINv1 (ORCPT + 4 others); Wed, 9 Dec 2015 08:51:27 -0500 Received: from mail-lf0-f54.google.com ([209.85.215.54]:34816 "EHLO mail-lf0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754719AbbLINv0 (ORCPT ); Wed, 9 Dec 2015 08:51:26 -0500 Received: by lfdl133 with SMTP id l133so34494136lfd.2 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=YfHnB9wDS6TfwGwUNWAHkzH0sransxPKgHZLyKKWqgmmoakiPjlIyx9JnwuVMn5Sta HwrmYUB2l2KDynkvS57kgQqobdwKMQSwLdEs17afWFA6zJpEPc//Ar2W7NYJ1bYlN2Uj HiOS2yCz+2aoo2TFgXdhSB5rH2PLwM5NopDUNcqDjnpaUefZlPtQZASEL6ruGHTX/h7c K9WOjCjGSGBBYifTklvRZO2f0FJciPcsC6Q7khZt29l6Y6zshJPe3RtV75jG+kkoXFN2 RHXjX6SZNDV/Lc7AuZ7uQ8hc6A60YVmssCBgg1CEWrROeY7hcQudaWzE9O43V2w7bKro cDGA== X-Gm-Message-State: ALoCoQmBCBh57LTZo34W71xtZK2N2Rb52ZreubGE3La0rcIXsjsK0BXa/J6OCyc5gTVkJdtXRLTYF7I9F5+dIp2YZJG++eBiTQ== 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 Cc: Linus Walleij , Bard Liao , Oder Chiou , alsa-devel@alsa-project.org Subject: [PATCH 176/182] ASoC: rt5677: use gpiochip data pointer 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 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: Bard Liao Cc: Oder Chiou 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/rt5677.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: Mark Brown 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); }