Skip to contentSkip to conversation

Fix warnings about non-const strings

PATCH In review Stephen Hemminger 2 participants 17 messages Feb 26, 2009 – Feb 27, 2009

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

cover Fix warnings about non-const strings

Some of these maybe duplicates of other peoples patches.

#1 lore raw

PATCH 1/15 tulip: get rid of warning for non-const string literal

drivers/net/tulip/dmfe.c +1 -1
@@ -288,7 +288,7 @@ enum dmfe_CR6_bits {
 
 /* Global variable declaration ----------------------------- */
 static int __devinitdata printed_version;
-static char version[] __devinitdata =
+static const char version[] __devinitconst =
 	KERN_INFO DRV_NAME ": Davicom DM9xxx net driver, version "
 	DRV_VERSION " (" DRV_RELDATE ")\n";
 
drivers/net/tulip/winbond-840.c +4 -3
@@ -139,9 +139,10 @@ static int full_duplex[MAX_UNITS] = {-1,
 #define PKT_BUF_SZ		1536	/* Size of each temporary Rx buffer.*/
 
 /* These identify the driver base version and may not be removed. */
-static const char version[] __initdata =
-KERN_INFO DRV_NAME ".c:v" DRV_VERSION " (2.4 port) " DRV_RELDATE "  Donald Becker <[email protected]>\n"
-KERN_INFO "  http://www.scyld.com/network/drivers.html\n";
+static const char version[] __initconst =
+	KERN_INFO DRV_NAME ".c:v" DRV_VERSION " (2.4 port) "
+	DRV_RELDATE "  Donald Becker <[email protected]>\n"
+	KERN_INFO "  http://www.scyld.com/network/drivers.html\n";
 
 MODULE_AUTHOR("Donald Becker <[email protected]>");
 MODULE_DESCRIPTION("Winbond W89c840 Ethernet driver");
drivers/net/tulip/de4x5.c +1 -1
@@ -479,7 +479,7 @@
 
 #include "de4x5.h"
 
-static const char version[] __devinitdata =
+static const char version[] __devinitconst =
 	KERN_INFO "de4x5.c:V0.546 2001/02/22 [email protected]\n";
 
 #define c_char const char
drivers/net/tulip/uli526x.c +1 -1
@@ -200,7 +200,7 @@ enum uli526x_CR6_bits {
 
 /* Global variable declaration ----------------------------- */
 static int __devinitdata printed_version;
-static char version[] __devinitdata =
+static const char version[] __devinitconst =
 	KERN_INFO DRV_NAME ": ULi M5261/M5263 net driver, version "
 	DRV_VERSION " (" DRV_RELDATE ")\n";
 
#2 lore raw

PATCH 2/15 lapb: get rid of non-const printk warning

In reply to Stephen Hemminger
drivers/net/wan/lapbether.c +1 -1
@@ -430,7 +430,7 @@ static struct notifier_block lapbeth_dev
 	.notifier_call = lapbeth_device_event,
 };
 
-static const char banner[] __initdata =
+static const char banner[] __initconst =
 	KERN_INFO "LAPB Ethernet driver version 0.02\n";
 
 static int __init lapbeth_init_driver(void)
#3 lore raw

PATCH 3/15 3c59x: get rid of non-const printk warnings

In reply to Stephen Hemminger
drivers/net/3c59x.c +3 -3
@@ -102,8 +102,8 @@ static int vortex_debug = 1;
 #include <linux/delay.h>
 
 
-static char version[] __devinitdata =
-DRV_NAME ": Donald Becker and others.\n";
+static const char version[] __devinitconst =
+	DRV_NAME ": Donald Becker and others.\n";
 
 MODULE_AUTHOR("Donald Becker <[email protected]>");
 MODULE_DESCRIPTION("3Com 3c59x/3c9xx ethernet driver ");
@@ -2908,7 +2908,7 @@ static void vortex_get_drvinfo(struct ne
 		strcpy(info->bus_info, pci_name(VORTEX_PCI(vp)));
 	} else {
 		if (VORTEX_EISA(vp))
-			sprintf(info->bus_info, dev_name(vp->gendev));
+			strcpy(info->bus_info, dev_name(vp->gendev));
 		else
 			sprintf(info->bus_info, "EISA 0x%lx %d",
 					dev->base_addr, dev->irq);
#4 lore raw

PATCH 4/15 ne2k-pci: fix non-constant printk warnings

In reply to Stephen Hemminger
drivers/net/ne2k-pci.c +3 -2
@@ -62,8 +62,9 @@ static int options[MAX_UNITS];
 #include "8390.h"
 
 /* These identify the driver base version and may not be removed. */
-static char version[] __devinitdata =
-KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " D. Becker/P. Gortmaker\n";
+static const char version[] __devinitconst =
+	KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE
+	" D. Becker/P. Gortmaker\n";
 
 #if defined(__powerpc__)
 #define inl_le(addr)  le32_to_cpu(inl(addr))
#5 lore raw

PATCH 5/15 sis900: fix non-constant printk warnings

In reply to Stephen Hemminger
drivers/net/sis900.c +2 -2
@@ -80,8 +80,8 @@
 #define SIS900_MODULE_NAME "sis900"
 #define SIS900_DRV_VERSION "v1.08.10 Apr. 2 2006"
 
-static char version[] __devinitdata =
-KERN_INFO "sis900.c: " SIS900_DRV_VERSION "\n";
+static const char version[] __devinitconst =
+	KERN_INFO "sis900.c: " SIS900_DRV_VERSION "\n";
 
 static int max_interrupt_work = 40;
 static int multicast_filter_limit = 128;
#6 lore raw

PATCH 6/15 yellowfin: fix non-constant printk warnings

In reply to Stephen Hemminger
drivers/net/yellowfin.c +3 -3
@@ -107,9 +107,9 @@ static int gx_fix;
 #include <asm/io.h>
 
 /* These identify the driver base version and may not be removed. */
-static char version[] __devinitdata =
-KERN_INFO DRV_NAME ".c:v1.05  1/09/2001  Written by Donald Becker <[email protected]>\n"
-KERN_INFO "  (unofficial 2.4.x port, " DRV_VERSION ", " DRV_RELDATE ")\n";
+static const char version[] __devinitconst =
+  KERN_INFO DRV_NAME ".c:v1.05  1/09/2001  Written by Donald Becker <[email protected]>\n"
+  KERN_INFO "  (unofficial 2.4.x port, " DRV_VERSION ", " DRV_RELDATE ")\n";
 
 MODULE_AUTHOR("Donald Becker <[email protected]>");
 MODULE_DESCRIPTION("Packet Engines Yellowfin G-NIC Gigabit Ethernet driver");
#7 lore raw

PATCH 7/15 acenic: fix non-constant printk warnings

In reply to Stephen Hemminger
drivers/net/acenic.c +1 -1
@@ -437,7 +437,7 @@ MODULE_PARM_DESC(max_rx_desc, "AceNIC/3C
 MODULE_PARM_DESC(tx_ratio, "AceNIC/3C985/GA620 ratio of NIC memory used for TX/RX descriptors (range 0-63)");
 
 
-static char version[] __devinitdata =
+static const char version[] __devinitconst =
   "acenic.c: v0.92 08/05/2002  Jes Sorensen, [email protected]\n"
   "                            http://home.cern.ch/~jes/gige/acenic.html\n";
 
#8 lore raw

PATCH 8/15 natsemi: fix non-constant printk warnings

In reply to Stephen Hemminger
drivers/net/natsemi.c +1 -1
@@ -127,7 +127,7 @@ static int full_duplex[MAX_UNITS];
 #define NATSEMI_RX_LIMIT	2046	/* maximum supported by hardware */
 
 /* These identify the driver base version and may not be removed. */
-static char version[] __devinitdata =
+static const char version[] __devinitconst =
   KERN_INFO DRV_NAME " dp8381x driver, version "
       DRV_VERSION ", " DRV_RELDATE "\n"
   KERN_INFO "  originally by Donald Becker <[email protected]>\n"
#9 lore raw

PATCH 9/15 fealnx: fix non-constant printk warnings

In reply to Stephen Hemminger
drivers/net/fealnx.c +2 -2
@@ -93,8 +93,8 @@ static int full_duplex[MAX_UNITS] = { -1
 #include <asm/byteorder.h>
 
 /* These identify the driver base version and may not be removed. */
-static char version[] =
-KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE "\n";
+static const char version[] __devinitconst =
+	KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE "\n";
 
 
 /* This driver was written to use PCI memory space, however some x86 systems
#10 lore raw

PATCH 10/15 via-rhine: fix non-constant printk warnings

In reply to Stephen Hemminger
drivers/net/via-rhine.c +3 -2
@@ -109,8 +109,9 @@ static const int multicast_filter_limit 
 #include <linux/dmi.h>
 
 /* These identify the driver base version and may not be removed. */
-static char version[] __devinitdata =
-KERN_INFO DRV_NAME ".c:v1.10-LK" DRV_VERSION " " DRV_RELDATE " Written by Donald Becker\n";
+static const char version[] __devinitconst =
+	KERN_INFO DRV_NAME ".c:v1.10-LK" DRV_VERSION " " DRV_RELDATE
+	" Written by Donald Becker\n";
 
 /* This driver was written to use PCI memory space. Some early versions
    of the Rhine may only work correctly with I/O space accesses. */
#11 lore raw

PATCH 11/15 starfire: fix non-constant printk warnings

In reply to Stephen Hemminger
drivers/net/starfire.c +1 -1
@@ -178,7 +178,7 @@ static int full_duplex[MAX_UNITS] = {0, 
 #define FIRMWARE_TX	"adaptec/starfire_tx.bin"
 
 /* These identify the driver base version and may not be removed. */
-static char version[] =
+static const char version[] __devinitconst =
 KERN_INFO "starfire.c:v1.03 7/26/2000  Written by Donald Becker <[email protected]>\n"
 KERN_INFO " (unofficial 2.2/2.4 kernel port, version " DRV_VERSION ", " DRV_RELDATE ")\n";
 
#12 lore raw

PATCH 12/15 sundance: fix non-constant printk warnings

In reply to Stephen Hemminger
drivers/net/sundance.c +3 -2
@@ -109,8 +109,9 @@ static char *media[MAX_UNITS];
 #endif
 
 /* These identify the driver base version and may not be removed. */
-static char version[] =
-KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE "  Written by Donald Becker\n";
+static const char version[] __devinitconst =
+	KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE
+	" Written by Donald Becker\n";
 
 MODULE_AUTHOR("Donald Becker <[email protected]>");
 MODULE_DESCRIPTION("Sundance Alta Ethernet driver");
#13 lore raw

PATCH 13/15 hamachi: fix non-constant printk warnings

In reply to Stephen Hemminger
drivers/net/hamachi.c +1 -1
@@ -171,7 +171,7 @@ static int tx_params[MAX_UNITS] = {-1, -
 #include <asm/unaligned.h>
 #include <asm/cache.h>
 
-static char version[] __devinitdata =
+static const char version[] __devinitconst =
 KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE "  Written by Donald Becker\n"
 KERN_INFO "   Some modifications by Eric kasten <[email protected]>\n"
 KERN_INFO "   Further modifications by Keith Underwood <[email protected]>\n";
#15 lore raw

PATCH 15/15 mdio: fix non-constant printk warnings

In reply to Stephen Hemminger
drivers/net/phy/mdio_bus.c +1 -1
@@ -99,7 +99,7 @@ int mdiobus_register(struct mii_bus *bus
 	bus->dev.parent = bus->parent;
 	bus->dev.class = &mdio_bus_class;
 	bus->dev.groups = NULL;
-	dev_set_name(&bus->dev, bus->id);
+	dev_set_name(&bus->dev, "%s", bus->id);
 
 	err = device_register(&bus->dev);
 	if (err) {