From patchwork Wed Dec 9 13:15:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57977 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp660992lbb; Wed, 9 Dec 2015 05:15:48 -0800 (PST) X-Received: by 10.66.248.106 with SMTP id yl10mr7750376pac.140.1449666948345; Wed, 09 Dec 2015 05:15:48 -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.15.48; Wed, 09 Dec 2015 05:15:48 -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 S1753923AbbLINPr (ORCPT + 4 others); Wed, 9 Dec 2015 08:15:47 -0500 Received: from mail-lb0-f182.google.com ([209.85.217.182]:33497 "EHLO mail-lb0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751617AbbLINPr (ORCPT ); Wed, 9 Dec 2015 08:15:47 -0500 Received: by lbbkw15 with SMTP id kw15so29760549lbb.0 for ; Wed, 09 Dec 2015 05:15:45 -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=z6AYCGavoMsv6NiN8HxW7CSxiDul3cxtGG9WAo7afR4=; b=vkpIz60gU9rIbM9NYV8MrdKlUhrD3JVUrEltVxaEdcdpWFnj38y3maYKJC/qjXP2aC 1p0pOJlvw0cUWi2QgdbpEGi/hz+BNSLH06mtN+bX2Vmmcwc98qJkVKx7z3LivsZ/urw+ owaJSTZu/VsEhxD5oZS3IASX9vSnqffTpYiK2YLVwNmk3ThPME1Js9A9sPr1URtRpPAh uVgl8zHCGY0bACEjZ2HaD+OHCCeieRJTXpokxtXp3u+htchgHq2IFBRBPECBcvEyR1p4 PrLZOaB8lqVCCUBM3oHCEtbnxeRRBh2lhhradNdD5guiNUvF6CMj2++Dzv079G/tpbmP yOwQ== 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=z6AYCGavoMsv6NiN8HxW7CSxiDul3cxtGG9WAo7afR4=; b=TTsaejbkYfcF3HU6JruiX8JH6I+tZG41Rw0SJyltcX5zzCyG7Y48awyfucOrkCv3ec SbP2k7oQvCsHMAclnCbjqhOiusc1d/KxF9dbQq2aGRfZ4ExIJGKcInppcGbKQw4gae5I 8LmRtfcSmGzFAf+XihhGRmMBvhl+ZncvTQ7kiUTdYqPoeacqujDccchudPkojlox70BN TzGqwteyiZrjqUPJ5RexCmnxhEiUuzeAeyjE5tt2q+iSrA1Lm5Wgm3e4O5mmiP9cS17a lRpZABXGTBFLAvyI3vot4XECK8vjMPvaHvKE9C7Qc3q0HAgclntycQ5BAJEUqPINYAUK lnAw== X-Gm-Message-State: ALoCoQlxgXJZkmAa4No7bbCQrkt7w6W9MWOL6GmDhit2s8gjLEPOQnTVXvfu6XSRT7WfSLFT+XAOMZMxQu8NTs/sTx+noFBFhg== X-Received: by 10.112.204.168 with SMTP id kz8mr1949128lbc.32.1449666945573; Wed, 09 Dec 2015 05:15:45 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id j83sm1423627lfi.47.2015.12.09.05.15.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:15:44 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Grygorii Strashko , Sekhar Nori , Santosh Shilimkar Subject: [PATCH 022/182] gpio: davinci: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:15:42 +0100 Message-Id: <1449666942-30784-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: Grygorii Strashko Cc: Sekhar Nori Cc: Santosh Shilimkar Signed-off-by: Linus Walleij --- drivers/gpio/gpio-davinci.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 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-davinci.c b/drivers/gpio/gpio-davinci.c index 65ebaef935e1..84c3f777394f 100644 --- a/drivers/gpio/gpio-davinci.c +++ b/drivers/gpio/gpio-davinci.c @@ -41,9 +41,6 @@ typedef struct irq_chip *(*gpio_get_irq_chip_cb_t)(unsigned int irq); #define BINTEN 0x8 /* GPIO Interrupt Per-Bank Enable Register */ -#define chip2controller(chip) \ - container_of(chip, struct davinci_gpio_controller, chip) - static void __iomem *gpio_base; static struct davinci_gpio_regs __iomem *gpio2regs(unsigned gpio) @@ -82,7 +79,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev); static inline int __davinci_direction(struct gpio_chip *chip, unsigned offset, bool out, int value) { - struct davinci_gpio_controller *d = chip2controller(chip); + struct davinci_gpio_controller *d = gpiochip_get_data(chip); struct davinci_gpio_regs __iomem *g = d->regs; unsigned long flags; u32 temp; @@ -122,7 +119,7 @@ davinci_direction_out(struct gpio_chip *chip, unsigned offset, int value) */ static int davinci_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct davinci_gpio_controller *d = chip2controller(chip); + struct davinci_gpio_controller *d = gpiochip_get_data(chip); struct davinci_gpio_regs __iomem *g = d->regs; return (1 << offset) & readl_relaxed(&g->in_data); @@ -134,7 +131,7 @@ static int davinci_gpio_get(struct gpio_chip *chip, unsigned offset) static void davinci_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct davinci_gpio_controller *d = chip2controller(chip); + struct davinci_gpio_controller *d = gpiochip_get_data(chip); struct davinci_gpio_regs __iomem *g = d->regs; writel_relaxed((1 << offset), value ? &g->set_data : &g->clr_data); @@ -265,7 +262,7 @@ static int davinci_gpio_probe(struct platform_device *pdev) chips[i].clr_data = ®s->clr_data; chips[i].in_data = ®s->in_data; - gpiochip_add(&chips[i].chip); + gpiochip_add_data(&chips[i].chip, &chips[i]); } platform_set_drvdata(pdev, chips); @@ -368,7 +365,7 @@ static void gpio_irq_handler(struct irq_desc *desc) static int gpio_to_irq_banked(struct gpio_chip *chip, unsigned offset) { - struct davinci_gpio_controller *d = chip2controller(chip); + struct davinci_gpio_controller *d = gpiochip_get_data(chip); if (d->irq_domain) return irq_create_mapping(d->irq_domain, d->chip.base + offset); @@ -378,7 +375,7 @@ static int gpio_to_irq_banked(struct gpio_chip *chip, unsigned offset) static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset) { - struct davinci_gpio_controller *d = chip2controller(chip); + struct davinci_gpio_controller *d = gpiochip_get_data(chip); /* * NOTE: we assume for now that only irqs in the first gpio_chip