Skip to contentSkip to conversation

Make gpiochip label const

PATCH In review Dmitry Baryshkov 3 participants 8 messages Aug 12, 2008 – Aug 20, 2008 Generic include/asm header files

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make gpiochip label const

Mark gpiochip label as a const char pointer.

---
 include/asm-generic/gpio.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/asm-generic/gpio.h +1 -1
index 6be061d..8ab874a 100644
@@ -58,7 +58,7 @@ struct module;
  * is calculated by subtracting @base from the gpio number.
  */
 struct gpio_chip {
-	char			*label;
+	const char		*label;
 	struct module		*owner;
 
 	int			(*direction_input)(struct gpio_chip *chip,
Signature · 1 line
1.5.6.3
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines

From [email protected] Tue Aug 12 13:54:29 2008
From: Dmitry Baryshkov <[email protected]>
To: [email protected]
Cc: Dmitry Baryshkov <[email protected]>,
David Brownell <[email protected]>
Subject: [PATCH] Make gpiochip label const
Date: Wed, 13 Aug 2008 00:39:48 +0400

Quoted 4 lines

Mark gpiochip label as a const char pointer.

Quoted 20 lines
---
 include/asm-generic/gpio.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/asm-generic/gpio.h +1 -1
index 6be061d..8ab874a 100644
@@ -58,7 +58,7 @@ struct module;
  * is calculated by subtracting @base from the gpio number.
  */
 struct gpio_chip {
-	char			*label;
+	const char		*label;
 	struct module		*owner;
 
 	int			(*direction_input)(struct gpio_chip *chip,
Signature · 1 line
1.5.6.3
#2 lore raw
Quoted 8 lines · David Brownell
Quoted 8 lines

From [email protected] Tue Aug 12 13:54:29 2008
From: Dmitry Baryshkov <[email protected]>
To: [email protected]
Cc: Dmitry Baryshkov <[email protected]>,
David Brownell <[email protected]>
Subject: [PATCH] Make gpiochip label const
Date: Wed, 13 Aug 2008 00:39:48 +0400

Quoted 7 lines
Quoted 4 lines

Mark gpiochip label as a const char pointer.

Sorry to disturb, but will this make into 2.6.27-rc? Thanks.

Signature · 2 lines
With best wishes
Dmitry
#3 lore raw
Quoted 11 lines · On Sun, 17 Aug 2008 23:00:35 +0400 Dmitry Baryshkov <[email protected]>…
Quoted 10 lines · David Brownell
Quoted 10 lines

From [email protected] Tue Aug 12 13:54:29 2008
From: Dmitry Baryshkov <[email protected]>
To: [email protected]
Cc: Dmitry Baryshkov <[email protected]>,
David Brownell <[email protected]>
Subject: [PATCH] Make gpiochip label const
Date: Wed, 13 Aug 2008 00:39:48 +0400

Mark gpiochip label as a const char pointer.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Sorry to disturb, but will this make into 2.6.27-rc? Thanks.

Ordinarily it would not. Is there some reason why you think it should?

author
#4 lore raw

2008/8/19 Andrew Morton <[email protected]>:

Quoted 16 lines · On Sun, 17 Aug 2008 23:00:35 +0400 Dmitry Baryshkov <[email protected]>…
Quoted 15 lines · David Brownell
Quoted 13 lines
Quoted 12 lines

From [email protected] Tue Aug 12 13:54:29 2008
From: Dmitry Baryshkov <[email protected]>
To: [email protected]
Cc: Dmitry Baryshkov <[email protected]>,
David Brownell <[email protected]>
Subject: [PATCH] Make gpiochip label const
Date: Wed, 13 Aug 2008 00:39:48 +0400

Mark gpiochip label as a const char pointer.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Sorry to disturb, but will this make into 2.6.27-rc? Thanks.

Ordinarily it would not. Is there some reason why you think it should?

It fixes lots of warnings (one per each instance of code filling the gpio chip) and is pretty much small to honour inclusion IMO

Signature · 2 lines
With best wishes
Dmitry
#5 lore raw
Quoted 20 lines · On Tue, 19 Aug 2008 15:13:47 +0400 Dmitry <[email protected]> wrote:

2008/8/19 Andrew Morton <[email protected]>:

Quoted 19 lines · On Sun, 17 Aug 2008 23:00:35 +0400 Dmitry Baryshkov <[email protected]>…
Quoted 18 lines · David Brownell
Quoted 15 lines
Quoted 8 lines

From [email protected] Tue Aug 12 13:54:29 2008
From: Dmitry Baryshkov <[email protected]>
To: [email protected]
Cc: Dmitry Baryshkov <[email protected]>,
David Brownell <[email protected]>
Subject: [PATCH] Make gpiochip label const
Date: Wed, 13 Aug 2008 00:39:48 +0400

Quoted 4 lines

Mark gpiochip label as a const char pointer.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Sorry to disturb, but will this make into 2.6.27-rc? Thanks.

Ordinarily it would not. Is there some reason why you think it should?

It fixes lots of warnings (one per each instance of code filling the gpio chip)

That should have been in the changelog!

When fixing warnings or compilations errors, the compiler output should also be in the changelog.

I don't recall seeing such warnings and I cannot make them happen with drivers/gpio/gpiolib.c or with drivers/gpio/max732x.c or with drivers/gpio/pca953x.c. So we still don't know what this patch does :(

Quoted 1 line

and is pretty much small to honour inclusion IMO

Well sure it's small. But converting things to `const' carries a fairly high risk of adding new warnings or breaking the build.

#6 lore raw
Quoted 29 lines · Andrew Morton
Quoted 26 lines · On Tue, 19 Aug 2008 15:13:47 +0400 Dmitry <[email protected]> wrote:

2008/8/19 Andrew Morton <[email protected]>:

Quoted 24 lines · On Sun, 17 Aug 2008 23:00:35 +0400 Dmitry Baryshkov <[email protected]>…
Quoted 12 lines · David Brownell
Quoted 10 lines
Quoted 10 lines

From [email protected] Tue Aug 12 13:54:29 2008
From: Dmitry Baryshkov <[email protected]>
To: [email protected]
Cc: Dmitry Baryshkov <[email protected]>,
David Brownell <[email protected]>
Subject: [PATCH] Make gpiochip label const
Date: Wed, 13 Aug 2008 00:39:48 +0400

Mark gpiochip label as a const char pointer.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Sorry to disturb, but will this make into 2.6.27-rc? Thanks.

Ordinarily it would not. Is there some reason why you think it should?

Quoted 7 lines
Quoted 1 line

It fixes lots of warnings (one per each instance of code filling the gpio chip)

That should have been in the changelog!

When fixing warnings or compilations errors, the compiler output should also be in the changelog.

Thanks for the tip. It it written somewhere?

Quoted 4 lines

I don't recall seeing such warnings and I cannot make them happen with drivers/gpio/gpiolib.c or with drivers/gpio/max732x.c or with drivers/gpio/pca953x.c. So we still don't know what this patch does :(

Because both mentioned drivers set gpiochip->label to non-const string. You can check arch/arm/common/scoop.c for example of driver showing different behaviour:

CHECK /home/lumag/tosa-tree/arch/arm/common/scoop.c
/home/lumag/tosa-tree/arch/arm/common/scoop.c:250:22: warning: incorrect type in assignment (different modifiers)
/home/lumag/tosa-tree/arch/arm/common/scoop.c:250:22: expected char *label
/home/lumag/tosa-tree/arch/arm/common/scoop.c:250:22: got char const *
CC arch/arm/common/scoop.o
/home/lumag/tosa-tree/arch/arm/common/scoop.c: In function ‘scoop_probe’:
/home/lumag/tosa-tree/arch/arm/common/scoop.c:250: warning: assignment discards qualifiers from pointer target type

Quoted 5 lines
Quoted 2 lines

and is pretty much small to honour inclusion IMO

Well sure it's small. But converting things to `const' carries a fairly high risk of adding new warnings or breaking the build.

Should we stage it into linux-next?

Signature · 2 lines
With best wishes
Dmitry
#7 lore raw
Quoted 8 lines · Dmitry Baryshkov
Quoted 4 lines

I don't recall seeing such warnings and I cannot make them happen with drivers/gpio/gpiolib.c or with drivers/gpio/max732x.c or with drivers/gpio/pca953x.c.  So we still don't know what this patch does :(

Because both mentioned drivers set gpiochip->label to non-const string. You can check arch/arm/common/scoop.c for example of driver showing different behaviour:

You're doing it wrong -- in a small way, not a big one. Instead of

	devptr->gpio.label = dev_name(&pdev->dev);

do

	devptr->gpio.label = "scoop";
	devptr->gpio.dev = &pdev->dev;

No warnings generated that way, and another field is set up...

- Dave