Thread (59 messages) flat view 59 messages, 9 authors, 2008-08-29

Re: [PATCH 1/2] leds: make the default trigger name const

From: Trent Piepho <hidden>
Date: 2008-08-29 01:25:32
Also in: lkml
Subsystem: led subsystem, the rest · Maintainers: Lee Jones, Pavel Machek, Linus Torvalds

The default_trigger fields of struct gpio_led and thus struct led_classdev
are pretty much always assigned from a string literal, which means the
string can't be modified.  Which is fine, since there is no reason to
modify the string and in fact it never is.

But they should be marked const to prevent such code from being added, to
prevent warnings if -Wwrite-strings is used and when assigned from a
constant string other than a string literal (which produces a warning under
current kernel compiler flags), and for general good coding practices.

Signed-off-by: Trent Piepho <redacted>
---
Reposting this again.  It still applies to powerpc-next as of Aug 28 and I
don't think anyone had any problems with it.

  include/linux/leds.h |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/leds.h b/include/linux/leds.h
index d41ccb5..d3a73f5 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -123,7 +123,7 @@ extern void ledtrig_ide_activity(void);
   */
  struct led_info {
  	const char	*name;
-	char		*default_trigger;
+	const char	*default_trigger;
  	int		flags;
  };
@@ -135,7 +135,7 @@ struct led_platform_data {
  /* For the leds-gpio driver */
  struct gpio_led {
  	const char *name;
-	char *default_trigger;
+	const char *default_trigger;
  	unsigned 	gpio;
  	u8 		active_low;
  };
-- 
1.5.4.3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help