From patchwork Wed Dec 9 13:47: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: 58121 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp679477lbb; Wed, 9 Dec 2015 05:47:59 -0800 (PST) X-Received: by 10.66.55.6 with SMTP id n6mr7964585pap.33.1449668879203; Wed, 09 Dec 2015 05:47:59 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s90si12866349pfi.45.2015.12.09.05.47.58; Wed, 09 Dec 2015 05:47: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 S1754569AbbLINr6 (ORCPT + 4 others); Wed, 9 Dec 2015 08:47:58 -0500 Received: from mail-lf0-f41.google.com ([209.85.215.41]:35955 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753083AbbLINr5 (ORCPT ); Wed, 9 Dec 2015 08:47:57 -0500 Received: by lfs39 with SMTP id 39so34754589lfs.3 for ; Wed, 09 Dec 2015 05:47: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=BCkZWNFRfaigWtgcauRzayChZM7hTepM6z7J16y+WyY=; b=azEt6Wjg0yUq9RZeoAVih9KprgYgX2kRBzk2WsnSo8v05hgh/Pw81uDl3TmZVUm/aE DDfAIkxE1+yWVbFVTiLtcpZh4vct1UeVVUEjbqczdZWcblNs5lKsMWjkPzlMCi5ihn70 9iaFpziJ4ULS/f7bNxlsCfXDaMdWfvyiPqx+IkopsFHrNt708hzi6e3SKUCGaHOkGn7/ 14+cZGtIVgglWk78xrDB20zAHkMSeCxSQ91Lmp9jEAhjE5ViMGgqo6LI2I4Uw2YgVcIW wQlw25UDq11vvQcFtIWCAsqKAWZFKorlLhaWtwebB8I9tsKsyeihB8kzXubMe8HNYGN/ 5gaw== 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=BCkZWNFRfaigWtgcauRzayChZM7hTepM6z7J16y+WyY=; b=eIGcKwAVI4vzObykpgTAIVehd2KpOxLJv8UbmEyADB4amThGb+L7pHGCb22dIab+Wn brVAwJHbq0KmgTxnWhoeO2+Wa3NFAnbiPbAnhsTQ9BJjo4VMvbPE0+aa+OlCPdjUVoAZ wUPrsAyNw2eMX+5YAp8geYofLPfA5GqZG6UHEu2E6p3N5Dz9rX8EtSAYk8pd0Y/J83wl FPA+aGLljwLgYOHrfUS1NnG6iZxgZ+C5YzQDqLAwG/d+YQ15QEAaH9s4PwU52M8akznJ XPe/2ommkwfgAkFsSeQPfJIb3BIsgUbf4af4VO+zb0pbv5MJLwQzFn8u1gQgQw9MRla3 q/Rg== X-Gm-Message-State: ALoCoQnscoWHFB70hB40rA3z+N0yO7ag9K+XpvNgHzcArwsa5ZCULCEGCZGW+LHn6y2kppUO0hYWp/zfH1/GfPEgOoV44N3D9g== X-Received: by 10.25.147.209 with SMTP id v200mr2305665lfd.102.1449668876516; Wed, 09 Dec 2015 05:47:56 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id k189sm1422708lfd.12.2015.12.09.05.47.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:47:55 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann , Lee Jones Cc: Linus Walleij , Ben Dooks Subject: [PATCH 165/182] mfd: sm501: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:47:53 +0100 Message-Id: <1449668873-6354-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: Lee Jones Cc: Ben Dooks Signed-off-by: Linus Walleij --- Lee please ACK this so I can take it through the GPIO tree. --- drivers/mfd/sm501.c | 15 +++++---------- 1 file changed, 5 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: Lee Jones diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index c646784c5a7d..65cd0d2a822a 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -879,11 +879,6 @@ static int sm501_register_display(struct sm501_devdata *sm, #ifdef CONFIG_MFD_SM501_GPIO -static inline struct sm501_gpio_chip *to_sm501_gpio(struct gpio_chip *gc) -{ - return container_of(gc, struct sm501_gpio_chip, gpio); -} - static inline struct sm501_devdata *sm501_gpio_to_dev(struct sm501_gpio *gpio) { return container_of(gpio, struct sm501_devdata, gpio); @@ -892,7 +887,7 @@ static inline struct sm501_devdata *sm501_gpio_to_dev(struct sm501_gpio *gpio) static int sm501_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct sm501_gpio_chip *smgpio = to_sm501_gpio(chip); + struct sm501_gpio_chip *smgpio = gpiochip_get_data(chip); unsigned long result; result = smc501_readl(smgpio->regbase + SM501_GPIO_DATA_LOW); @@ -923,7 +918,7 @@ static void sm501_gpio_ensure_gpio(struct sm501_gpio_chip *smchip, static void sm501_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct sm501_gpio_chip *smchip = to_sm501_gpio(chip); + struct sm501_gpio_chip *smchip = gpiochip_get_data(chip); struct sm501_gpio *smgpio = smchip->ourgpio; unsigned long bit = 1 << offset; void __iomem *regs = smchip->regbase; @@ -948,7 +943,7 @@ static void sm501_gpio_set(struct gpio_chip *chip, unsigned offset, int value) static int sm501_gpio_input(struct gpio_chip *chip, unsigned offset) { - struct sm501_gpio_chip *smchip = to_sm501_gpio(chip); + struct sm501_gpio_chip *smchip = gpiochip_get_data(chip); struct sm501_gpio *smgpio = smchip->ourgpio; void __iomem *regs = smchip->regbase; unsigned long bit = 1 << offset; @@ -974,7 +969,7 @@ static int sm501_gpio_input(struct gpio_chip *chip, unsigned offset) static int sm501_gpio_output(struct gpio_chip *chip, unsigned offset, int value) { - struct sm501_gpio_chip *smchip = to_sm501_gpio(chip); + struct sm501_gpio_chip *smchip = gpiochip_get_data(chip); struct sm501_gpio *smgpio = smchip->ourgpio; unsigned long bit = 1 << offset; void __iomem *regs = smchip->regbase; @@ -1039,7 +1034,7 @@ static int sm501_gpio_register_chip(struct sm501_devdata *sm, gchip->base = base; chip->ourgpio = gpio; - return gpiochip_add(gchip); + return gpiochip_add_data(gchip, chip); } static int sm501_register_gpio(struct sm501_devdata *sm)