Skip to contentSkip to conversation

treewide: Use static const char * const where possible

PATCH Applied Joe Perches 6 participants 22 messages Sep 14, 2010

Subsystems (22)
lore
Share & tools
lore
#0 lore raw

cover treewide: Use static const char * const where possible

Convert the uses that should be const of

	char *foo[] = {"bar", "baz"};
to
	const char * const foo[] = {"bar", "baz"};
or
	static const char * const foo[] = {"bar", "baz"};

Joe Perches (16):
arch/alpha: Use static const char * const where possible arch/ia64: Use static const char * const where possible arch/microblaze: Use static const char * const where possible arch/x86: Use static const char * const where possible drivers/gpu: Use static const char * const where possible drivers/isdn: Use static const char * const where possible drivers/net: Use static const char * const where possible drivers/net/pcmcia: Use static const char * const where possible drivers/net/wireless: Use static const char * const where possible drivers/scsi: Use static const char * const where possible drivers/staging: Use static const char * const where possible drivers/usb: Use static const char * const where possible drivers/watchdog: Use static const char * const where possible
fs: Use static const char * const where possible net/irda: Use static const char * const where possible
sound: Use static const char * const where possible

 arch/alpha/kernel/err_ev6.c                  |   12 +++++---
 arch/alpha/kernel/err_marvel.c               |   33 ++++++++++++------------
 arch/alpha/kernel/err_titan.c                |   35 ++++++++++++++-----------
 arch/alpha/kernel/osf_sys.c                  |    4 +-
 arch/ia64/kernel/palinfo.c                   |    2 +-
 arch/microblaze/kernel/heartbeat.c           |   10 +++---
 arch/microblaze/kernel/timer.c               |   12 ++++----
 arch/x86/kernel/smpboot.c                    |    2 +-
 arch/x86/kvm/mmu.c                           |    2 +-
 drivers/gpu/drm/ttm/ttm_page_alloc.c         |    4 ++-
 drivers/isdn/pcbit/edss1.c                   |    2 +-
 drivers/isdn/pcbit/edss1.h                   |    2 +-
 drivers/net/3c515.c                          |    4 ++-
 drivers/net/eth16i.c                         |    4 ++-
 drivers/net/pcmcia/3c589_cs.c                |    2 +-
 drivers/net/wireless/rt2x00/rt2x00debug.c    |    2 +-
 drivers/scsi/bfa/rport.c                     |    4 ++-
 drivers/scsi/pcmcia/nsp_debug.c              |    2 +-
 drivers/scsi/qla2xxx/qla_nx.c                |    4 +-
 drivers/scsi/qla4xxx/ql4_nx.c                |    2 +-
 drivers/staging/ath6kl/os/linux/ar6000_drv.c |   14 +++++-----
 drivers/staging/bcm/Debug.c                  |    5 ++-
 drivers/usb/host/oxu210hp-hcd.c              |    2 +-
 drivers/watchdog/machzwd.c                   |    2 +-
 fs/binfmt_flat.c                             |    4 ++-
 include/net/irda/irlan_event.h               |    2 +-
 net/irda/irlan/irlan_event.c                 |    2 +-
 sound/core/misc.c                            |    5 +---
 sound/core/pcm_native.c                      |    2 +-
 29 files changed, 99 insertions(+), 83 deletions(-)
Signature · 1 line
1.7.3.rc1
#1 lore raw

PATCH 1/16 arch/alpha: Use static const char * const where possible

---
 arch/alpha/kernel/err_ev6.c    |   12 +++++++-----
 arch/alpha/kernel/err_marvel.c |   33 +++++++++++++++++----------------
 arch/alpha/kernel/err_titan.c  |   35 ++++++++++++++++++++---------------
 arch/alpha/kernel/osf_sys.c    |    4 ++--
 4 files changed, 46 insertions(+), 38 deletions(-)
