From patchwork Wed Dec 9 13:27:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58036 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp668088lbb; Wed, 9 Dec 2015 05:27:59 -0800 (PST) X-Received: by 10.66.160.36 with SMTP id xh4mr7847377pab.149.1449667679267; Wed, 09 Dec 2015 05:27:59 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ny6si12718088pab.215.2015.12.09.05.27.59; Wed, 09 Dec 2015 05:27:59 -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 S1753754AbbLIN16 (ORCPT + 4 others); Wed, 9 Dec 2015 08:27:58 -0500 Received: from mail-lb0-f175.google.com ([209.85.217.175]:34294 "EHLO mail-lb0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753251AbbLIN16 (ORCPT ); Wed, 9 Dec 2015 08:27:58 -0500 Received: by lbbcs9 with SMTP id cs9so29883462lbb.1 for ; Wed, 09 Dec 2015 05:27:56 -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=rr3Yp0KpkltJUa3Zi7n9JZOn3KypA3mAMcv9vNkVwVA=; b=foSDZaw+dRmuDPEHIYGrky6OqoA6jjN2owG5NDADz+gvpFoC0NDB8t9yAhEEE38Sso qhJQp6u3aZAnqxatLDQCb4AwvOQm1c4BvJ/mCfBJYcb0TnzXsJX+0xKBDM+2cyO9XOB7 u2DCzEeRyQXk3rjhdoHI7PICc1/5TSr7Y7WArSZXC5HF+lvptVjm9KkclTolbY/FBdA/ G0nyCxjC0tzSwwN4bwpbOUCuUHKhG+VS8+UczUMqHuea8Fs+JVTlfzHlI4pJZ9UDbk2T OnJHJw/QPs++juhaNQK3SjYnNwhI8W4rib6yU/ziDmclzaPy2PESGvy2rPepyMy+PWs8 eJEg== 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=rr3Yp0KpkltJUa3Zi7n9JZOn3KypA3mAMcv9vNkVwVA=; b=GWh6IQOe8wjfzmKnJUtWelVRMVMl9LZopAUdyjp1q85uZ6FWjf9E4jx3YCIKOjqUNP lwfOCB65uMhDnlsDBzIJtK9/f493WERBA8TbQwaZduSUNl42+8WaLhY4vRsQB5FKO3vG CSzRHsZsS8x3Ir1a65A6pvPkEyw3ZntyWiRTSUamv44LWTbs1gKn3oHe1a9O29XmQvEr BN3E2V1CF60rAy0TX6TDeCydZbH8qxmijYcxms1cOWWuWms8fMxrm3p3hxXYszHI76Cr Ocz8pcCnT3EMyWD8m+uBIplW8J8fE5GjjdjBfldG3JqMu454oI4ob7l7H97YXVyd8PmP vGwg== X-Gm-Message-State: ALoCoQlr6UJPYCJEKjISXUpOJ7QyNzK1zZYysb6JzygpRfuUHbo3QrFT2Knbu+i3iTF2IIyp07AFYPKOkGKnvI3muMItv2+etA== X-Received: by 10.112.147.69 with SMTP id ti5mr2481040lbb.2.1449667676838; Wed, 09 Dec 2015 05:27:56 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id x13sm1427379lfd.7.2015.12.09.05.27.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:27:56 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , patches@opensource.wolfsonmicro.com, Mark Brown Subject: [PATCH 080/182] gpio: wm8350: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:27:53 +0100 Message-Id: <1449667673-1207-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: patches@opensource.wolfsonmicro.com Cc: Mark Brown Signed-off-by: Linus Walleij --- drivers/gpio/gpio-wm8350.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 diff --git a/drivers/gpio/gpio-wm8350.c b/drivers/gpio/gpio-wm8350.c index 1e3d8da61ff3..0a306b4baa73 100644 --- a/drivers/gpio/gpio-wm8350.c +++ b/drivers/gpio/gpio-wm8350.c @@ -28,14 +28,9 @@ struct wm8350_gpio_data { struct gpio_chip gpio_chip; }; -static inline struct wm8350_gpio_data *to_wm8350_gpio(struct gpio_chip *chip) -{ - return container_of(chip, struct wm8350_gpio_data, gpio_chip); -} - static int wm8350_gpio_direction_in(struct gpio_chip *chip, unsigned offset) { - struct wm8350_gpio_data *wm8350_gpio = to_wm8350_gpio(chip); + struct wm8350_gpio_data *wm8350_gpio = gpiochip_get_data(chip); struct wm8350 *wm8350 = wm8350_gpio->wm8350; return wm8350_set_bits(wm8350, WM8350_GPIO_CONFIGURATION_I_O, @@ -44,7 +39,7 @@ static int wm8350_gpio_direction_in(struct gpio_chip *chip, unsigned offset) static int wm8350_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct wm8350_gpio_data *wm8350_gpio = to_wm8350_gpio(chip); + struct wm8350_gpio_data *wm8350_gpio = gpiochip_get_data(chip); struct wm8350 *wm8350 = wm8350_gpio->wm8350; int ret; @@ -60,7 +55,7 @@ static int wm8350_gpio_get(struct gpio_chip *chip, unsigned offset) static void wm8350_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct wm8350_gpio_data *wm8350_gpio = to_wm8350_gpio(chip); + struct wm8350_gpio_data *wm8350_gpio = gpiochip_get_data(chip); struct wm8350 *wm8350 = wm8350_gpio->wm8350; if (value) @@ -72,7 +67,7 @@ static void wm8350_gpio_set(struct gpio_chip *chip, unsigned offset, int value) static int wm8350_gpio_direction_out(struct gpio_chip *chip, unsigned offset, int value) { - struct wm8350_gpio_data *wm8350_gpio = to_wm8350_gpio(chip); + struct wm8350_gpio_data *wm8350_gpio = gpiochip_get_data(chip); struct wm8350 *wm8350 = wm8350_gpio->wm8350; int ret; @@ -89,7 +84,7 @@ static int wm8350_gpio_direction_out(struct gpio_chip *chip, static int wm8350_gpio_to_irq(struct gpio_chip *chip, unsigned offset) { - struct wm8350_gpio_data *wm8350_gpio = to_wm8350_gpio(chip); + struct wm8350_gpio_data *wm8350_gpio = gpiochip_get_data(chip); struct wm8350 *wm8350 = wm8350_gpio->wm8350; if (!wm8350->irq_base) @@ -130,7 +125,7 @@ static int wm8350_gpio_probe(struct platform_device *pdev) else wm8350_gpio->gpio_chip.base = -1; - ret = gpiochip_add(&wm8350_gpio->gpio_chip); + ret = gpiochip_add_data(&wm8350_gpio->gpio_chip, wm8350_gpio); if (ret < 0) { dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret); return ret;