From patchwork Wed Dec 9 13:36: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: 58087 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp673403lbb; Wed, 9 Dec 2015 05:37:00 -0800 (PST) X-Received: by 10.98.8.136 with SMTP id 8mr13103307pfi.16.1449668220572; Wed, 09 Dec 2015 05:37:00 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v76si12798886pfa.183.2015.12.09.05.37.00; Wed, 09 Dec 2015 05:37:00 -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 S1754573AbbLINhA (ORCPT + 4 others); Wed, 9 Dec 2015 08:37:00 -0500 Received: from mail-lb0-f177.google.com ([209.85.217.177]:35564 "EHLO mail-lb0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754496AbbLINg7 (ORCPT ); Wed, 9 Dec 2015 08:36:59 -0500 Received: by lbpu9 with SMTP id u9so29907040lbp.2 for ; Wed, 09 Dec 2015 05:36:58 -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=fqL1ghntQVHHP7LyFbrD/OkyHrtIoI4LqLSggmUEGsc=; b=rexWm8uCFhPgxLkRV49+APYrAOiCQGi3LLOKdcPZ/Wd7GG08DlIfqH9XuwKOZluuew TS7NNCeUC88LIVOQZ7zakv2McZGQVHxzOPaOkuIuE4PJe0Dk4s0KK3YCemAwaa1qhbPE LjDNFNHV2wvqUjvbRJxewz2nhPULX5GK9uPHhYXALd3E3/BO9plKxZBK0XelTGNIaG7U Syg/GOssjpfw4DhnxlEMDh/iUACA/TN86k9r3BHwSB6W30+46LrpsNHY4aIoiQ8+G4Jq AjfIg3BaeT6+2gq/DndOE9XzJku+d3qQFPrRFJcSKuIbRtzD8Bdax0ePbPQQqeCNuD0F OU7w== 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=fqL1ghntQVHHP7LyFbrD/OkyHrtIoI4LqLSggmUEGsc=; b=jIDewaBDozOlIXmzSJDmDFVU9wz/OxGG470SNl8sXtKuDj8x+wjfxFgrIbEoEPLDZR OaVHZ4TNQdexYsyI3IHbBGOG8nyUFg6PAOZ7h7r+tHEQWkZf38i+2sflt0ynlAsF6qUy oK6ZSgnIptmKSRxneNRZiMjF2/hmNqDLtl/p/83weHeU4u6WuZSyEt4qVzlFNd9KLLub Qhe13M6UVVJJlfmM94Bd3+x3O6zswHKSy4eq/6eB6s70WooBajhWddFZWmJdbEuT/423 /ylZKQONl89ChgsOFHPg5xrgQsinQ09pKbjuWWMyubAq8FchG7A64LGeIsLPHeStM+bR QRCQ== X-Gm-Message-State: ALoCoQkmutyU+Liw5FV0ylMbkhRPiDMz6OliA+hd7mrbCs6ix0L6QXOX40IqDmaGFRE/2yrTzZpM493JZ2DeKsTh9dnYDscg6w== X-Received: by 10.112.219.197 with SMTP id pq5mr2103750lbc.73.1449668218058; Wed, 09 Dec 2015 05:36:58 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id d203sm1437837lfg.39.2015.12.09.05.36.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:36:57 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann , Haavard Skinnemoen , Hans-Christian Egtvedt Cc: Linus Walleij Subject: [PATCH 131/182] avr32: gpio: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:36:53 +0100 Message-Id: <1449668213-4111-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: Haavard Skinnemoen Cc: Hans-Christian Egtvedt Signed-off-by: Linus Walleij --- AVR32 folks: please ACK this patch so I can take it through the GPIO tree. BTW: consider tidying up and moving this driver to drivers/pinctrl and implement the right pin control interfaces for AVR32 ... thanks. --- arch/avr32/mach-at32ap/pio.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 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/avr32/mach-at32ap/pio.c b/arch/avr32/mach-at32ap/pio.c index aa74491771fa..5020057ac7a2 100644 --- a/arch/avr32/mach-at32ap/pio.c +++ b/arch/avr32/mach-at32ap/pio.c @@ -203,7 +203,7 @@ fail: static int direction_input(struct gpio_chip *chip, unsigned offset) { - struct pio_device *pio = container_of(chip, struct pio_device, chip); + struct pio_device *pio = gpiochip_get_data(chip); u32 mask = 1 << offset; if (!(pio_readl(pio, PSR) & mask)) @@ -215,7 +215,7 @@ static int direction_input(struct gpio_chip *chip, unsigned offset) static int gpio_get(struct gpio_chip *chip, unsigned offset) { - struct pio_device *pio = container_of(chip, struct pio_device, chip); + struct pio_device *pio = gpiochip_get_data(chip); return (pio_readl(pio, PDSR) >> offset) & 1; } @@ -224,7 +224,7 @@ static void gpio_set(struct gpio_chip *chip, unsigned offset, int value); static int direction_output(struct gpio_chip *chip, unsigned offset, int value) { - struct pio_device *pio = container_of(chip, struct pio_device, chip); + struct pio_device *pio = gpiochip_get_data(chip); u32 mask = 1 << offset; if (!(pio_readl(pio, PSR) & mask)) @@ -237,7 +237,7 @@ static int direction_output(struct gpio_chip *chip, unsigned offset, int value) static void gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct pio_device *pio = container_of(chip, struct pio_device, chip); + struct pio_device *pio = gpiochip_get_data(chip); u32 mask = 1 << offset; if (value) @@ -335,7 +335,7 @@ gpio_irq_setup(struct pio_device *pio, int irq, int gpio_irq) */ static void pio_bank_show(struct seq_file *s, struct gpio_chip *chip) { - struct pio_device *pio = container_of(chip, struct pio_device, chip); + struct pio_device *pio = gpiochip_get_data(chip); u32 psr, osr, imr, pdsr, pusr, ifsr, mdsr; unsigned i; u32 mask; @@ -406,7 +406,7 @@ static int __init pio_probe(struct platform_device *pdev) pio->chip.set = gpio_set; pio->chip.dbg_show = pio_bank_show; - gpiochip_add(&pio->chip); + gpiochip_add_data(&pio->chip, pio); gpio_irq_setup(pio, irq, gpio_irq_base);