From patchwork Wed Dec 9 13:27:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58032 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp667799lbb; Wed, 9 Dec 2015 05:27:29 -0800 (PST) X-Received: by 10.67.22.99 with SMTP id hr3mr7852883pad.10.1449667649162; Wed, 09 Dec 2015 05:27:29 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ny6si12718088pab.215.2015.12.09.05.27.28; Wed, 09 Dec 2015 05:27:29 -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 S1754160AbbLIN12 (ORCPT + 4 others); Wed, 9 Dec 2015 08:27:28 -0500 Received: from mail-lf0-f53.google.com ([209.85.215.53]:34291 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753754AbbLIN11 (ORCPT ); Wed, 9 Dec 2015 08:27:27 -0500 Received: by lffu14 with SMTP id u14so34217811lff.1 for ; Wed, 09 Dec 2015 05:27:26 -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=M11J18/uANLvIu/GdQUmKpL0LdlvcGhXkNmkHTuuJIo=; b=HXi1bBNwwNXsx1h8Z0+NhfQIezSw+WpYVHS/YEr7B2whwhFlwuhDWcCCk+vPJ04t7u wfqsc+8rDyxxcz/pglX5N4i5Q7KgKJ7TyRElFpftsvwgTJaxCKa+yAG84PibvOCSQDkT mNlBCSKLYpx6KgPVZPXGdBEdpHTmet2nkzVP1AQGord6oTKVbSj/ypA0lpsZFjUn9+D3 ONtUJoswZ1V/cOtZLMz+79t0e5oPs4o3XyNOZriWJJL2T6jJ9dz7DHRUVST8/6jFttNJ /cw3PpidVz1yL7birNl/L4QkK52wR5dZOddO5kaDcxj/+Njv/6XhtP6MYp8+gxzYtXHM 5INA== 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=M11J18/uANLvIu/GdQUmKpL0LdlvcGhXkNmkHTuuJIo=; b=UTiJzIXitspFrIgmsy33DgPBUB92dcqaPdsEuHVEh+fgtw7y479t8LHC8QN+m0e3a/ +5+I4aQlTRyMJPRl3wO3Rjn/JiM7JBYtdsR3q4fdS99k54vF/KcSBoZvkHRnAmV9nPYA GKAB4AVR6TNGzKA20bALhjioryjbFTyUv18Nf5vjr4xEAddJOjmn0BmoOSHwZSm+hgp0 w6GUKWd1rXWp0FY9j2gpJDxHzEum7g34nV+uzXdorvJFEj2nzQ9ia9K8dfPDDXFkDraH sa/uys++KPDWdwVYlmorcHkPy3bw9qqotoi0iDfCYUIq6peneTYLEhFdyeWQwQ4mffmu GrOA== X-Gm-Message-State: ALoCoQm0FzXAaNb1ipaGF81Bds23u0m9JiMqK+kUCcDcuZMUdIlC0gl0Oy7JbxuGVP+6+47VDWow8WBS6jbEoeZK7PxFGa7FSQ== X-Received: by 10.25.81.17 with SMTP id f17mr1810224lfb.90.1449667646020; Wed, 09 Dec 2015 05:27:26 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id nq2sm1416931lbb.33.2015.12.09.05.27.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:27:25 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Stefan Agner Subject: [PATCH 076/182] gpio: vf610: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:27:22 +0100 Message-Id: <1449667642-1015-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: Stefan Agner Signed-off-by: Linus Walleij --- drivers/gpio/gpio-vf610.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 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-vf610.c b/drivers/gpio/gpio-vf610.c index 9031e60c815c..6284bdbe1e0c 100644 --- a/drivers/gpio/gpio-vf610.c +++ b/drivers/gpio/gpio-vf610.c @@ -62,11 +62,6 @@ struct vf610_gpio_port { static struct irq_chip vf610_gpio_irq_chip; -static struct vf610_gpio_port *to_vf610_gp(struct gpio_chip *gc) -{ - return container_of(gc, struct vf610_gpio_port, gc); -} - static const struct of_device_id vf610_gpio_dt_ids[] = { { .compatible = "fsl,vf610-gpio" }, { /* sentinel */ } @@ -84,14 +79,14 @@ static inline u32 vf610_gpio_readl(void __iomem *reg) static int vf610_gpio_get(struct gpio_chip *gc, unsigned int gpio) { - struct vf610_gpio_port *port = to_vf610_gp(gc); + struct vf610_gpio_port *port = gpiochip_get_data(gc); return !!(vf610_gpio_readl(port->gpio_base + GPIO_PDIR) & BIT(gpio)); } static void vf610_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) { - struct vf610_gpio_port *port = to_vf610_gp(gc); + struct vf610_gpio_port *port = gpiochip_get_data(gc); unsigned long mask = BIT(gpio); if (val) @@ -116,7 +111,7 @@ static int vf610_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, static void vf610_gpio_irq_handler(struct irq_desc *desc) { struct vf610_gpio_port *port = - to_vf610_gp(irq_desc_get_handler_data(desc)); + gpiochip_get_data(irq_desc_get_handler_data(desc)); struct irq_chip *chip = irq_desc_get_chip(desc); int pin; unsigned long irq_isfr; @@ -137,7 +132,7 @@ static void vf610_gpio_irq_handler(struct irq_desc *desc) static void vf610_gpio_irq_ack(struct irq_data *d) { struct vf610_gpio_port *port = - to_vf610_gp(irq_data_get_irq_chip_data(d)); + gpiochip_get_data(irq_data_get_irq_chip_data(d)); int gpio = d->hwirq; vf610_gpio_writel(BIT(gpio), port->base + PORT_ISFR); @@ -146,7 +141,7 @@ static void vf610_gpio_irq_ack(struct irq_data *d) static int vf610_gpio_irq_set_type(struct irq_data *d, u32 type) { struct vf610_gpio_port *port = - to_vf610_gp(irq_data_get_irq_chip_data(d)); + gpiochip_get_data(irq_data_get_irq_chip_data(d)); u8 irqc; switch (type) { @@ -182,7 +177,7 @@ static int vf610_gpio_irq_set_type(struct irq_data *d, u32 type) static void vf610_gpio_irq_mask(struct irq_data *d) { struct vf610_gpio_port *port = - to_vf610_gp(irq_data_get_irq_chip_data(d)); + gpiochip_get_data(irq_data_get_irq_chip_data(d)); void __iomem *pcr_base = port->base + PORT_PCR(d->hwirq); vf610_gpio_writel(0, pcr_base); @@ -191,7 +186,7 @@ static void vf610_gpio_irq_mask(struct irq_data *d) static void vf610_gpio_irq_unmask(struct irq_data *d) { struct vf610_gpio_port *port = - to_vf610_gp(irq_data_get_irq_chip_data(d)); + gpiochip_get_data(irq_data_get_irq_chip_data(d)); void __iomem *pcr_base = port->base + PORT_PCR(d->hwirq); vf610_gpio_writel(port->irqc[d->hwirq] << PORT_PCR_IRQC_OFFSET, @@ -201,7 +196,7 @@ static void vf610_gpio_irq_unmask(struct irq_data *d) static int vf610_gpio_irq_set_wake(struct irq_data *d, u32 enable) { struct vf610_gpio_port *port = - to_vf610_gp(irq_data_get_irq_chip_data(d)); + gpiochip_get_data(irq_data_get_irq_chip_data(d)); if (enable) enable_irq_wake(port->irq); @@ -261,7 +256,7 @@ static int vf610_gpio_probe(struct platform_device *pdev) gc->direction_output = vf610_gpio_direction_output; gc->set = vf610_gpio_set; - ret = gpiochip_add(gc); + ret = gpiochip_add_data(gc, port); if (ret < 0) return ret;