linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/25] treewide-next: Use static const char arrays
@ 2010-09-13 19:47 Joe Perches
  2010-09-13 19:47 ` [PATCH 02/25] arch/powerpc: " Joe Perches
  2010-09-13 19:47 ` [PATCH 04/25] drivers/char: " Joe Perches
  0 siblings, 2 replies; 6+ messages in thread
From: Joe Perches @ 2010-09-13 19:47 UTC (permalink / raw)
  To: linux-kernel
  Cc: Amit Kumar Salecha, linux-fbdev, Greg Kroah-Hartman, James Smart,
	linux-mips, VMware, Inc., PJ Waskiewicz, Shreyas Bhatewara,
	alsa-devel, Jaroslav Kysela, J. Bruce Fields,
	James E.J. Bottomley, Paul Mackerras, linux-i2c, Brett Rudley,
	sparclinux, Martin Schwidefsky, devel, linux-s390, linux-acpi,
	linux-scsi, Florian Tobias Schandinat, e1000-devel,
	Trond Myklebust, Jesse Brandeburg, Neil Brown, Jeff Kirsher,
	linux-wireless, Ingo Molnar, linux-usb, Len Brown, Alex Duyck,
	Peter Zijlstra, Henry Ptasinski, Heiko Carstens,
	Thomas Winischhofer, Mauro Carvalho Chehab,
	Arnaldo Carvalho de Melo, Jean Delvare (PC drivers, core),
	mjpeg-users, Ben Dooks (embedded platforms), linux-nfs,
	linux-arm-kernel, Neela Syam Kolli, Karsten Keil, Linus Walleij,
	netdev, Anirban Chakraborty, Bruce Allan, Nohee Ko, Ralf Baechle,
	Joseph Chan, John Ronciak, Takashi Iwai, linux-driver, linux390,
	linux-media, linuxppc-dev, David S. Miller

Using static const char foo[] = "bar" can save some
code and text space, so change the places where it's possible.

Also change the places that use
	char foo[] = "barX";
	...
	foo[3] = value + '0';
where X is typically changed
	char foo[sizeof("barX")];
	...
	sprintf(foo, "bar%c", value + '0');

