Skip to contentSkip to conversation

leds: make the default trigger name const

PATCH New Trent Piepho 1 participant 1 message Sep 22, 2008 LED

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 leds: make the default trigger name const

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, 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.

CC Richard Purdie <[email protected]>
---
 include/linux/leds.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
include/linux/leds.h +2 -2
index d41ccb5..d3a73f5 100644
@@ -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;
 };
Signature · 1 line
1.5.4.1