From patchwork Wed Dec 9 13:36:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58085 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp672925lbb; Wed, 9 Dec 2015 05:36:08 -0800 (PST) X-Received: by 10.66.102.97 with SMTP id fn1mr8019325pab.131.1449668168856; Wed, 09 Dec 2015 05:36:08 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 70si12762016pfa.200.2015.12.09.05.36.08; Wed, 09 Dec 2015 05:36:08 -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 S1754575AbbLINgI (ORCPT + 4 others); Wed, 9 Dec 2015 08:36:08 -0500 Received: from mail-lb0-f171.google.com ([209.85.217.171]:35967 "EHLO mail-lb0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754569AbbLINgH (ORCPT ); Wed, 9 Dec 2015 08:36:07 -0500 Received: by lbblt2 with SMTP id lt2so30213286lbb.3 for ; Wed, 09 Dec 2015 05:36:06 -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=3wvhZFNBO7fnM8crG+kjMN/eSWisJPBTetHpFTk5Dy0=; b=H5unFtj3raAsWPqGnWF26BQkUF026ZxzjEy2mw/xij6LunvmTqAxkTSHlchSYueRGU w7VcltUzAOLZudzxMhLIAHvy0ufj9pQP6Mem7eOPrxquxIHO44voc3F2Bxu1Nhp0mfzI dmBuaQ9WS+fwrnZJYWcNtI+3lnAgQI0BYxkTnI7NcMr59NU+JdbycB9kE+2Gg7pqWQ0z qP/OtTl1nZwpxO/ITE61s+VHD7JhKuhpbUJaDEBbwW5ZRQCwMnVXi24xPlS3P5C9GM37 sjUt0KdyYwNvqi1aDANW83C2pXPkgQzFenExwGDJjMsm4xiQ9iJsEpSyMvlsxm7LCg2c peUA== 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=3wvhZFNBO7fnM8crG+kjMN/eSWisJPBTetHpFTk5Dy0=; b=QnGgJ0EkaJxvJrO3rDP6ZyY4gWdSu0NtESy98Z2EvI0b92q6HzBaY2sCnxph7nLtsK 6FHE/YvqOOcuBYDYMOvHJ7d7N5+DT7XCs9JJOsxw6rrOVUQcDekLLXAm38YnFh6fzMdY rH3DVfzq/QNyfPaEliFZjmGrIhOY3uazNVr05CvcTrrrOKTnm4Gp4vHZizShqEvgowq3 WlExnpihea8X4n3zk9m+rGdAKE9i88BUEqQFrupsi/6fbSf5yCrC3eC9GPVhw+A6Qo1v i66EfpRF1ivL0O2C3GddvBqcBo3ZgpNOroOT/UmGa2C+nhje062CLMu/1IVMCnZF+hl/ ElVA== X-Gm-Message-State: ALoCoQlgP3a973iI3Lk+BtYEpnQ2OHOlp+vipf229XAsvsxumMv6OOzMXamxQYC8Jk+1xXQg1n4haQlMD1/570C4k6ICOrwPOg== X-Received: by 10.112.180.131 with SMTP id do3mr2330847lbc.123.1449668165959; Wed, 09 Dec 2015 05:36:05 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id s7sm1429623lbo.30.2015.12.09.05.36.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:36:05 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann , arm@kernel.org Cc: Linus Walleij Subject: [PATCH 129/182] ARM: w90x900: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:36:02 +0100 Message-Id: <1449668162-3967-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: arm@kernel.org Signed-off-by: Linus Walleij --- ARM SoC people: please ACK this so I can take it with the rest of the refactoring through the GPIO tree. --- arch/arm/mach-w90x900/gpio.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 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/arch/arm/mach-w90x900/gpio.c b/arch/arm/mach-w90x900/gpio.c index ba05aec7ea4b..55d1a00dbd28 100644 --- a/arch/arm/mach-w90x900/gpio.c +++ b/arch/arm/mach-w90x900/gpio.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include @@ -30,7 +30,6 @@ #define GPIO_IN (0x0C) #define GROUPINERV (0x10) #define GPIO_GPIO(Nb) (0x00000001 << (Nb)) -#define to_nuc900_gpio_chip(c) container_of(c, struct nuc900_gpio_chip, chip) #define NUC900_GPIO_CHIP(name, base_gpio, nr_gpio) \ { \ @@ -53,7 +52,7 @@ struct nuc900_gpio_chip { static int nuc900_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct nuc900_gpio_chip *nuc900_gpio = to_nuc900_gpio_chip(chip); + struct nuc900_gpio_chip *nuc900_gpio = gpiochip_get_data(chip); void __iomem *pio = nuc900_gpio->regbase + GPIO_IN; unsigned int regval; @@ -65,7 +64,7 @@ static int nuc900_gpio_get(struct gpio_chip *chip, unsigned offset) static void nuc900_gpio_set(struct gpio_chip *chip, unsigned offset, int val) { - struct nuc900_gpio_chip *nuc900_gpio = to_nuc900_gpio_chip(chip); + struct nuc900_gpio_chip *nuc900_gpio = gpiochip_get_data(chip); void __iomem *pio = nuc900_gpio->regbase + GPIO_OUT; unsigned int regval; unsigned long flags; @@ -86,7 +85,7 @@ static void nuc900_gpio_set(struct gpio_chip *chip, unsigned offset, int val) static int nuc900_dir_input(struct gpio_chip *chip, unsigned offset) { - struct nuc900_gpio_chip *nuc900_gpio = to_nuc900_gpio_chip(chip); + struct nuc900_gpio_chip *nuc900_gpio = gpiochip_get_data(chip); void __iomem *pio = nuc900_gpio->regbase + GPIO_DIR; unsigned int regval; unsigned long flags; @@ -104,7 +103,7 @@ static int nuc900_dir_input(struct gpio_chip *chip, unsigned offset) static int nuc900_dir_output(struct gpio_chip *chip, unsigned offset, int val) { - struct nuc900_gpio_chip *nuc900_gpio = to_nuc900_gpio_chip(chip); + struct nuc900_gpio_chip *nuc900_gpio = gpiochip_get_data(chip); void __iomem *outreg = nuc900_gpio->regbase + GPIO_OUT; void __iomem *pio = nuc900_gpio->regbase + GPIO_DIR; unsigned int regval; @@ -149,6 +148,6 @@ void __init nuc900_init_gpio(int nr_group) gpio_chip = &nuc900_gpio[i]; spin_lock_init(&gpio_chip->gpio_lock); gpio_chip->regbase = GPIO_BASE + i * GROUPINERV; - gpiochip_add(&gpio_chip->chip); + gpiochip_add_data(&gpio_chip->chip, gpio_chip); } }