linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 121/182] pinctrl: exynos5440: use gpiochip data pointer
@ 2015-12-09 13:34 Linus Walleij
  2015-12-11  6:21 ` Tomasz Figa
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2015-12-09 13:34 UTC (permalink / raw)
  To: linux-gpio, Johan Hovold, Alexandre Courbot, Michael Welling,
	Markus Pargmann
  Cc: Linus Walleij, Tomasz Figa, Kukjin Kim

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: Tomasz Figa <tomasz.figa@gmail.com>
Cc: Kukjin Kim <kgene@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/pinctrl/samsung/pinctrl-exynos5440.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/pinctrl/samsung/pinctrl-exynos5440.c b/drivers/pinctrl/samsung/pinctrl-exynos5440.c
index f61f9a6fa9af..00ab63abf1d9 100644
--- a/drivers/pinctrl/samsung/pinctrl-exynos5440.c
+++ b/drivers/pinctrl/samsung/pinctrl-exynos5440.c
@@ -15,7 +15,7 @@
 #include <linux/io.h>
 #include <linux/slab.h>
 #include <linux/err.h>
-#include <linux/gpio.h>
+#include <linux/gpio/driver.h>
 #include <linux/device.h>
 #include <linux/pinctrl/pinctrl.h>
 #include <linux/pinctrl/pinmux.h>
@@ -539,7 +539,7 @@ static const struct pinconf_ops exynos5440_pinconf_ops = {
 /* gpiolib gpio_set callback function */
 static void exynos5440_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
 {
-	struct exynos5440_pinctrl_priv_data *priv = dev_get_drvdata(gc->parent);
+	struct exynos5440_pinctrl_priv_data *priv = gpiochip_get_data(gc);
 	void __iomem *base = priv->reg_base;
 	u32 data;
 
@@ -553,7 +553,7 @@ static void exynos5440_gpio_set(struct gpio_chip *gc, unsigned offset, int value
 /* gpiolib gpio_get callback function */
 static int exynos5440_gpio_get(struct gpio_chip *gc, unsigned offset)
 {
-	struct exynos5440_pinctrl_priv_data *priv = dev_get_drvdata(gc->parent);
+	struct exynos5440_pinctrl_priv_data *priv = gpiochip_get_data(gc);
 	void __iomem *base = priv->reg_base;
 	u32 data;
 
@@ -566,7 +566,7 @@ static int exynos5440_gpio_get(struct gpio_chip *gc, unsigned offset)
 /* gpiolib gpio_direction_input callback function */
 static int exynos5440_gpio_direction_input(struct gpio_chip *gc, unsigned offset)
 {
-	struct exynos5440_pinctrl_priv_data *priv = dev_get_drvdata(gc->parent);
+	struct exynos5440_pinctrl_priv_data *priv = gpiochip_get_data(gc);
 	void __iomem *base = priv->reg_base;
 	u32 data;
 
@@ -586,7 +586,7 @@ static int exynos5440_gpio_direction_input(struct gpio_chip *gc, unsigned offset
 static int exynos5440_gpio_direction_output(struct gpio_chip *gc, unsigned offset,
 							int value)
 {
-	struct exynos5440_pinctrl_priv_data *priv = dev_get_drvdata(gc->parent);
+	struct exynos5440_pinctrl_priv_data *priv = gpiochip_get_data(gc);
 	void __iomem *base = priv->reg_base;
 	u32 data;
 
@@ -607,7 +607,7 @@ static int exynos5440_gpio_direction_output(struct gpio_chip *gc, unsigned offse
 /* gpiolib gpio_to_irq callback function */
 static int exynos5440_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
 {
-	struct exynos5440_pinctrl_priv_data *priv = dev_get_drvdata(gc->parent);
+	struct exynos5440_pinctrl_priv_data *priv = gpiochip_get_data(gc);
 	unsigned int virq;
 
 	if (offset < 16 || offset > 23)
@@ -825,7 +825,7 @@ static int exynos5440_gpiolib_register(struct platform_device *pdev,
 	gc->to_irq = exynos5440_gpio_to_irq;
 	gc->label = "gpiolib-exynos5440";
 	gc->owner = THIS_MODULE;
-	ret = gpiochip_add(gc);
+	ret = gpiochip_add_data(gc, priv);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to register gpio_chip %s, error "
 					"code: %d\n", gc->label, ret);
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 121/182] pinctrl: exynos5440: use gpiochip data pointer
  2015-12-09 13:34 [PATCH 121/182] pinctrl: exynos5440: use gpiochip data pointer Linus Walleij
@ 2015-12-11  6:21 ` Tomasz Figa
  2015-12-14 14:09   ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Tomasz Figa @ 2015-12-11  6:21 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-gpio@vger.kernel.org, Johan Hovold, Alexandre Courbot,
	Michael Welling, Markus Pargmann, Kukjin Kim

Hi Linus,

Please see my comments inline.

2015-12-09 22:34 GMT+09:00 Linus Walleij <linus.walleij@linaro.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: Tomasz Figa <tomasz.figa@gmail.com>
> Cc: Kukjin Kim <kgene@kernel.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/pinctrl/samsung/pinctrl-exynos5440.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/pinctrl/samsung/pinctrl-exynos5440.c b/drivers/pinctrl/samsung/pinctrl-exynos5440.c
> index f61f9a6fa9af..00ab63abf1d9 100644
> --- a/drivers/pinctrl/samsung/pinctrl-exynos5440.c
> +++ b/drivers/pinctrl/samsung/pinctrl-exynos5440.c
> @@ -15,7 +15,7 @@
>  #include <linux/io.h>
>  #include <linux/slab.h>
>  #include <linux/err.h>
> -#include <linux/gpio.h>
> +#include <linux/gpio/driver.h>

Commit message doesn't mention this change. Do I assume correctly that
it's needed for gpiochip_get_data() and also gives the driver access
to all definitions it needed from linux/gpio.h?

Other than that (and the fact that, as opposed to the other Exynos
patch, this one is actually cleaner):
Acked-by: Tomasz Figa <tomasz.figa@gmail.com>

Best regards,
Tomasz

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 121/182] pinctrl: exynos5440: use gpiochip data pointer
  2015-12-11  6:21 ` Tomasz Figa
@ 2015-12-14 14:09   ` Linus Walleij
  0 siblings, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2015-12-14 14:09 UTC (permalink / raw)
  To: Tomasz Figa
  Cc: linux-gpio@vger.kernel.org, Johan Hovold, Alexandre Courbot,
	Michael Welling, Markus Pargmann, Kukjin Kim

On Fri, Dec 11, 2015 at 7:21 AM, Tomasz Figa <tomasz.figa@gmail.com> wrote:

>> -#include <linux/gpio.h>
>> +#include <linux/gpio/driver.h>
>
> Commit message doesn't mention this change. Do I assume correctly that
> it's needed for gpiochip_get_data() and also gives the driver access
> to all definitions it needed from linux/gpio.h?

No GPIO driver should ever use anything outside <linux/gpio/driver.h>
and it appears this one doesn't. So it's just me sneaking in some
cleanups.

> Other than that (and the fact that, as opposed to the other Exynos
> patch, this one is actually cleaner):
> Acked-by: Tomasz Figa <tomasz.figa@gmail.com>

Thanks, well the thing is that from a helicopter view, everything looks
better after this patch series, so that is why I'm pushing it.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-14 14:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-09 13:34 [PATCH 121/182] pinctrl: exynos5440: use gpiochip data pointer Linus Walleij
2015-12-11  6:21 ` Tomasz Figa
2015-12-14 14:09   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).