arch/alpha/kernel/err_ev6.c +7 -5
index 8ca6345..253cf1a 100644
@@ -90,11 +90,13 @@ static int
 ev6_parse_cbox(u64 c_addr, u64 c1_syn, u64 c2_syn, 
 	       u64 c_stat, u64 c_sts, int print)
 {
-	char *sourcename[] = { "UNKNOWN", "UNKNOWN", "UNKNOWN",
-			       "MEMORY", "BCACHE", "DCACHE", 
-			       "BCACHE PROBE", "BCACHE PROBE" };
-	char *streamname[] = { "D", "I" };
-	char *bitsname[] = { "SINGLE", "DOUBLE" };
+	static const char * const sourcename[] = {
+		"UNKNOWN", "UNKNOWN", "UNKNOWN",
+		"MEMORY", "BCACHE", "DCACHE",
+		"BCACHE PROBE", "BCACHE PROBE"
+	};
+	static const char * const streamname[] = { "D", "I" };
+	static const char * const bitsname[] = { "SINGLE", "DOUBLE" };
 	int status = MCHK_DISPOSITION_REPORT;
 	int source = -1, stream = -1, bits = -1;
 
arch/alpha/kernel/err_marvel.c +17 -16
index 5c905aa..648ae88 100644
@@ -589,22 +589,23 @@ marvel_print_pox_spl_cmplt(u64 spl_cmplt)
 static void
 marvel_print_pox_trans_sum(u64 trans_sum)
 {
-	char *pcix_cmd[] = { "Interrupt Acknowledge",
-			     "Special Cycle",
-			     "I/O Read",
-			     "I/O Write",
-			     "Reserved",
-			     "Reserved / Device ID Message",
-			     "Memory Read",
-			     "Memory Write",
-			     "Reserved / Alias to Memory Read Block",
-			     "Reserved / Alias to Memory Write Block",
-			     "Configuration Read",
-			     "Configuration Write",
-			     "Memory Read Multiple / Split Completion",
-			     "Dual Address Cycle",
-			     "Memory Read Line / Memory Read Block",
-			     "Memory Write and Invalidate / Memory Write Block"
+	static const char * const pcix_cmd[] = {
+		"Interrupt Acknowledge",
+		"Special Cycle",
+		"I/O Read",
+		"I/O Write",
+		"Reserved",
+		"Reserved / Device ID Message",
+		"Memory Read",
+		"Memory Write",
+		"Reserved / Alias to Memory Read Block",
+		"Reserved / Alias to Memory Write Block",
+		"Configuration Read",
+		"Configuration Write",
+		"Memory Read Multiple / Split Completion",
+		"Dual Address Cycle",
+		"Memory Read Line / Memory Read Block",
+		"Memory Write and Invalidate / Memory Write Block"
 	};
 
 #define IO7__POX_TRANSUM__PCI_ADDR__S		(0)
arch/alpha/kernel/err_titan.c +20 -15
index f7ed97c..c3b3781 100644
@@ -75,8 +75,12 @@ titan_parse_p_serror(int which, u64 serror, int print)
 	int status = MCHK_DISPOSITION_REPORT;
 
 #ifdef CONFIG_VERBOSE_MCHECK
-	char *serror_src[] = {"GPCI", "APCI", "AGP HP", "AGP LP"};
-	char *serror_cmd[] = {"DMA Read", "DMA RMW", "SGTE Read", "Reserved"};
+	static const char * const serror_src[] = {
+		"GPCI", "APCI", "AGP HP", "AGP LP"
+	};
+	static const char * const serror_cmd[] = {
+		"DMA Read", "DMA RMW", "SGTE Read", "Reserved"
+	};
 #endif /* CONFIG_VERBOSE_MCHECK */
 
 #define TITAN__PCHIP_SERROR__LOST_UECC	(1UL << 0)
@@ -140,14 +144,15 @@ titan_parse_p_perror(int which, int port, u64 perror, int print)
 	int status = MCHK_DISPOSITION_REPORT;
 
 #ifdef CONFIG_VERBOSE_MCHECK
-	char *perror_cmd[] = { "Interrupt Acknowledge", "Special Cycle",
-			       "I/O Read",	       	"I/O Write",
-			       "Reserved",	       	"Reserved",
-			       "Memory Read",		"Memory Write",
-			       "Reserved",		"Reserved",
-			       "Configuration Read",	"Configuration Write",
-			       "Memory Read Multiple",	"Dual Address Cycle",
-			       "Memory Read Line","Memory Write and Invalidate"
+	static const char * const perror_cmd[] = {
+		"Interrupt Acknowledge", "Special Cycle",
+		"I/O Read",		"I/O Write",
+		"Reserved",		"Reserved",
+		"Memory Read",		"Memory Write",
+		"Reserved",		"Reserved",
+		"Configuration Read",	"Configuration Write",
+		"Memory Read Multiple",	"Dual Address Cycle",
+		"Memory Read Line",	"Memory Write and Invalidate"
 	};
 #endif /* CONFIG_VERBOSE_MCHECK */
 
@@ -273,11 +278,11 @@ titan_parse_p_agperror(int which, u64 agperror, int print)
 	int cmd, len;
 	unsigned long addr;
 
-	char *agperror_cmd[] = { "Read (low-priority)",	"Read (high-priority)",
-				 "Write (low-priority)",
-				 "Write (high-priority)",
-				 "Reserved",		"Reserved",
-				 "Flush",		"Fence"
+	static const char * const agperror_cmd[] = {
+		"Read (low-priority)",	"Read (high-priority)",
+		"Write (low-priority)",	"Write (high-priority)",
+		"Reserved",		"Reserved",
+		"Flush",		"Fence"
 	};
 #endif /* CONFIG_VERBOSE_MCHECK */
 
arch/alpha/kernel/osf_sys.c +2 -2
index 5d1e6d6..16bc1f5 100644
@@ -594,7 +594,7 @@ SYSCALL_DEFINE2(osf_sigstack, struct sigstack __user *, uss,
 
 SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count)
 {
-	char *sysinfo_table[] = {
+	const char *sysinfo_table[] = {
 		utsname()->sysname,
 		utsname()->nodename,
 		utsname()->release,
@@ -606,7 +606,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count)
 		"dummy",	/* secure RPC domain */
 	};
 	unsigned long offset;
-	char *res;
+	const char *res;
 	long len, err = -EINVAL;
 
 	offset = command-1;
Signature · 1 line
1.7.3.rc1
Acked-by on v1 1/16
#2 lore raw

Re: [PATCH next 01/16] arch/alpha: Use static const char * const where possible

Quoted 7 lines · Joe Perches
---
 arch/alpha/kernel/err_ev6.c    |   12 +++++++-----
 arch/alpha/kernel/err_marvel.c |   33 +++++++++++++++++----------------
 arch/alpha/kernel/err_titan.c  |   35 ++++++++++++++++++++---------------
 arch/alpha/kernel/osf_sys.c    |    4 ++--
 4 files changed, 46 insertions(+), 38 deletions(-)

r~

maintainer
#3 lore raw

Re: [PATCH next 01/16] arch/alpha: Use static const char * const where possible

In reply to Joe Perches
Quoted 156 lines · Joe Perches

---
 arch/alpha/kernel/err_ev6.c    |   12 +++++++----- arch/alpha/kernel/err_marvel.c |   33 +++++++++++++++++---------------- arch/alpha/kernel/err_titan.c  |   35 ++++++++++++++++++++--------------- arch/alpha/kernel/osf_sys.c    |    4 ++--

 4 files changed, 46 insertions(+), 38 deletions(-)
arch/alpha/kernel/err_ev6.c +7 -5
index 8ca6345..253cf1a 100644
@@ -90,11 +90,13 @@ static int
  ev6_parse_cbox(u64 c_addr, u64 c1_syn, u64 c2_syn,
               u64 c_stat, u64 c_sts, int print)
  {
-       char *sourcename[] = { "UNKNOWN", "UNKNOWN", "UNKNOWN",
-                              "MEMORY", "BCACHE", "DCACHE",
-                              "BCACHE PROBE", "BCACHE PROBE" };
-       char *streamname[] = { "D", "I" };
-       char *bitsname[] = { "SINGLE", "DOUBLE" };
+       static const char * const sourcename[] = {
+               "UNKNOWN", "UNKNOWN", "UNKNOWN",
+               "MEMORY", "BCACHE", "DCACHE",
+               "BCACHE PROBE", "BCACHE PROBE"
+       };
+       static const char * const streamname[] = { "D", "I" };
+       static const char * const bitsname[] = { "SINGLE", "DOUBLE" };
        int status = MCHK_DISPOSITION_REPORT;
        int source = -1, stream = -1, bits = -1;
 
arch/alpha/kernel/err_marvel.c +0 -0
index 5c905aa..648ae88 100644
@@ -589,22 +589,23 @@ marvel_print_pox_spl_cmplt(u64 spl_cmplt)

 static void
 marvel_print_pox_trans_sum(u64 trans_sum)
 {
-       char *pcix_cmd[] = { "Interrupt Acknowledge",
-                            "Special Cycle",
-                            "I/O Read",
-                            "I/O Write",
-                            "Reserved",
-                            "Reserved / Device ID Message",
-                            "Memory Read",
-                            "Memory Write",
-                            "Reserved / Alias to Memory Read Block",
-                            "Reserved / Alias to Memory Write Block",
-                            "Configuration Read",
-                            "Configuration Write",
-                            "Memory Read Multiple / Split Completion",
-                            "Dual Address Cycle",
-                            "Memory Read Line / Memory Read Block",
-                            "Memory Write and Invalidate / Memory Write Block"
+       static const char * const pcix_cmd[] = {
+               "Interrupt Acknowledge",
+               "Special Cycle",
+               "I/O Read",
+               "I/O Write",
+               "Reserved",
+               "Reserved / Device ID Message",
+               "Memory Read",
+               "Memory Write",
+               "Reserved / Alias to Memory Read Block",
+               "Reserved / Alias to Memory Write Block",
+               "Configuration Read",
+               "Configuration Write",
+               "Memory Read Multiple / Split Completion",
+               "Dual Address Cycle",
+               "Memory Read Line / Memory Read Block",
+               "Memory Write and Invalidate / Memory Write Block" };

 #define IO7__POX_TRANSUM__PCI_ADDR__S          (0)

arch/alpha/kernel/err_titan.c +20 -15
index f7ed97c..c3b3781 100644
@@ -75,8 +75,12 @@ titan_parse_p_serror(int which, u64 serror, int print)
        int status = MCHK_DISPOSITION_REPORT;
 
  #ifdef CONFIG_VERBOSE_MCHECK
-       char *serror_src[] = {"GPCI", "APCI", "AGP HP", "AGP LP"};
-       char *serror_cmd[] = {"DMA Read", "DMA RMW", "SGTE Read", "Reserved"};
+       static const char * const serror_src[] = {
+               "GPCI", "APCI", "AGP HP", "AGP LP"
+       };
+       static const char * const serror_cmd[] = {
+               "DMA Read", "DMA RMW", "SGTE Read", "Reserved"
+       };
  #endif /* CONFIG_VERBOSE_MCHECK */
 
  #define TITAN__PCHIP_SERROR__LOST_UECC (1UL << 0)
@@ -140,14 +144,15 @@ titan_parse_p_perror(int which, int port, u64 perror, int print)
        int status = MCHK_DISPOSITION_REPORT;
 
  #ifdef CONFIG_VERBOSE_MCHECK
-       char *perror_cmd[] = { "Interrupt Acknowledge", "Special Cycle",
-                              "I/O Read",              "I/O Write",
-                              "Reserved",              "Reserved",
-                              "Memory Read",           "Memory Write",
-                              "Reserved",              "Reserved",
-                              "Configuration Read",    "Configuration Write",
-                              "Memory Read Multiple",  "Dual Address Cycle",
-                              "Memory Read Line","Memory Write and Invalidate"
+       static const char * const perror_cmd[] = {
+               "Interrupt Acknowledge", "Special Cycle",
+               "I/O Read",             "I/O Write",
+               "Reserved",             "Reserved",
+               "Memory Read",          "Memory Write",
+               "Reserved",             "Reserved",
+               "Configuration Read",   "Configuration Write",
+               "Memory Read Multiple", "Dual Address Cycle",
+               "Memory Read Line",     "Memory Write and Invalidate"
        };
  #endif /* CONFIG_VERBOSE_MCHECK */
 
@@ -273,11 +278,11 @@ titan_parse_p_agperror(int which, u64 agperror, int print)
        int cmd, len;
        unsigned long addr;
 
-       char *agperror_cmd[] = { "Read (low-priority)", "Read (high-priority)",
-                                "Write (low-priority)",
-                                "Write (high-priority)",
-                                "Reserved",            "Reserved",
-                                "Flush",               "Fence"
+       static const char * const agperror_cmd[] = {
+               "Read (low-priority)",  "Read (high-priority)",
+               "Write (low-priority)", "Write (high-priority)",
+               "Reserved",             "Reserved",
+               "Flush",                "Fence"
        };
  #endif /* CONFIG_VERBOSE_MCHECK */
 
arch/alpha/kernel/osf_sys.c +1 -1
index 5d1e6d6..16bc1f5 100644
@@ -594,7 +594,7 @@ SYSCALL_DEFINE2(osf_sigstack, struct sigstack __user *, uss,
 
  SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count)
  {
-       char *sysinfo_table[] = {
+       const char *sysinfo_table[] = {
                utsname()->sysname,
                utsname()->nodename,
                utsname()->release,
@@ -606,7 +606,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count)

               "dummy",        /* secure RPC domain */ };
       unsigned long offset;
-       char *res;
+       const char *res;
       long len, err = -EINVAL;

Quoted 3 lines

       offset = command-1;
--
1.7.3.rc1

Thanks Joe. I'll vacuum this up.

Matt
--
To unsubscribe from this list: send the line "unsubscribe linux-alpha" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

PATCH 2/16 arch/ia64: Use static const char * const where possible

In reply to Joe Perches
---
 arch/ia64/kernel/palinfo.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/ia64/kernel/palinfo.c +1 -1
index fdf6f9d..77597e5 100644
@@ -434,7 +434,7 @@ register_info(char *page)
 	unsigned long phys_stacked;
 	pal_hints_u_t hints;
 	unsigned long iregs, dregs;
-	char *info_type[]={
+	static const char * const info_type[] = {
 		"Implemented AR(s)",
 		"AR(s) with read side-effects",
 		"Implemented CR(s)",
Signature · 1 line
1.7.3.rc1
#5 lore raw

PATCH 3/16 arch/microblaze: Use static const char * const where possible

In reply to Joe Perches
---
 arch/microblaze/kernel/heartbeat.c |   10 +++++-----
 arch/microblaze/kernel/timer.c     |   12 ++++++------
 2 files changed, 11 insertions(+), 11 deletions(-)
arch/microblaze/kernel/heartbeat.c +5 -5
index 5227517..f8bc2d7 100644
@@ -47,11 +47,11 @@ void setup_heartbeat(void)
 	struct device_node *gpio = NULL;
 	int *prop;
 	int j;
-	char *gpio_list[] = {
-				"xlnx,xps-gpio-1.00.a",
-				"xlnx,opb-gpio-1.00.a",
-				NULL
-			};
+	const char * const gpio_list[] = {
+		"xlnx,xps-gpio-1.00.a",
+		"xlnx,opb-gpio-1.00.a",
+		NULL
+	};
 
 	for (j = 0; gpio_list[j] != NULL; j++) {
 		gpio = of_find_compatible_node(NULL, NULL, gpio_list[j]);
arch/microblaze/kernel/timer.c +6 -6
index ec7df67..da9d1e5 100644
@@ -258,12 +258,12 @@ void __init time_init(void)
 				0
 			};
 #endif
-	char *timer_list[] = {
-				"xlnx,xps-timer-1.00.a",
-				"xlnx,opb-timer-1.00.b",
-				"xlnx,opb-timer-1.00.a",
-				NULL
-			};
+	const char * const timer_list[] = {
+		"xlnx,xps-timer-1.00.a",
+		"xlnx,opb-timer-1.00.b",
+		"xlnx,opb-timer-1.00.a",
+		NULL
+	};
 
 	for (i = 0; timer_list[i] != NULL; i++) {
 		timer = of_find_compatible_node(NULL, NULL, timer_list[i]);
Signature · 1 line
1.7.3.rc1
maintainer Applied
#6 lore raw

Re: [PATCH next 03/16] arch/microblaze: Use static const char * const where possible

Quoted 6 lines · Joe Perches
---
 arch/microblaze/kernel/heartbeat.c |   10 +++++-----
 arch/microblaze/kernel/timer.c     |   12 ++++++------
 2 files changed, 11 insertions(+), 11 deletions(-)

Applied.

Thanks,
Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#7 lore raw

PATCH 4/16 arch/x86: Use static const char * const where possible

In reply to Joe Perches
---
 arch/x86/kernel/smpboot.c |    2 +-
 arch/x86/kvm/mmu.c        |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/smpboot.c +1 -1
index 63a1a55..b745b30 100644
@@ -498,7 +498,7 @@ static void impress_friends(void)
 void __inquire_remote_apic(int apicid)
 {
 	unsigned i, regs[] = { APIC_ID >> 4, APIC_LVR >> 4, APIC_SPIV >> 4 };
-	char *names[] = { "ID", "VERSION", "SPIV" };
+	const char * const names[] = { "ID", "VERSION", "SPIV" };
 	int timeout;
 	u32 status;
 
arch/x86/kvm/mmu.c +1 -1
index d2dad65..2a7d567 100644
@@ -56,7 +56,7 @@ enum {
 	AUDIT_POST_PTE_WRITE
 };
 
-char *audit_point_name[] = {
+const char * const audit_point_name[] = {
 	"pre page fault",
 	"post page fault",
 	"pre pte write",
Signature · 1 line
1.7.3.rc1
#8 lore raw

PATCH 5/16 drivers/gpu: Use static const char * const where possible

In reply to Joe Perches
---
 drivers/gpu/drm/ttm/ttm_page_alloc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/gpu/drm/ttm/ttm_page_alloc.c +3 -1
index ca90479..578ea3b 100644
@@ -836,7 +836,9 @@ int ttm_page_alloc_debugfs(struct seq_file *m, void *data)
 {
 	struct ttm_page_pool *p;
 	unsigned i;
-	char *h[] = {"pool", "refills", "pages freed", "size"};
+	static const char * const h[] = {
+		"pool", "refills", "pages freed", "size"
+	};
 	if (!_manager) {
 		seq_printf(m, "No pool allocator running.\n");
 		return 0;
Signature · 1 line
1.7.3.rc1
#9 lore raw

PATCH 6/16 drivers/isdn: Use static const char * const where possible

In reply to Joe Perches
---
 drivers/isdn/pcbit/edss1.c |    2 +-
 drivers/isdn/pcbit/edss1.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/isdn/pcbit/edss1.c +1 -1
index d5920ae..80c9c16 100644
@@ -33,7 +33,7 @@
 #include "callbacks.h"
 
 
-char * isdn_state_table[] = {
+const char * const isdn_state_table[] = {
   "Closed",
   "Call initiated",
   "Overlap sending",
drivers/isdn/pcbit/edss1.h +1 -1
index 0b64f97..39f8346 100644
@@ -90,7 +90,7 @@ struct fsm_timer_entry {
 	unsigned long timeout;          /* in seconds */
 };
 
-extern char * isdn_state_table[];
+extern const char * const isdn_state_table[];
 
 void pcbit_fsm_event(struct pcbit_dev *, struct pcbit_chan *,
 		     unsigned short event, struct callb_data *);
Signature · 1 line
1.7.3.rc1
#10 lore raw

PATCH 7/16 drivers/net: Use static const char * const where possible

In reply to Joe Perches
---
 drivers/net/3c515.c  |    4 +++-
 drivers/net/eth16i.c |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/3c515.c +3 -1
index 8a6eb0c..cdf7226 100644
@@ -662,7 +662,9 @@ static int corkscrew_setup(struct net_device *dev, int ioaddr,
 		pr_warning(" *** Warning: this IRQ is unlikely to work! ***\n");
 
 	{
-		char *ram_split[] = { "5:3", "3:1", "1:1", "3:5" };
+		static const char * const ram_split[] = {
+			"5:3", "3:1", "1:1", "3:5"
+		};
 		__u32 config;
 		EL3WINDOW(3);
 		vp->available_media = inw(ioaddr + Wn3_Options);
drivers/net/eth16i.c +3 -1
index 10e39f2..ce22e15 100644
@@ -637,7 +637,9 @@ static void eth16i_initialize(struct net_device *dev, int boot)
 
 	/* Set interface port type */
 	if(boot) {
-		char *porttype[] = {"BNC", "DIX", "TP", "AUTO", "FROM_EPROM" };
+		static const char * const porttype[] = {
+			"BNC", "DIX", "TP", "AUTO", "FROM_EPROM"
+		};
 
 		switch(dev->if_port)
 		{
Signature · 1 line
1.7.3.rc1
#11 lore raw

PATCH 8/16 drivers/net/pcmcia: Use static const char * const where possible

In reply to Joe Perches
---
 drivers/net/pcmcia/3c589_cs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/pcmcia/3c589_cs.c +1 -1
index 7f2baf5..35562a3 100644
@@ -266,7 +266,7 @@ static int tc589_config(struct pcmcia_device *link)
     __be16 *phys_addr;
     int ret, i, j, multi = 0, fifo;
     unsigned int ioaddr;
-    char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
+    static const char * const ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
     u8 *buf;
     size_t len;
 
Signature · 1 line
1.7.3.rc1
#12 lore raw

PATCH 9/16 drivers/net/wireless: Use static const char * const where possible

In reply to Joe Perches
---
 drivers/net/wireless/rt2x00/rt2x00debug.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2x00debug.c +1 -1
index b8cf45c..c1710b2 100644
@@ -380,7 +380,7 @@ static ssize_t rt2x00debug_read_crypto_stats(struct file *file,
 					     loff_t *offset)
 {
 	struct rt2x00debug_intf *intf = file->private_data;
-	char *name[] = { "WEP64", "WEP128", "TKIP", "AES" };
+	static const char * const name[] = { "WEP64", "WEP128", "TKIP", "AES" };
 	char *data;
 	char *temp;
 	size_t size;
Signature · 1 line
1.7.3.rc1
Acked-by on v1 9/16
#13 lore raw

Re: [PATCH next 09/16] drivers/net/wireless: Use static const char * const where possible

Quoted 1 line · Joe Perches
Quoted 21 lines

---
 drivers/net/wireless/rt2x00/rt2x00debug.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2x00debug.c +1 -2
index b8cf45c..c1710b2 100644
@@ -380,7 +380,7 @@ static ssize_t rt2x00debug_read_crypto_stats(struct file *file,
                                             loff_t *offset)
  {
        struct rt2x00debug_intf *intf = file->private_data;
-       char *name[] = { "WEP64", "WEP128", "TKIP", "AES" };
+       static const char * const name[] = { "WEP64", "WEP128", "TKIP", "AES" };
        char *data;
        char *temp;
        size_t size;
--

1.7.3.rc1

#14 lore raw

PATCH 10/16 drivers/scsi: Use static const char * const where possible

In reply to Joe Perches
---
 drivers/scsi/bfa/rport.c        |    4 +++-
 drivers/scsi/pcmcia/nsp_debug.c |    2 +-
 drivers/scsi/qla2xxx/qla_nx.c   |    4 ++--
 drivers/scsi/qla4xxx/ql4_nx.c   |    2 +-
 4 files changed, 7 insertions(+), 5 deletions(-)
drivers/scsi/bfa/rport.c +3 -1
index 9b4c2c9..803f29e 100644
@@ -2068,7 +2068,9 @@ bfa_fcs_rport_aen_post(struct bfa_fcs_rport_s *rport,
 	wwn_t           rpwwn = rport->pwwn;
 	char            lpwwn_ptr[BFA_STRING_32];
 	char            rpwwn_ptr[BFA_STRING_32];
-	char           *prio_str[] = { "unknown", "high", "medium", "low" };
+	static const char * const prio_str[] = {
+		"unknown", "high", "medium", "low"
+	};
 
 	wwn2str(lpwwn_ptr, lpwwn);
 	wwn2str(rpwwn_ptr, rpwwn);
drivers/scsi/pcmcia/nsp_debug.c +1 -1
index 3c6ef64..dbd567c 100644
@@ -147,7 +147,7 @@ static void show_phase(struct scsi_cmnd *SCpnt)
 {
 	int i = SCpnt->SCp.phase;
 
-	char *ph[] = {
+	static const char * const ph[] = {
 		"PH_UNDETERMINED",
 		"PH_ARBSTART",
 		"PH_SELSTART",
drivers/scsi/qla2xxx/qla_nx.c +2 -2
index c5ac876..7525e95 100644
@@ -327,8 +327,8 @@ unsigned qla82xx_crb_hub_agt[64] = {
 };
 
 /* Device states */
-char *qdev_state[] = {
-	 "Unknown",
+static const char * const qdev_state[] = {
+	"Unknown",
 	"Cold",
 	"Initializing",
 	"Ready",
drivers/scsi/qla4xxx/ql4_nx.c +1 -1
index 5d4a382..77ee640 100644
@@ -332,7 +332,7 @@ static unsigned qla4_8xxx_crb_hub_agt[64] = {
 };
 
 /* Device states */
-static char *qdev_state[] = {
+static const char * const qdev_state[] = {
 	"Unknown",
 	"Cold",
 	"Initializing",
Signature · 1 line
1.7.3.rc1
#15 lore raw

PATCH 11/16 drivers/staging: Use static const char * const where possible

In reply to Joe Perches
---
 drivers/staging/ath6kl/os/linux/ar6000_drv.c |   14 +++++++-------
 drivers/staging/bcm/Debug.c                  |    5 +++--
 2 files changed, 10 insertions(+), 9 deletions(-)
drivers/staging/ath6kl/os/linux/ar6000_drv.c +7 -7
index ff7976e..16c9999 100644
@@ -5079,13 +5079,13 @@ ar6000_hbChallengeResp_event(AR_SOFTC_T *ar, A_UINT32 cookie, A_UINT32 source)
 void
 ar6000_reportError_event(AR_SOFTC_T *ar, WMI_TARGET_ERROR_VAL errorVal)
 {
-    char    *errString[] = {
-                [WMI_TARGET_PM_ERR_FAIL]    "WMI_TARGET_PM_ERR_FAIL",
-                [WMI_TARGET_KEY_NOT_FOUND]  "WMI_TARGET_KEY_NOT_FOUND",
-                [WMI_TARGET_DECRYPTION_ERR] "WMI_TARGET_DECRYPTION_ERR",
-                [WMI_TARGET_BMISS]          "WMI_TARGET_BMISS",
-                [WMI_PSDISABLE_NODE_JOIN]   "WMI_PSDISABLE_NODE_JOIN"
-                };
+	static const char * const errString[] = {
+		[WMI_TARGET_PM_ERR_FAIL]    "WMI_TARGET_PM_ERR_FAIL",
+		[WMI_TARGET_KEY_NOT_FOUND]  "WMI_TARGET_KEY_NOT_FOUND",
+		[WMI_TARGET_DECRYPTION_ERR] "WMI_TARGET_DECRYPTION_ERR",
+		[WMI_TARGET_BMISS]          "WMI_TARGET_BMISS",
+		[WMI_PSDISABLE_NODE_JOIN]   "WMI_PSDISABLE_NODE_JOIN"
+	};
 
     A_PRINTF("AR6000 Error on Target. Error = 0x%x\n", errorVal);
 
drivers/staging/bcm/Debug.c +3 -2
index 213f4bc..d01eb12 100644
@@ -1,12 +1,13 @@
 #include "headers.h"
 
-char *buff_dump_base[]={"DEC", "HEX",  "OCT", "BIN"	};
-
 static UINT current_debug_level=BCM_SCREAM;
 
 int bcm_print_buffer( UINT debug_level, const char *function_name,
 				  char *file_name, int line_number, unsigned char *buffer, int bufferlen, unsigned int base)
 {
+	static const char * const buff_dump_base[] = {
+		"DEC", "HEX", "OCT", "BIN"
+	};
 	if(debug_level>=current_debug_level)
 	{
 		int i=0;
Signature · 1 line
1.7.3.rc1
#16 lore raw

PATCH 12/16 drivers/usb: Use static const char * const where possible

In reply to Joe Perches
---
 drivers/usb/host/oxu210hp-hcd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/usb/host/oxu210hp-hcd.c +1 -1
index 8026dc8..32149be 100644
@@ -3687,7 +3687,7 @@ static void oxu_configuration(struct platform_device *pdev, void *base)
 static int oxu_verify_id(struct platform_device *pdev, void *base)
 {
 	u32 id;
-	char *bo[] = {
+	static const char * const bo[] = {
 		"reserved",
 		"128-pin LQFP",
 		"84-pin TFBGA",
Signature · 1 line
1.7.3.rc1
#17 lore raw

PATCH 13/16 drivers/watchdog: Use static const char * const where possible

In reply to Joe Perches
---
 drivers/watchdog/machzwd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/watchdog/machzwd.c +1 -1
index 2d118cf..edffe68 100644
@@ -388,7 +388,7 @@ static struct notifier_block zf_notifier = {
 
 static void __init zf_show_action(int act)
 {
-	char *str[] = { "RESET", "SMI", "NMI", "SCI" };
+	static const char * const str[] = { "RESET", "SMI", "NMI", "SCI" };
 
 	printk(KERN_INFO PFX ": Watchdog using action = %s\n", str[act]);
 }
Signature · 1 line
1.7.3.rc1
#18 lore raw

PATCH 14/16 fs: Use static const char * const where possible

In reply to Joe Perches
---
 fs/binfmt_flat.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fs/binfmt_flat.c +3 -1
index 811384b..d53e0d6 100644
@@ -382,7 +382,9 @@ failed:
 void old_reloc(unsigned long rl)
 {
 #ifdef DEBUG
-	char *segment[] = { "TEXT", "DATA", "BSS", "*UNKNOWN*" };
+	static const char * const segment[] = {
+		"TEXT", "DATA", "BSS", "*UNKNOWN*"
+	};
 #endif
 	flat_v2_reloc_t	r;
 	unsigned long *ptr;
Signature · 1 line
1.7.3.rc1
#19 lore raw

PATCH 15/16 net/irda: Use static const char * const where possible

In reply to Joe Perches
---
 include/net/irda/irlan_event.h |    2 +-
 net/irda/irlan/irlan_event.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
include/net/irda/irlan_event.h +1 -1
index 6d9539f..018b5a7 100644
@@ -67,7 +67,7 @@ typedef enum {
 	IRLAN_WATCHDOG_TIMEOUT,
 } IRLAN_EVENT;
 
-extern char *irlan_state[];
+extern const char * const irlan_state[];
 
 void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event, 
 			   struct sk_buff *skb);
net/irda/irlan/irlan_event.c +1 -1
index cbcb4eb..43f1604 100644
@@ -24,7 +24,7 @@
 
 #include <net/irda/irlan_event.h>
 
-char *irlan_state[] = {
+const char * const irlan_state[] = {
 	"IRLAN_IDLE",
 	"IRLAN_QUERY",
 	"IRLAN_CONN",
Signature · 1 line
1.7.3.rc1
#20 lore raw

PATCH 16/16 sound: Use static const char * const where possible

In reply to Joe Perches
---
 sound/core/misc.c       |    5 +----
 sound/core/pcm_native.c |    2 +-
 2 files changed, 2 insertions(+), 5 deletions(-)
sound/core/misc.c +1 -4
index 0e5e77f..2c41825 100644
@@ -64,15 +64,12 @@ static int print_snd_pfx(unsigned int level, const char *path, int line,
 			 const char *format)
 {
 	const char *file = sanity_file_name(path);
-	char tmp[sizeof("<0>")];
+	char tmp[] = "<0>";
 	const char *pfx = level ? KERN_DEBUG : KERN_DEFAULT;
 	int ret = 0;
 
 	if (format[0] == '<' && format[2] == '>') {
-		tmp[0] = '<';
 		tmp[1] = format[1];
-		tmp[2] = '>';
-		tmp[3] = 0;
 		pfx = tmp;
 		ret = 1;
 	}
sound/core/pcm_native.c +1 -1
index e2e7389..eb40942 100644
@@ -142,7 +142,7 @@ int snd_pcm_info_user(struct snd_pcm_substream *substream,
 
 #ifdef RULES_DEBUG
 #define HW_PARAM(v) [SNDRV_PCM_HW_PARAM_##v] = #v
-char *snd_pcm_hw_param_names[] = {
+static const char * const snd_pcm_hw_param_names[] = {
 	HW_PARAM(ACCESS),
 	HW_PARAM(FORMAT),
 	HW_PARAM(SUBFORMAT),
Signature · 1 line
1.7.3.rc1
#21 lore raw

Re: [PATCH next 16/16] sound: Use static const char * const where possible

At Mon, 13 Sep 2010 21:24:02 -0700,

Quoted 2 lines · Joe Perches

Applied the second chunk (as the first chunk is the revert of your previous patch).

thanks,

Takashi

Quoted 42 lines
---
 sound/core/misc.c       |    5 +----
 sound/core/pcm_native.c |    2 +-
 2 files changed, 2 insertions(+), 5 deletions(-)
sound/core/misc.c +1 -4
index 0e5e77f..2c41825 100644
@@ -64,15 +64,12 @@ static int print_snd_pfx(unsigned int level, const char *path, int line,
 			 const char *format)
 {
 	const char *file = sanity_file_name(path);
-	char tmp[sizeof("<0>")];
+	char tmp[] = "<0>";
 	const char *pfx = level ? KERN_DEBUG : KERN_DEFAULT;
 	int ret = 0;
 
 	if (format[0] == '<' && format[2] == '>') {
-		tmp[0] = '<';
 		tmp[1] = format[1];
-		tmp[2] = '>';
-		tmp[3] = 0;
 		pfx = tmp;
 		ret = 1;
 	}
sound/core/pcm_native.c +1 -1
index e2e7389..eb40942 100644
@@ -142,7 +142,7 @@ int snd_pcm_info_user(struct snd_pcm_substream *substream,
 
 #ifdef RULES_DEBUG
 #define HW_PARAM(v) [SNDRV_PCM_HW_PARAM_##v] = #v
-char *snd_pcm_hw_param_names[] = {
+static const char * const snd_pcm_hw_param_names[] = {
 	HW_PARAM(ACCESS),
 	HW_PARAM(FORMAT),
 	HW_PARAM(SUBFORMAT),
Signature · 1 line
1.7.3.rc1