diff mbox

[05/12] GPIO: gpio-generic: Add label to platform data

Message ID 1392138636-29240-6-git-send-email-pawel.moll@arm.com
State Accepted
Commit 781f6d710d4482eab05cfaad50060a0ea8c0e4e0
Headers show

Commit Message

Pawel Moll Feb. 11, 2014, 5:10 p.m. UTC
When registering more than one platform device, it is
useful to set the gpio chip label in the platform data.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Pawel Moll <pawel.moll@arm.com>
---
This patch has been already merged by Linux; it has been included
for completeness only.

 drivers/gpio/gpio-generic.c     | 2 ++
 include/linux/basic_mmio_gpio.h | 1 +
 2 files changed, 3 insertions(+)

Comments

Lee Jones Feb. 11, 2014, 5:17 p.m. UTC | #1
> When registering more than one platform device, it is
> useful to set the gpio chip label in the platform data.
> 
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Alexandre Courbot <gnurou@gmail.com>
> Cc: Samuel Ortiz <sameo@linux.intel.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Pawel Moll <pawel.moll@arm.com>
> ---
> This patch has been already merged by Linux; it has been included
> for completeness only.
> 
>  drivers/gpio/gpio-generic.c     | 2 ++
>  include/linux/basic_mmio_gpio.h | 1 +
>  2 files changed, 3 insertions(+)
> 
> diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
> index d2196bf..8c778af 100644
> --- a/drivers/gpio/gpio-generic.c
> +++ b/drivers/gpio/gpio-generic.c
> @@ -531,6 +531,8 @@ static int bgpio_pdev_probe(struct platform_device *pdev)
>  		return err;
>  
>  	if (pdata) {
> +		if (pdata->label)

Why is this check necessary?

> +			bgc->gc.label = pdata->label;
>  		bgc->gc.base = pdata->base;
>  		if (pdata->ngpio > 0)
>  			bgc->gc.ngpio = pdata->ngpio;
> diff --git a/include/linux/basic_mmio_gpio.h b/include/linux/basic_mmio_gpio.h
> index d8a97ec..0e97856 100644
> --- a/include/linux/basic_mmio_gpio.h
> +++ b/include/linux/basic_mmio_gpio.h
> @@ -19,6 +19,7 @@
>  #include <linux/spinlock_types.h>
>  
>  struct bgpio_pdata {
> +	const char *label;
>  	int base;
>  	int ngpio;
>  };
Pawel Moll Feb. 11, 2014, 5:20 p.m. UTC | #2
On Tue, 2014-02-11 at 17:17 +0000, Lee Jones wrote:
> > When registering more than one platform device, it is

> > useful to set the gpio chip label in the platform data.

> >

> > Cc: Linus Walleij <linus.walleij@linaro.org>

> > Cc: Alexandre Courbot <gnurou@gmail.com>

> > Cc: Samuel Ortiz <sameo@linux.intel.com>

> > Cc: Lee Jones <lee.jones@linaro.org>

> > Signed-off-by: Pawel Moll <pawel.moll@arm.com>

> > ---

> > This patch has been already merged by Linux; it has been included

> > for completeness only.

> >

> >  drivers/gpio/gpio-generic.c     | 2 ++

> >  include/linux/basic_mmio_gpio.h | 1 +

> >  2 files changed, 3 insertions(+)

> >

> > diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c

> > index d2196bf..8c778af 100644

> > --- a/drivers/gpio/gpio-generic.c

> > +++ b/drivers/gpio/gpio-generic.c

> > @@ -531,6 +531,8 @@ static int bgpio_pdev_probe(struct platform_device *pdev)

> >             return err;

> >

> >     if (pdata) {

> > +           if (pdata->label)

>

> Why is this check necessary?

>

> > +                   bgc->gc.label = pdata->label;


Because bgc->gc.label is initialized to a default value in bgpio_init()
and I don't want to override it with NULL if there is no label passed in
the platform data.

Pawel

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No:  2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No:  2548782
N‹§˛ćěr¸›yúčšŘb˛XŹśÇ§vŘ^–)Ţş{.nÇ+‰ˇĽŠ{ą‘ęçzX§ś›ĄÜ¨}Šž˛Ć zÚ&j:+v‰¨žŤ‘ęçzZ+€Ę+zfŁ˘ˇhšˆ§~†­†Űi˙űŕzšŽwĽ˘¸?™¨č­Ú&˘)ߢf”ů^jÇŤy§m…á@AŤaśÚ˙0śěhŽĺ’i
Lee Jones Feb. 11, 2014, 5:46 p.m. UTC | #3
> > > When registering more than one platform device, it is
> > > useful to set the gpio chip label in the platform data.
> > >
> > > Cc: Linus Walleij <linus.walleij@linaro.org>
> > > Cc: Alexandre Courbot <gnurou@gmail.com>
> > > Cc: Samuel Ortiz <sameo@linux.intel.com>
> > > Cc: Lee Jones <lee.jones@linaro.org>
> > > Signed-off-by: Pawel Moll <pawel.moll@arm.com>
> > > ---
> > > This patch has been already merged by Linux; it has been included
> > > for completeness only.
> > >
> > >  drivers/gpio/gpio-generic.c     | 2 ++
> > >  include/linux/basic_mmio_gpio.h | 1 +
> > >  2 files changed, 3 insertions(+)
> > >
> > > diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
> > > index d2196bf..8c778af 100644
> > > --- a/drivers/gpio/gpio-generic.c
> > > +++ b/drivers/gpio/gpio-generic.c
> > > @@ -531,6 +531,8 @@ static int bgpio_pdev_probe(struct platform_device *pdev)
> > >             return err;
> > >
> > >     if (pdata) {
> > > +           if (pdata->label)
> >
> > Why is this check necessary?
> >
> > > +                   bgc->gc.label = pdata->label;
> 
> Because bgc->gc.label is initialized to a default value in bgpio_init()
> and I don't want to override it with NULL if there is no label passed in
> the platform data.

Ah ha, thanks for clarifying.
diff mbox

Patch

diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
index d2196bf..8c778af 100644
--- a/drivers/gpio/gpio-generic.c
+++ b/drivers/gpio/gpio-generic.c
@@ -531,6 +531,8 @@  static int bgpio_pdev_probe(struct platform_device *pdev)
 		return err;
 
 	if (pdata) {
+		if (pdata->label)
+			bgc->gc.label = pdata->label;
 		bgc->gc.base = pdata->base;
 		if (pdata->ngpio > 0)
 			bgc->gc.ngpio = pdata->ngpio;
diff --git a/include/linux/basic_mmio_gpio.h b/include/linux/basic_mmio_gpio.h
index d8a97ec..0e97856 100644
--- a/include/linux/basic_mmio_gpio.h
+++ b/include/linux/basic_mmio_gpio.h
@@ -19,6 +19,7 @@ 
 #include <linux/spinlock_types.h>
 
 struct bgpio_pdata {
+	const char *label;
 	int base;
 	int ngpio;
 };