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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Trent Piepho
Date: Friday, July 25, 2008 - 2:01 pm

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 <tpiepho@freescale.com>
---
 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 519df72..defe693 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -48,7 +48,7 @@ struct led_classdev {
 
 	struct device		*dev;
 	struct list_head	 node;			/* LED Device list */
-	char			*default_trigger;	/* Trigger to use */
+	const char		*default_trigger;	/* Trigger to use */
 
 #ifdef CONFIG_LEDS_TRIGGERS
 	/* Protects the trigger data below */
@@ -121,7 +121,7 @@ extern void ledtrig_ide_activity(void);
 /* 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

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Mon Jul 14, 9:41 am)
Re: [PATCH] leds: implement OpenFirmare GPIO LED driver, Stephen Rothwell, (Mon Jul 14, 8:10 pm)
Re: [PATCH] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Tue Jul 15, 5:38 am)
[PATCH v2] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Tue Jul 15, 5:40 am)
Re: [PATCH v2] leds: implement OpenFirmare GPIO LED driver, Richard Purdie, (Tue Jul 15, 5:54 am)
Re: [PATCH v2] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Tue Jul 15, 6:24 am)
Re: [PATCH v2] leds: implement OpenFirmare GPIO LED driver, Richard Purdie, (Tue Jul 15, 6:31 am)
Re: [PATCH v2] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Tue Jul 15, 7:23 am)
Re: [PATCH v2] leds: implement OpenFirmare GPIO LED driver, Richard Purdie, (Tue Jul 15, 7:43 am)
[PATCH v3] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Tue Jul 15, 8:19 am)
Re: [PATCH] leds: implement OpenFirmare GPIO LED driver, Segher Boessenkool, (Wed Jul 16, 10:59 pm)
Re: [PATCH] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Thu Jul 17, 4:07 am)
Re: [PATCH v3] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Thu Jul 17, 6:55 am)
Re: [PATCH v3] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Thu Jul 17, 7:05 am)
Re: [PATCH v3] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Thu Jul 17, 7:13 am)
Re: [PATCH] leds: implement OpenFirmare GPIO LED driver, Sean MacLennan, (Thu Jul 17, 7:58 am)
Re: [PATCH] leds: implement OpenFirmare GPIO LED driver, Grant Likely, (Thu Jul 17, 8:07 am)
Re: [PATCH v3] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Thu Jul 17, 8:20 am)
Re: [PATCH v3] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Thu Jul 17, 4:42 pm)
Re: [PATCH] leds: implement OpenFirmare GPIO LED driver, David Gibson, (Thu Jul 17, 8:35 pm)
Re: [PATCH] leds: implement OpenFirmare GPIO LED driver, Grant Likely, (Thu Jul 17, 9:44 pm)
Re: [PATCH v3] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Fri Jul 18, 3:05 am)
Re: PIXIS gpio controller and gpio flags, Trent Piepho, (Sat Jul 19, 2:08 pm)
Re: PIXIS gpio controller and gpio flags, Anton Vorontsov, (Mon Jul 21, 10:53 am)
Re: PIXIS gpio controller and gpio flags, Trent Piepho, (Mon Jul 21, 2:12 pm)
Re: PIXIS gpio controller and gpio flags, Anton Vorontsov, (Wed Jul 23, 7:56 am)
Re: PIXIS gpio controller and gpio flags, Trent Piepho, (Wed Jul 23, 4:42 pm)
[RFC PATCH] of_gpio: implement of_get_gpio_flags(), Anton Vorontsov, (Fri Jul 25, 9:48 am)
[PATCH 1/2] leds: make the default trigger name const, Trent Piepho, (Fri Jul 25, 2:01 pm)
[PATCH 2/2] leds: Support OpenFirmware led bindings, Trent Piepho, (Fri Jul 25, 2:01 pm)
Re: [RFC PATCH] of_gpio: implement of_get_gpio_flags(), Trent Piepho, (Sat Jul 26, 1:26 am)
Re: [PATCH 2/2] leds: Support OpenFirmware led bindings, Grant Likely, (Sat Jul 26, 7:21 pm)
Re: [PATCH 1/2] leds: make the default trigger name const, Stephen Rothwell, (Sun Jul 27, 6:11 am)
[PATCH v2] leds: make the default trigger name const, Trent Piepho, (Sun Jul 27, 7:02 pm)
Re: [PATCH 2/2] leds: Support OpenFirmware led bindings, Trent Piepho, (Mon Jul 28, 1:31 am)
Re: [PATCH 1/2] leds: make the default trigger name const, Anton Vorontsov, (Mon Jul 28, 2:53 am)
Re: [PATCH 2/2] leds: Support OpenFirmware led bindings, Grant Likely, (Mon Jul 28, 10:09 am)
Re: [PATCH 2/2] leds: Support OpenFirmware led bindings, Anton Vorontsov, (Mon Jul 28, 11:02 am)
Re: [PATCH 2/2] leds: Support OpenFirmware led bindings, Grant Likely, (Mon Jul 28, 11:06 am)
Re: [PATCH 2/2] leds: Support OpenFirmware led bindings, Trent Piepho, (Mon Jul 28, 11:26 am)
Re: [PATCH 2/2] leds: Support OpenFirmware led bindings, Grant Likely, (Mon Jul 28, 11:49 am)
Re: [PATCH 2/2] leds: Support OpenFirmware led bindings, Anton Vorontsov, (Mon Jul 28, 11:51 am)
Re: [PATCH 2/2] leds: Support OpenFirmware led bindings, Trent Piepho, (Mon Jul 28, 12:11 pm)