Joe Perches (25):
  arch/mips: Use static const char arrays
  arch/powerpc: Use static const char arrays
  drivers/acpi: Use static const char arrays
  drivers/char: Use static const char arrays
  drivers/i2c: Use static const char arrays
  drivers/isdn: Use static const char arrays
  drivers/media: Use static const char arrays
  drivers/net/atl1c: Use static const char arrays
  drivers/net/atl1e: Use static const char arrays
  drivers/net/(intel): Use static const char arrays
  drivers/net/netxen: Use static const char arrays
  drivers/net/qlcnic: Use static const char arrays
  drivers/net/spider_net.c: Use static const char arrays
  drivers/net/vnxnet3: Use static const char arrays
  drivers/net/wireless/ipw2x00: Use static const char arrays
  drivers/s390/char: Use static const char arrays
  drivers/scsi: Use static const char arrays
  drivers/serial/suncore.c: Use static const char arrays
  drivers/staging: Use static const char arrays
  drivers/usb: Use static const char arrays
  drivers/video: Use static const char arrays
  net/dsa: Use static const char arrays
  net/sunrpc: Use static const char arrays
  sound: Use static const char arrays
  tools/perf/util: Use static const char arrays

 arch/mips/pnx8550/common/reset.c                   |    4 ++--
 arch/powerpc/boot/addnote.c                        |    4 ++--
 arch/powerpc/boot/cuboot-c2k.c                     |    4 ++--
 arch/powerpc/kernel/irq.c                          |    2 +-
 drivers/acpi/sleep.c                               |    4 ++--
 drivers/char/hvc_vio.c                             |    2 +-
 drivers/i2c/busses/i2c-stu300.c                    |    4 ++--
 drivers/isdn/hysdn/hycapi.c                        |    2 +-
 drivers/isdn/mISDN/dsp_cmx.c                       |    2 +-
 drivers/media/video/zoran/zoran_device.c           |    5 ++---
 drivers/net/atl1c/atl1c.h                          |    4 ++--
 drivers/net/atl1c/atl1c_main.c                     |    4 ++--
 drivers/net/atl1e/atl1e.h                          |    4 ++--
 drivers/net/atl1e/atl1e_main.c                     |    4 ++--
 drivers/net/e1000/e1000.h                          |    2 +-
 drivers/net/e1000/e1000_main.c                     |    4 ++--
 drivers/net/e1000e/e1000.h                         |    2 +-
 drivers/net/e1000e/netdev.c                        |    2 +-
 drivers/net/igb/igb.h                              |    4 ++--
 drivers/net/igb/igb_main.c                         |    4 ++--
 drivers/net/igbvf/igbvf.h                          |    2 +-
 drivers/net/igbvf/netdev.c                         |    2 +-
 drivers/net/ixgb/ixgb.h                            |    2 +-
 drivers/net/ixgb/ixgb_main.c                       |    2 +-
 drivers/net/ixgbe/ixgbe.h                          |    2 +-
 drivers/net/ixgbe/ixgbe_main.c                     |    4 ++--
 drivers/net/ixgbevf/ixgbevf.h                      |    2 +-
 drivers/net/ixgbevf/ixgbevf_main.c                 |    2 +-
 drivers/net/netxen/netxen_nic.h                    |    2 +-
 drivers/net/netxen/netxen_nic_main.c               |    2 +-
 drivers/net/qlcnic/qlcnic.h                        |    2 +-
 drivers/net/qlcnic/qlcnic_main.c                   |    2 +-
 drivers/net/spider_net.c                           |    2 +-
 drivers/net/vmxnet3/vmxnet3_drv.c                  |    2 +-
 drivers/net/vmxnet3/vmxnet3_int.h                  |    2 +-
 drivers/net/wireless/ipw2x00/ipw2100.c             |    2 +-
 drivers/net/wireless/ipw2x00/ipw2200.c             |    2 +-
 drivers/net/wireless/ipw2x00/libipw_module.c       |    2 +-
 drivers/s390/char/vmlogrdr.c                       |    4 ++--
 drivers/scsi/bnx2i/bnx2i_hwi.c                     |    6 +++---
 drivers/scsi/lpfc/lpfc_init.c                      |    2 +-
 drivers/scsi/megaraid/megaraid_mbox.c              |    6 +++---
 drivers/serial/suncore.c                           |    4 ++--
 drivers/staging/brcm80211/util/bcmutils.c          |    2 +-
 drivers/staging/comedi/drivers/comedi_bond.c       |    2 +-
 drivers/staging/cxt1e1/ossiRelease.c               |    2 +-
 drivers/staging/go7007/go7007-driver.c             |    2 +-
 drivers/staging/msm/mdp.c                          |    2 +-
 .../staging/rtl8192e/ieee80211/ieee80211_module.c  |    2 +-
 .../staging/rtl8192u/ieee80211/ieee80211_module.c  |    2 +-
 drivers/staging/tidspbridge/rmgr/dbdcd.c           |    6 +++---
 drivers/usb/atm/ueagle-atm.c                       |   14 +++++---------
 drivers/usb/otg/langwell_otg.c                     |    2 +-
 drivers/video/sh_mipi_dsi.c                        |    4 ++--
 drivers/video/sis/sis_main.c                       |   10 +++++-----
 drivers/video/via/viafbdev.c                       |    2 +-
 net/dsa/dsa.c                                      |    2 +-
 net/dsa/dsa_priv.h                                 |    2 +-
 net/sunrpc/auth_gss/gss_krb5_mech.c                |    2 +-
 sound/core/misc.c                                  |    5 ++++-
 tools/perf/util/ui/setup.c                         |    3 ++-
 tools/perf/util/ui/util.c                          |    3 ++-
 62 files changed, 98 insertions(+), 98 deletions(-)

-- 
1.7.3.rc1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 02/25] arch/powerpc: Use static const char arrays
  2010-09-13 19:47 [PATCH 00/25] treewide-next: Use static const char arrays Joe Perches
@ 2010-09-13 19:47 ` Joe Perches
  2010-09-14  2:02   ` Stephen Rothwell
  2010-09-14  2:04   ` Stephen Rothwell
  2010-09-13 19:47 ` [PATCH 04/25] drivers/char: " Joe Perches
  1 sibling, 2 replies; 6+ messages in thread
From: Joe Perches @ 2010-09-13 19:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Paul Mackerras, linuxppc-dev

Signed-off-by: Joe Perches <joe@perches.com>
---
 arch/powerpc/boot/addnote.c    |    4 ++--
 arch/powerpc/boot/cuboot-c2k.c |    4 ++--
 arch/powerpc/kernel/irq.c      |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/boot/addnote.c b/arch/powerpc/boot/addnote.c
index b1e5611..349b553 100644
--- a/arch/powerpc/boot/addnote.c
+++ b/arch/powerpc/boot/addnote.c
@@ -20,7 +20,7 @@
 #include <string.h>
 
 /* CHRP note section */
