From patchwork Wed Dec 9 13:17:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57990 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp662188lbb; Wed, 9 Dec 2015 05:17:44 -0800 (PST) X-Received: by 10.66.192.193 with SMTP id hi1mr7804553pac.110.1449667064379; Wed, 09 Dec 2015 05:17:44 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s26si12711651pfi.57.2015.12.09.05.17.44; Wed, 09 Dec 2015 05:17:44 -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 S1753942AbbLINRn (ORCPT + 4 others); Wed, 9 Dec 2015 08:17:43 -0500 Received: from mail-lb0-f182.google.com ([209.85.217.182]:35699 "EHLO mail-lb0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753598AbbLINRn (ORCPT ); Wed, 9 Dec 2015 08:17:43 -0500 Received: by lbpu9 with SMTP id u9so29581702lbp.2 for ; Wed, 09 Dec 2015 05:17:41 -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=eoWZN9cpUQ/h+jgR8yUdESEZeuzizuQsyei/dA2Mo/g=; b=TKRR1mPS6hDClvmX65ABAakVgBHaNpA5Ib0CSex7ZTipa7jk+UonBrM7z7ffxYfVX/ gIDmIPGFXiuxYS/Gm0UWxnopqQshvCM5/VjZSvmiAZlLhtPCL81WcSlUBCZ553XFtf8u R3RRnv1BFlzc4MM/W9C4wkvheu5S3kta8c3IjjlKTGKk4FiRPQgs9vjmMhDWO9U9nVnU wqSMN1Rpz2nZfv+D4h2TEFLNkhT3FoDcpQYL2QLJ4gApb/d9M+ABM7+zCq58LnlylxUR 3n7kx7uh5Ze3wjL1lIYzpBB2datmvcqiiwW/GGUTH0y7Y/dljzABDZhKHwGTqKGTUOLg C4lg== 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=eoWZN9cpUQ/h+jgR8yUdESEZeuzizuQsyei/dA2Mo/g=; b=AYLdgjtUwGPijY4gxz97MXPxgU7zhDaSTPyay/IveFS0mr50ry9AUFUlwv/4tjNYKn eJPgxnHGi9LCPf0ohUV5G+nZyw/SjWeht40JNHWJ0Jq/vw9GvAWtqSThOPmjZmbNNebX H0MY2COdFFms0x4o0sRnba9KTbg6pvxwDKgVK6HqjnM0AppI/gCAnj1ytGuUO4BzCnML PACL3OWGttoWJvDtSo/PSjquQoOtLfjpOhRKS2Xkb8EJFkj6JQwlSooThyVZ8CtI/oem 2JKwkOHAhTAyekiiXlWG/x9pb0QvgpSvnXyndHvxjsY0NeqV/mHcLR9j8RmymnkaAhHX wkmA== X-Gm-Message-State: ALoCoQmBns9dG4dxU5MRzqT+/WSg5T/ZU9P7g/Os+/G+I3zsYow9bYC8s1LMpBMqu44oJzNs+A65RLRBSyj8DhGZcoxvpDkdrA== X-Received: by 10.112.199.41 with SMTP id jh9mr1913398lbc.119.1449667061807; Wed, 09 Dec 2015 05:17:41 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id j123sm1432930lfb.19.2015.12.09.05.17.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:17:41 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Jassi Brar Subject: [PATCH 035/182] gpio: mb86s7x: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:17:38 +0100 Message-Id: <1449667058-31408-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: Jassi Brar Signed-off-by: Linus Walleij --- drivers/gpio/gpio-mb86s7x.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 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: Jassi Brar diff --git a/drivers/gpio/gpio-mb86s7x.c b/drivers/gpio/gpio-mb86s7x.c index 93d61a5be0d4..7fffc1d6c055 100644 --- a/drivers/gpio/gpio-mb86s7x.c +++ b/drivers/gpio/gpio-mb86s7x.c @@ -44,14 +44,9 @@ struct mb86s70_gpio_chip { spinlock_t lock; }; -static inline struct mb86s70_gpio_chip *chip_to_mb86s70(struct gpio_chip *gc) -{ - return container_of(gc, struct mb86s70_gpio_chip, gc); -} - static int mb86s70_gpio_request(struct gpio_chip *gc, unsigned gpio) { - struct mb86s70_gpio_chip *gchip = chip_to_mb86s70(gc); + struct mb86s70_gpio_chip *gchip = gpiochip_get_data(gc); unsigned long flags; u32 val; @@ -73,7 +68,7 @@ static int mb86s70_gpio_request(struct gpio_chip *gc, unsigned gpio) static void mb86s70_gpio_free(struct gpio_chip *gc, unsigned gpio) { - struct mb86s70_gpio_chip *gchip = chip_to_mb86s70(gc); + struct mb86s70_gpio_chip *gchip = gpiochip_get_data(gc); unsigned long flags; u32 val; @@ -88,7 +83,7 @@ static void mb86s70_gpio_free(struct gpio_chip *gc, unsigned gpio) static int mb86s70_gpio_direction_input(struct gpio_chip *gc, unsigned gpio) { - struct mb86s70_gpio_chip *gchip = chip_to_mb86s70(gc); + struct mb86s70_gpio_chip *gchip = gpiochip_get_data(gc); unsigned long flags; unsigned char val; @@ -106,7 +101,7 @@ static int mb86s70_gpio_direction_input(struct gpio_chip *gc, unsigned gpio) static int mb86s70_gpio_direction_output(struct gpio_chip *gc, unsigned gpio, int value) { - struct mb86s70_gpio_chip *gchip = chip_to_mb86s70(gc); + struct mb86s70_gpio_chip *gchip = gpiochip_get_data(gc); unsigned long flags; unsigned char val; @@ -130,14 +125,14 @@ static int mb86s70_gpio_direction_output(struct gpio_chip *gc, static int mb86s70_gpio_get(struct gpio_chip *gc, unsigned gpio) { - struct mb86s70_gpio_chip *gchip = chip_to_mb86s70(gc); + struct mb86s70_gpio_chip *gchip = gpiochip_get_data(gc); return !!(readl(gchip->base + PDR(gpio)) & OFFSET(gpio)); } static void mb86s70_gpio_set(struct gpio_chip *gc, unsigned gpio, int value) { - struct mb86s70_gpio_chip *gchip = chip_to_mb86s70(gc); + struct mb86s70_gpio_chip *gchip = gpiochip_get_data(gc); unsigned long flags; unsigned char val; @@ -192,7 +187,7 @@ static int mb86s70_gpio_probe(struct platform_device *pdev) platform_set_drvdata(pdev, gchip); - ret = gpiochip_add(&gchip->gc); + ret = gpiochip_add_data(&gchip->gc, gchip); if (ret) { dev_err(&pdev->dev, "couldn't register gpio driver\n"); clk_disable_unprepare(gchip->clk);