From patchwork Wed Dec 9 13:36:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58086 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp673027lbb; Wed, 9 Dec 2015 05:36:20 -0800 (PST) X-Received: by 10.66.254.161 with SMTP id aj1mr7996779pad.31.1449668179135; Wed, 09 Dec 2015 05:36:19 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b8si12770439pas.185.2015.12.09.05.36.18; Wed, 09 Dec 2015 05:36:19 -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 S1754326AbbLINgR (ORCPT + 4 others); Wed, 9 Dec 2015 08:36:17 -0500 Received: from mail-lf0-f43.google.com ([209.85.215.43]:33974 "EHLO mail-lf0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754630AbbLINgP (ORCPT ); Wed, 9 Dec 2015 08:36:15 -0500 Received: by lffu14 with SMTP id u14so34390635lff.1 for ; Wed, 09 Dec 2015 05:36:14 -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=9DGVt541NnnXZJq0qzhYWGEAlSDOkgTgsOY6KcYnq2g=; b=fG2l6DhmJnAV83wBt6oGZ6vINtbwJKLN6m9YFRcefxkWNe2wdbWEspDC0lriagkyeO 06nxaTPs4i9v3g5Ah8AdwiItgK8f/XvEFapVs2wDQQe+VfS5/JnLRPrc7uIgrE1UMJKk 5yfo/D2aMDWLOmeZWAYLWNV+hKkr9Z+T6g0gnUMZpq87SwR/D1MMlSxlXbFZlaTSu9DU JoPY2SI2n+tbNxB1t02EIkiRPO3+dEZM+Biy9gbjonts8yXNT4ecb3Lw6BJWT2UMHyv6 zEAVpies2s8IlTpYmlMGKCsp+c/O84WVrHm8b0WvJcz5qyl5ySIwh53BYIACAxD7zda6 hdig== 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=9DGVt541NnnXZJq0qzhYWGEAlSDOkgTgsOY6KcYnq2g=; b=B1a+swysOq6+iJrCIMZSQG5mgq76to8pwrHSh8CasTO0L0aLvmryFpNjPtQAPn8p8Z X/QiVEEFQ/QAmgEZ74DZZigtF1ijLf5jarrQDigNcRYtymmkEv6ltQRrRz0i1lsQIj6W Hk+DO2GFqwBlEPayMhdIlIf1gBbHB4OwH/dXSSECcsxdWi2snjZzqkOI0luOC3jXxz3E Pmrptv4bGHTR0PYa5zJ8mi3INSth/Iv9nOpvk73nEoqIl36HzOdRUeA6GupQJvgPBerf DELqjgPYzECIzUP7SMKsKb+6vzgp9y6v1CFh1YDuhmAgJlIBCZovHxQ/0lm9kKLz8uUj N1yg== X-Gm-Message-State: ALoCoQmQvoXqqMxgVpS1FKhTMBpIUKZlVdjxq9FKZXSg++Xf3rZiHLVam2Pz6Q7HrdqchMXyrTFg8ThQmhniiay3ADR49tdXXw== X-Received: by 10.25.4.208 with SMTP id 199mr2225505lfe.96.1449668174307; Wed, 09 Dec 2015 05:36:14 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id aa4sm1431205lbc.10.2015.12.09.05.36.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:36:13 -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 130/182] ARM: plat-orion: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:36:11 +0100 Message-Id: <1449668171-4014-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/plat-orion/gpio.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 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/plat-orion/gpio.c b/arch/arm/plat-orion/gpio.c index 7bd22d8e5b11..f74069386c13 100644 --- a/arch/arm/plat-orion/gpio.c +++ b/arch/arm/plat-orion/gpio.c @@ -154,8 +154,7 @@ err_out: */ static int orion_gpio_request(struct gpio_chip *chip, unsigned pin) { - struct orion_gpio_chip *ochip = - container_of(chip, struct orion_gpio_chip, chip); + struct orion_gpio_chip *ochip = gpiochip_get_data(chip); if (orion_gpio_is_valid(ochip, pin, GPIO_INPUT_OK) || orion_gpio_is_valid(ochip, pin, GPIO_OUTPUT_OK)) @@ -166,8 +165,7 @@ static int orion_gpio_request(struct gpio_chip *chip, unsigned pin) static int orion_gpio_direction_input(struct gpio_chip *chip, unsigned pin) { - struct orion_gpio_chip *ochip = - container_of(chip, struct orion_gpio_chip, chip); + struct orion_gpio_chip *ochip = gpiochip_get_data(chip); unsigned long flags; if (!orion_gpio_is_valid(ochip, pin, GPIO_INPUT_OK)) @@ -182,8 +180,7 @@ static int orion_gpio_direction_input(struct gpio_chip *chip, unsigned pin) static int orion_gpio_get(struct gpio_chip *chip, unsigned pin) { - struct orion_gpio_chip *ochip = - container_of(chip, struct orion_gpio_chip, chip); + struct orion_gpio_chip *ochip = gpiochip_get_data(chip); int val; if (readl(GPIO_IO_CONF(ochip)) & (1 << pin)) { @@ -198,8 +195,7 @@ static int orion_gpio_get(struct gpio_chip *chip, unsigned pin) static int orion_gpio_direction_output(struct gpio_chip *chip, unsigned pin, int value) { - struct orion_gpio_chip *ochip = - container_of(chip, struct orion_gpio_chip, chip); + struct orion_gpio_chip *ochip = gpiochip_get_data(chip); unsigned long flags; if (!orion_gpio_is_valid(ochip, pin, GPIO_OUTPUT_OK)) @@ -216,8 +212,7 @@ orion_gpio_direction_output(struct gpio_chip *chip, unsigned pin, int value) static void orion_gpio_set(struct gpio_chip *chip, unsigned pin, int value) { - struct orion_gpio_chip *ochip = - container_of(chip, struct orion_gpio_chip, chip); + struct orion_gpio_chip *ochip = gpiochip_get_data(chip); unsigned long flags; spin_lock_irqsave(&ochip->lock, flags); @@ -227,8 +222,7 @@ static void orion_gpio_set(struct gpio_chip *chip, unsigned pin, int value) static int orion_gpio_to_irq(struct gpio_chip *chip, unsigned pin) { - struct orion_gpio_chip *ochip = - container_of(chip, struct orion_gpio_chip, chip); + struct orion_gpio_chip *ochip = gpiochip_get_data(chip); return irq_create_mapping(ochip->domain, ochip->secondary_irq_base + pin); @@ -445,8 +439,8 @@ static void gpio_irq_handler(struct irq_desc *desc) static void orion_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) { - struct orion_gpio_chip *ochip = - container_of(chip, struct orion_gpio_chip, chip); + + struct orion_gpio_chip *ochip = gpiochip_get_data(chip); u32 out, io_conf, blink, in_pol, data_in, cause, edg_msk, lvl_msk; int i; @@ -567,7 +561,7 @@ void __init orion_gpio_init(struct device_node *np, ochip->mask_offset = mask_offset; ochip->secondary_irq_base = secondary_irq_base; - gpiochip_add(&ochip->chip); + gpiochip_add_data(&ochip->chip, ochip); /* * Mask and clear GPIO interrupts.