From patchwork Wed Dec 9 13:51:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58133 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp681368lbb; Wed, 9 Dec 2015 05:51:35 -0800 (PST) X-Received: by 10.66.219.163 with SMTP id pp3mr7852134pac.55.1449669095239; Wed, 09 Dec 2015 05:51:35 -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.34; Wed, 09 Dec 2015 05:51:35 -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 S1754719AbbLINve (ORCPT + 4 others); Wed, 9 Dec 2015 08:51:34 -0500 Received: from mail-lb0-f177.google.com ([209.85.217.177]:36248 "EHLO mail-lb0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754087AbbLINvd (ORCPT ); Wed, 9 Dec 2015 08:51:33 -0500 Received: by lbblt2 with SMTP id lt2so30478436lbb.3 for ; Wed, 09 Dec 2015 05:51:32 -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=A7Is2c07WCCWfEWCeTUkWaGP/zFlGLZlNZTsqaYpQKw=; b=ZQweXtSSgFRbuL50xIB9BrP0PehvUWf9xPnyi5leZF7Fc0XPxpviKYlDvuroMPAsNK Ievj3Ifox9b2PrfqCvFgzh8/4aNYqkXepnKimjy+ZfLjEpS/BaQOZSN/7LV1H9zvm7lx 1P1C7zhH3nAXp+OPn3sbExf1NuLrTS8B80fuKpezUOyrVI6WOjY0SSUelnHoLdHAPk5l 5f3LMYNjwsdivEczfQRh0hxNNmv7IzdJnxRb9npyCKlW2o98q6kkW3jswHH9bGQHJ9hW Zt74C4XDXxa8qqlL32DxWZpWQaGZUT4EIyv50N5QU1nEV6n+3zjfrWajjPledEoqubUu 59UA== 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=A7Is2c07WCCWfEWCeTUkWaGP/zFlGLZlNZTsqaYpQKw=; b=Tu+7oZifOJFfXUsWPyClX0txNen/KezJd+EIosSomMA/oiZ2X28LE+Pv5SI+fzM1z3 P5ooPEdmPJjIIrpmpYb9onEqB8cJ5ejm3h7WD/wZd38xE56X7MRuB0vmGJ84lYpAtdB/ wt/EA8Vev4zbI7FLpo+sSGpmnqcFZn/j6n662aC791/yJ3fA0RIVqQ0H9NbFI/KXy7u4 O7xln+5bTEkptbmDmC9PrrgSolEOQCz0B8XY5NdSvbmi5fCV4F4ao3hAGl7Qfwzic31o NJljTkiQfjIqAlFBy/SVCjgZzzU0hXuqkI11uqmdDanoxi9E8Sf2taweKmxoAL4tqcqb LkMQ== X-Gm-Message-State: ALoCoQnBEzzH7361VXJGsTWS62pXu4FWTMeHYIKfTKAf06up1XmCG6pogCYt0O2uYtRbw9oIte7GgZEPF/d636wFAjZCpzOPOg== X-Received: by 10.112.129.98 with SMTP id nv2mr2327258lbb.17.1449669092364; Wed, 09 Dec 2015 05:51:32 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id w132sm1472549lfd.11.2015.12.09.05.51.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:51:31 -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 177/182] ASoC: wm5100: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:51:29 +0100 Message-Id: <1449669089-7167-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/wm5100.c | 16 ++++++---------- 1 file changed, 6 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/wm5100.c b/sound/soc/codecs/wm5100.c index 171a23ddd15d..512a9d25fe6f 100644 --- a/sound/soc/codecs/wm5100.c +++ b/sound/soc/codecs/wm5100.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -2236,14 +2237,9 @@ static irqreturn_t wm5100_edge_irq(int irq, void *data) } #ifdef CONFIG_GPIOLIB -static inline struct wm5100_priv *gpio_to_wm5100(struct gpio_chip *chip) -{ - return container_of(chip, struct wm5100_priv, gpio_chip); -} - static void wm5100_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct wm5100_priv *wm5100 = gpio_to_wm5100(chip); + struct wm5100_priv *wm5100 = gpiochip_get_data(chip); regmap_update_bits(wm5100->regmap, WM5100_GPIO_CTRL_1 + offset, WM5100_GP1_LVL, !!value << WM5100_GP1_LVL_SHIFT); @@ -2252,7 +2248,7 @@ static void wm5100_gpio_set(struct gpio_chip *chip, unsigned offset, int value) static int wm5100_gpio_direction_out(struct gpio_chip *chip, unsigned offset, int value) { - struct wm5100_priv *wm5100 = gpio_to_wm5100(chip); + struct wm5100_priv *wm5100 = gpiochip_get_data(chip); int val, ret; val = (1 << WM5100_GP1_FN_SHIFT) | (!!value << WM5100_GP1_LVL_SHIFT); @@ -2268,7 +2264,7 @@ static int wm5100_gpio_direction_out(struct gpio_chip *chip, static int wm5100_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct wm5100_priv *wm5100 = gpio_to_wm5100(chip); + struct wm5100_priv *wm5100 = gpiochip_get_data(chip); unsigned int reg; int ret; @@ -2281,7 +2277,7 @@ static int wm5100_gpio_get(struct gpio_chip *chip, unsigned offset) static int wm5100_gpio_direction_in(struct gpio_chip *chip, unsigned offset) { - struct wm5100_priv *wm5100 = gpio_to_wm5100(chip); + struct wm5100_priv *wm5100 = gpiochip_get_data(chip); return regmap_update_bits(wm5100->regmap, WM5100_GPIO_CTRL_1 + offset, WM5100_GP1_FN_MASK | WM5100_GP1_DIR, @@ -2313,7 +2309,7 @@ static void wm5100_init_gpio(struct i2c_client *i2c) else wm5100->gpio_chip.base = -1; - ret = gpiochip_add(&wm5100->gpio_chip); + ret = gpiochip_add_data(&wm5100->gpio_chip, wm5100); if (ret != 0) dev_err(&i2c->dev, "Failed to add GPIOs: %d\n", ret); }