From patchwork Wed Dec 9 13:18:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57996 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp662685lbb; Wed, 9 Dec 2015 05:18:34 -0800 (PST) X-Received: by 10.98.73.13 with SMTP id w13mr12726063pfa.72.1449667114661; Wed, 09 Dec 2015 05:18:34 -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.18.34; Wed, 09 Dec 2015 05:18:34 -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 S1751531AbbLINSe (ORCPT + 4 others); Wed, 9 Dec 2015 08:18:34 -0500 Received: from mail-lf0-f43.google.com ([209.85.215.43]:33283 "EHLO mail-lf0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751310AbbLINSd (ORCPT ); Wed, 9 Dec 2015 08:18:33 -0500 Received: by lfaz4 with SMTP id z4so34025489lfa.0 for ; Wed, 09 Dec 2015 05:18: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=mogDaslKLvGbjtWU9FDCFJsxa2bw+4qINLLaq2xS+n0=; b=1yQsxr0Ie+p0cRqkX84gnX9MAm0dlholAjbsG2wQ65FeP7A8hlmnBkiqnGuWNNPKHm dsodog+VyEfRf9aDr5nBLAwv7KdDFjyKCoEqlVo5OQbYxMliWnsRLZBx2XWmD/YWP49z W4Th8jOGOXoUuMuLVRlG4kVtuRWHrhD+p3wfl2huvgYxHIMxQ3I+XPnl7j1usyidJMic 2l70km3CvXkZU1FhYEHuH2R4JfY5zj1Sdxu4NRH3Cxmlpeh9MwMqdI6AAA4eqIyustvC VRIvlqiUIfk/m1iqTW/flr27DKX5eqSnk8JVZ2z37oor/aABdXmoXsH2PKIkcsWr5EQP lkSg== 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=mogDaslKLvGbjtWU9FDCFJsxa2bw+4qINLLaq2xS+n0=; b=DkuUEqhBJoZd6IEdP6oBx2dk6XBM1Qu6AfgI322tfvVDyHSGZfvyvIdE9Y+Fbyy7vF hz64EaGPuhMJgFYj8wYARt0lNM6faJUYK1TfuDP2wdRlFdX67j+kiJMPNOHlCuDn5Vnc i9aySrcScW371d+RJ+aHRAM7sAJEKzrs1K+XbSH2Poj6XyLJQrS8Kwc4APGrINOW9zBg aGKGVztuZzjNVB3yjrHXpWy6vfRCfgJus8kyja4BaKAt4j/SNSdngHlfsMaS4JnGLuFQ cPjBr8wS5uocoU+OPr0rClp+UPxOx4334bB/DWoluFQt4n3Mj0FNfpAwaR+wyxU1cnFN 6TvQ== X-Gm-Message-State: ALoCoQnUNhZtCxkZHGacYxXGhaRF1DBLeR58DeHinMD3xpEAkEqBlJJ/III3j25CbJeF5XtdIQvGHhUxrfwvOgfJvhA/5hN33g== X-Received: by 10.25.40.138 with SMTP id o132mr2187030lfo.148.1449667112082; Wed, 09 Dec 2015 05:18:32 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id lc3sm1415478lbc.32.2015.12.09.05.18.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:18:31 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij Subject: [PATCH 041/182] gpio: mpc5200: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:18:28 +0100 Message-Id: <1449667108-31693-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(). Signed-off-by: Linus Walleij --- drivers/gpio/gpio-mpc5200.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 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-mpc5200.c b/drivers/gpio/gpio-mpc5200.c index 4c542153e923..ff6551c67502 100644 --- a/drivers/gpio/gpio-mpc5200.c +++ b/drivers/gpio/gpio-mpc5200.c @@ -71,8 +71,7 @@ static inline void __mpc52xx_wkup_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) { struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); - struct mpc52xx_gpiochip *chip = container_of(mm_gc, - struct mpc52xx_gpiochip, mmchip); + struct mpc52xx_gpiochip *chip = gpiochip_get_data(gc); struct mpc52xx_gpio_wkup __iomem *regs = mm_gc->regs; if (val) @@ -100,8 +99,7 @@ mpc52xx_wkup_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) static int mpc52xx_wkup_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio) { struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); - struct mpc52xx_gpiochip *chip = container_of(mm_gc, - struct mpc52xx_gpiochip, mmchip); + struct mpc52xx_gpiochip *chip = gpiochip_get_data(gc); struct mpc52xx_gpio_wkup __iomem *regs = mm_gc->regs; unsigned long flags; @@ -125,8 +123,7 @@ mpc52xx_wkup_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) { struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); struct mpc52xx_gpio_wkup __iomem *regs = mm_gc->regs; - struct mpc52xx_gpiochip *chip = container_of(mm_gc, - struct mpc52xx_gpiochip, mmchip); + struct mpc52xx_gpiochip *chip = gpiochip_get_data(gc); unsigned long flags; spin_lock_irqsave(&gpio_lock, flags); @@ -169,7 +166,7 @@ static int mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev) gc->get = mpc52xx_wkup_gpio_get; gc->set = mpc52xx_wkup_gpio_set; - ret = of_mm_gpiochip_add(ofdev->dev.of_node, &chip->mmchip); + ret = of_mm_gpiochip_add_data(ofdev->dev.of_node, &chip->mmchip, chip); if (ret) return ret; @@ -236,8 +233,7 @@ static inline void __mpc52xx_simple_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) { struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); - struct mpc52xx_gpiochip *chip = container_of(mm_gc, - struct mpc52xx_gpiochip, mmchip); + struct mpc52xx_gpiochip *chip = gpiochip_get_data(gc); struct mpc52xx_gpio __iomem *regs = mm_gc->regs; if (val) @@ -264,8 +260,7 @@ mpc52xx_simple_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) static int mpc52xx_simple_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio) { struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); - struct mpc52xx_gpiochip *chip = container_of(mm_gc, - struct mpc52xx_gpiochip, mmchip); + struct mpc52xx_gpiochip *chip = gpiochip_get_data(gc); struct mpc52xx_gpio __iomem *regs = mm_gc->regs; unsigned long flags; @@ -288,8 +283,7 @@ static int mpc52xx_simple_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) { struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); - struct mpc52xx_gpiochip *chip = container_of(mm_gc, - struct mpc52xx_gpiochip, mmchip); + struct mpc52xx_gpiochip *chip = gpiochip_get_data(gc); struct mpc52xx_gpio __iomem *regs = mm_gc->regs; unsigned long flags; @@ -334,7 +328,7 @@ static int mpc52xx_simple_gpiochip_probe(struct platform_device *ofdev) gc->get = mpc52xx_simple_gpio_get; gc->set = mpc52xx_simple_gpio_set; - ret = of_mm_gpiochip_add(ofdev->dev.of_node, &chip->mmchip); + ret = of_mm_gpiochip_add_data(ofdev->dev.of_node, &chip->mmchip, chip); if (ret) return ret;