-char arch[] = "PowerPC";
+static const char arch[] = "PowerPC";
 
 #define N_DESCR	6
 unsigned int descr[N_DESCR] = {
@@ -33,7 +33,7 @@ unsigned int descr[N_DESCR] = {
 };
 
 /* RPA note section */
-char rpaname[] = "IBM,RPA-Client-Config";
+static const char rpaname[] = "IBM,RPA-Client-Config";
 
 /*
  * Note: setting ignore_my_client_config *should* mean that OF ignores
diff --git a/arch/powerpc/boot/cuboot-c2k.c b/arch/powerpc/boot/cuboot-c2k.c
index e435949..030d7db 100644
--- a/arch/powerpc/boot/cuboot-c2k.c
+++ b/arch/powerpc/boot/cuboot-c2k.c
@@ -62,9 +62,9 @@ static void c2k_bridge_setup(u32 mem_size)
 	/* Get the cpu -> pci i/o & mem mappings from the device tree */
 	devp = NULL;
 	for (bus = 0; ; bus++) {
-		char name[] = "pci ";
+		char name[sizeof("pciX")];
 
-		name[strlen(name)-1] = bus+'0';
+		sprintf(name, "pci%c", bus + '0');
 
 		devp = find_node_by_alias(name);
 		if (devp == NULL)
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 4a65386..47fbc56 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -1143,7 +1143,7 @@ static int virq_debug_show(struct seq_file *m, void *private)
 	unsigned long flags;
 	struct irq_desc *desc;
 	const char *p;
-	char none[] = "none";
+	static const char none[] = "none";
 	int i;
 
 	seq_printf(m, "%-5s  %-7s  %-15s  %s\n", "virq", "hwirq",
-- 
1.7.3.rc1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 04/25] drivers/char: Use static const char arrays
  2010-09-13 19:47 [PATCH 00/25] treewide-next: Use static const char arrays Joe Perches
  2010-09-13 19:47 ` [PATCH 02/25] arch/powerpc: " Joe Perches
@ 2010-09-13 19:47 ` Joe Perches
  2010-09-14  2:06   ` Stephen Rothwell
  1 sibling, 1 reply; 6+ messages in thread
From: Joe Perches @ 2010-09-13 19:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: linuxppc-dev

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/char/hvc_vio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/char/hvc_vio.c b/drivers/char/hvc_vio.c
index 27370e9..5e2f52b 100644
--- a/drivers/char/hvc_vio.c
+++ b/drivers/char/hvc_vio.c
@@ -39,7 +39,7 @@
 
 #include "hvc_console.h"
 
-char hvc_driver_name[] = "hvc_console";
+static const char hvc_driver_name[] = "hvc_console";
 
 static struct vio_device_id hvc_driver_table[] __devinitdata = {
 	{"serial", "hvterm1"},
-- 
1.7.3.rc1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 02/25] arch/powerpc: Use static const char arrays
  2010-09-13 19:47 ` [PATCH 02/25] arch/powerpc: " Joe Perches
@ 2010-09-14  2:02   ` Stephen Rothwell
  2010-09-14  2:04   ` Stephen Rothwell
  1 sibling, 0 replies; 6+ messages in thread
From: Stephen Rothwell @ 2010-09-14  2:02 UTC (permalink / raw)
  To: Joe Perches; +Cc: linuxppc-dev, Paul Mackerras, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 591 bytes --]

Hi Joe,

On Mon, 13 Sep 2010 12:47:40 -0700 Joe Perches <joe@perches.com> wrote:
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  arch/powerpc/boot/addnote.c    |    4 ++--
>  arch/powerpc/boot/cuboot-c2k.c |    4 ++--
>  arch/powerpc/kernel/irq.c      |    2 +-
>  3 files changed, 5 insertions(+), 5 deletions(-)

I am also unsure that the transformation to cuboot-c2k.c adds anything.
Other than that

Reviewed-by: Stephen Rothwell <sfr@canb.auug.org.au>

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 02/25] arch/powerpc: Use static const char arrays
  2010-09-13 19:47 ` [PATCH 02/25] arch/powerpc: " Joe Perches
  2010-09-14  2:02   ` Stephen Rothwell
@ 2010-09-14  2:04   ` Stephen Rothwell
  1 sibling, 0 replies; 6+ messages in thread
From: Stephen Rothwell @ 2010-09-14  2:04 UTC (permalink / raw)
  To: Joe Perches; +Cc: linuxppc-dev, Paul Mackerras, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 168 bytes --]

BTW, Ben Herrenschmidt is the current PowerPC maintainer.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 04/25] drivers/char: Use static const char arrays
  2010-09-13 19:47 ` [PATCH 04/25] drivers/char: " Joe Perches
@ 2010-09-14  2:06   ` Stephen Rothwell
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Rothwell @ 2010-09-14  2:06 UTC (permalink / raw)
  To: Joe Perches; +Cc: linuxppc-dev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 300 bytes --]

Hi Joe,

On Mon, 13 Sep 2010 12:47:42 -0700 Joe Perches <joe@perches.com> wrote:
>
> Signed-off-by: Joe Perches <joe@perches.com>

Reviewed-by: Stephen Rothwell <sfr@canb.auug.org.au>

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-09-14  2:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-13 19:47 [PATCH 00/25] treewide-next: Use static const char arrays Joe Perches
2010-09-13 19:47 ` [PATCH 02/25] arch/powerpc: " Joe Perches
2010-09-14  2:02   ` Stephen Rothwell
2010-09-14  2:04   ` Stephen Rothwell
2010-09-13 19:47 ` [PATCH 04/25] drivers/char: " Joe Perches
2010-09-14  2:06   ` Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).