From: Jan Hubicka <jh@suse.cz>

GCC now converts sprintf (a,"%s",b) to strcpy.  This lose on kernel as
strcpy is not inlined and not present in library, so one gets linker
failure.  It seems to make sense to apply this optimization by hand.



---

 drivers/acpi/ac.c        |    4 ++--
 drivers/acpi/asus_acpi.c |    4 ++--
 drivers/acpi/battery.c   |    4 ++--
 drivers/acpi/bus.c       |    4 ++--
 drivers/acpi/button.c    |   10 +++++-----
 drivers/acpi/ec.c        |    4 ++--
 drivers/acpi/fan.c       |    4 ++--
 drivers/acpi/pci_link.c  |    4 ++--
 drivers/acpi/pci_root.c  |    4 ++--
 drivers/acpi/power.c     |    6 +++---
 drivers/acpi/processor.c |    4 ++--
 drivers/acpi/scan.c      |   16 ++++++++--------
 drivers/acpi/thermal.c   |    6 +++---
 fs/reiserfs/prints.c     |    2 +-
 14 files changed, 38 insertions(+), 38 deletions(-)

diff -puN drivers/acpi/ac.c~gcc-34-compilation-fixes drivers/acpi/ac.c
--- 25/drivers/acpi/ac.c~gcc-34-compilation-fixes	2004-01-17 15:10:38.000000000 -0800
+++ 25-akpm/drivers/acpi/ac.c	2004-01-17 15:10:38.000000000 -0800
@@ -246,8 +246,8 @@ acpi_ac_add (
 	memset(ac, 0, sizeof(struct acpi_ac));
 
 	ac->handle = device->handle;
-	sprintf(acpi_device_name(device), "%s", ACPI_AC_DEVICE_NAME);
-	sprintf(acpi_device_class(device), "%s", ACPI_AC_CLASS);
+	strcpy(acpi_device_name(device), ACPI_AC_DEVICE_NAME);
+	strcpy(acpi_device_class(device), ACPI_AC_CLASS);
 	acpi_driver_data(device) = ac;
 
 	result = acpi_ac_get_state(ac);
diff -puN drivers/acpi/asus_acpi.c~gcc-34-compilation-fixes drivers/acpi/asus_acpi.c
--- 25/drivers/acpi/asus_acpi.c~gcc-34-compilation-fixes	2004-01-17 15:10:38.000000000 -0800
+++ 25-akpm/drivers/acpi/asus_acpi.c	2004-01-17 15:10:38.000000000 -0800
@@ -869,8 +869,8 @@ static int __init asus_hotk_add(struct a
 	memset(hotk, 0, sizeof(struct asus_hotk));
 
 	hotk->handle = device->handle;
-	sprintf(acpi_device_name(device), "%s", ACPI_HOTK_DEVICE_NAME);
-	sprintf(acpi_device_class(device), "%s", ACPI_HOTK_CLASS);
+	strcpy(acpi_device_name(device), ACPI_HOTK_DEVICE_NAME);
+	strcpy(acpi_device_class(device), ACPI_HOTK_CLASS);
 	acpi_driver_data(device) = hotk;
 	hotk->device = device;
 
diff -puN drivers/acpi/battery.c~gcc-34-compilation-fixes drivers/acpi/battery.c
--- 25/drivers/acpi/battery.c~gcc-34-compilation-fixes	2004-01-17 15:10:38.000000000 -0800
+++ 25-akpm/drivers/acpi/battery.c	2004-01-17 15:10:38.000000000 -0800
@@ -735,8 +735,8 @@ acpi_battery_add (
 	memset(battery, 0, sizeof(struct acpi_battery));
 
 	battery->handle = device->handle;
-	sprintf(acpi_device_name(device), "%s", ACPI_BATTERY_DEVICE_NAME);
-	sprintf(acpi_device_class(device), "%s", ACPI_BATTERY_CLASS);
+	strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
+	strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
 	acpi_driver_data(device) = battery;
 
 	result = acpi_battery_check(battery);
diff -puN drivers/acpi/bus.c~gcc-34-compilation-fixes drivers/acpi/bus.c
--- 25/drivers/acpi/bus.c~gcc-34-compilation-fixes	2004-01-17 15:10:38.000000000 -0800
+++ 25-akpm/drivers/acpi/bus.c	2004-01-17 15:10:38.000000000 -0800
@@ -296,8 +296,8 @@ acpi_bus_generate_event (
 	if (!event)
 		return_VALUE(-ENOMEM);
 
-	sprintf(event->device_class, "%s", device->pnp.device_class);
-	sprintf(event->bus_id, "%s", device->pnp.bus_id);
+	strcpy(event->device_class, device->pnp.device_class);
+	strcpy(event->bus_id, device->pnp.bus_id);
 	event->type = type;
 	event->data = data;
 
diff -puN drivers/acpi/button.c~gcc-34-compilation-fixes drivers/acpi/button.c
--- 25/drivers/acpi/button.c~gcc-34-compilation-fixes	2004-01-17 15:10:38.000000000 -0800
+++ 25-akpm/drivers/acpi/button.c	2004-01-17 15:10:38.000000000 -0800
@@ -316,35 +316,35 @@ acpi_button_add (
 	 */
 	if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWER)) {
 		button->type = ACPI_BUTTON_TYPE_POWER;
-		sprintf(acpi_device_name(device), "%s",
+		strcpy(acpi_device_name(device),
 			ACPI_BUTTON_DEVICE_NAME_POWER);
 		sprintf(acpi_device_class(device), "%s/%s", 
 			ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
 	}
 	else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) {
 		button->type = ACPI_BUTTON_TYPE_POWERF;
-		sprintf(acpi_device_name(device), "%s",
+		strcpy(acpi_device_name(device),
 			ACPI_BUTTON_DEVICE_NAME_POWERF);
 		sprintf(acpi_device_class(device), "%s/%s", 
 			ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
 	}
 	else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) {
 		button->type = ACPI_BUTTON_TYPE_SLEEP;
-		sprintf(acpi_device_name(device), "%s",
+		strcpy(acpi_device_name(device),
 			ACPI_BUTTON_DEVICE_NAME_SLEEP);
 		sprintf(acpi_device_class(device), "%s/%s", 
 			ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
 	}
 	else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) {
 		button->type = ACPI_BUTTON_TYPE_SLEEPF;
-		sprintf(acpi_device_name(device), "%s",
+		strcpy(acpi_device_name(device),
 			ACPI_BUTTON_DEVICE_NAME_SLEEPF);
 		sprintf(acpi_device_class(device), "%s/%s", 
 			ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
 	}
 	else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) {
 		button->type = ACPI_BUTTON_TYPE_LID;
-		sprintf(acpi_device_name(device), "%s",
+		strcpy(acpi_device_name(device),
 			ACPI_BUTTON_DEVICE_NAME_LID);
 		sprintf(acpi_device_class(device), "%s/%s", 
 			ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID);
diff -puN drivers/acpi/ec.c~gcc-34-compilation-fixes drivers/acpi/ec.c
--- 25/drivers/acpi/ec.c~gcc-34-compilation-fixes	2004-01-17 15:10:38.000000000 -0800
+++ 25-akpm/drivers/acpi/ec.c	2004-01-17 15:10:38.000000000 -0800
@@ -578,8 +578,8 @@ acpi_ec_add (
 	ec->handle = device->handle;
 	ec->uid = -1;
 	ec->lock = SPIN_LOCK_UNLOCKED;
-	sprintf(acpi_device_name(device), "%s", ACPI_EC_DEVICE_NAME);
-	sprintf(acpi_device_class(device), "%s", ACPI_EC_CLASS);
+	strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);
+	strcpy(acpi_device_class(device), ACPI_EC_CLASS);
 	acpi_driver_data(device) = ec;
 
 	/* Use the global lock for all EC transactions? */
diff -puN drivers/acpi/fan.c~gcc-34-compilation-fixes drivers/acpi/fan.c
--- 25/drivers/acpi/fan.c~gcc-34-compilation-fixes	2004-01-17 15:10:38.000000000 -0800
+++ 25-akpm/drivers/acpi/fan.c	2004-01-17 15:10:38.000000000 -0800
@@ -214,8 +214,8 @@ acpi_fan_add (
 	memset(fan, 0, sizeof(struct acpi_fan));
 
 	fan->handle = device->handle;
-	sprintf(acpi_device_name(device), "%s", ACPI_FAN_DEVICE_NAME);
-	sprintf(acpi_device_class(device), "%s", ACPI_FAN_CLASS);
+	strcpy(acpi_device_name(device), ACPI_FAN_DEVICE_NAME);
+	strcpy(acpi_device_class(device), ACPI_FAN_CLASS);
 	acpi_driver_data(device) = fan;
 
 	result = acpi_bus_get_power(fan->handle, &state);
diff -puN drivers/acpi/pci_link.c~gcc-34-compilation-fixes drivers/acpi/pci_link.c
--- 25/drivers/acpi/pci_link.c~gcc-34-compilation-fixes	2004-01-17 15:10:38.000000000 -0800
+++ 25-akpm/drivers/acpi/pci_link.c	2004-01-17 15:10:38.000000000 -0800
@@ -652,8 +652,8 @@ acpi_pci_link_add (
 
 	link->device = device;
 	link->handle = device->handle;
-	sprintf(acpi_device_name(device), "%s", ACPI_PCI_LINK_DEVICE_NAME);
-	sprintf(acpi_device_class(device), "%s", ACPI_PCI_LINK_CLASS);
+	strcpy(acpi_device_name(device), ACPI_PCI_LINK_DEVICE_NAME);
+	strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS);
 	acpi_driver_data(device) = link;
 
 	result = acpi_pci_link_get_possible(link);
diff -puN drivers/acpi/pci_root.c~gcc-34-compilation-fixes drivers/acpi/pci_root.c
--- 25/drivers/acpi/pci_root.c~gcc-34-compilation-fixes	2004-01-17 15:10:38.000000000 -0800
+++ 25-akpm/drivers/acpi/pci_root.c	2004-01-17 15:10:38.000000000 -0800
@@ -134,8 +134,8 @@ acpi_pci_root_add (
 	memset(root, 0, sizeof(struct acpi_pci_root));
 
 	root->handle = device->handle;
-	sprintf(acpi_device_name(device), "%s", ACPI_PCI_ROOT_DEVICE_NAME);
-	sprintf(acpi_device_class(device), "%s", ACPI_PCI_ROOT_CLASS);
+	strcpy(acpi_device_name(device), ACPI_PCI_ROOT_DEVICE_NAME);
+	strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS);
 	acpi_driver_data(device) = root;
 
 	/*
diff -puN drivers/acpi/power.c~gcc-34-compilation-fixes drivers/acpi/power.c
--- 25/drivers/acpi/power.c~gcc-34-compilation-fixes	2004-01-17 15:10:38.000000000 -0800
+++ 25-akpm/drivers/acpi/power.c	2004-01-17 15:10:38.000000000 -0800
@@ -503,9 +503,9 @@ acpi_power_add (
 	memset(resource, 0, sizeof(struct acpi_power_resource));
 
 	resource->handle = device->handle;
-	sprintf(resource->name, "%s", device->pnp.bus_id);
-	sprintf(acpi_device_name(device), "%s", ACPI_POWER_DEVICE_NAME);
-	sprintf(acpi_device_class(device), "%s", ACPI_POWER_CLASS);
+	strcpy(resource->name, device->pnp.bus_id);
+	strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME);
+	strcpy(acpi_device_class(device), ACPI_POWER_CLASS);
 	acpi_driver_data(device) = resource;
 
 	/* Evalute the object to get the system level and resource order. */
diff -puN drivers/acpi/processor.c~gcc-34-compilation-fixes drivers/acpi/processor.c
--- 25/drivers/acpi/processor.c~gcc-34-compilation-fixes	2004-01-17 15:10:38.000000000 -0800
+++ 25-akpm/drivers/acpi/processor.c	2004-01-17 15:10:38.000000000 -0800
@@ -1705,8 +1705,8 @@ acpi_processor_add (
 	memset(pr, 0, sizeof(struct acpi_processor));
 
 	pr->handle = device->handle;
-	sprintf(acpi_device_name(device), "%s", ACPI_PROCESSOR_DEVICE_NAME);
-	sprintf(acpi_device_class(device), "%s", ACPI_PROCESSOR_CLASS);
+	strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME);
+	strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS);
 	acpi_driver_data(device) = pr;
 
 	result = acpi_processor_get_info(pr);
diff -puN drivers/acpi/scan.c~gcc-34-compilation-fixes drivers/acpi/scan.c
--- 25/drivers/acpi/scan.c~gcc-34-compilation-fixes	2004-01-17 15:10:38.000000000 -0800
+++ 25-akpm/drivers/acpi/scan.c	2004-01-17 15:10:38.000000000 -0800
@@ -486,13 +486,13 @@ static void acpi_device_get_busid(struct
 	 */
 	switch (type) {
 	case ACPI_BUS_TYPE_SYSTEM:
-		sprintf(device->pnp.bus_id, "%s", "ACPI");
+		strcpy(device->pnp.bus_id, "ACPI");
 		break;
 	case ACPI_BUS_TYPE_POWER_BUTTON:
-		sprintf(device->pnp.bus_id, "%s", "PWRF");
+		strcpy(device->pnp.bus_id, "PWRF");
 		break;
 	case ACPI_BUS_TYPE_SLEEP_BUTTON:
-		sprintf(device->pnp.bus_id, "%s", "SLPF");
+		strcpy(device->pnp.bus_id, "SLPF");
 		break;
 	default:
 		acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer);
@@ -503,7 +503,7 @@ static void acpi_device_get_busid(struct
 			else
 				break;
 		}
-		sprintf(device->pnp.bus_id, "%s", bus_id);
+		strcpy(device->pnp.bus_id, bus_id);
 		break;
 	}
 }
@@ -565,16 +565,16 @@ static void acpi_device_set_id(struct ac
 	 */
 	if ((parent == ACPI_ROOT_OBJECT) && (type == ACPI_BUS_TYPE_DEVICE)) {
 		hid = ACPI_BUS_HID;
-		sprintf(device->pnp.device_name, "%s", ACPI_BUS_DEVICE_NAME);
-		sprintf(device->pnp.device_class, "%s", ACPI_BUS_CLASS);
+		strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME);
+		strcpy(device->pnp.device_class, ACPI_BUS_CLASS);
 	}
 
 	if (hid) {
-		sprintf(device->pnp.hardware_id, "%s", hid);
+		strcpy(device->pnp.hardware_id, hid);
 		device->flags.hardware_id = 1;
 	}
 	if (uid) {
-		sprintf(device->pnp.unique_id, "%s", uid);
+		strcpy(device->pnp.unique_id, uid);
 		device->flags.unique_id = 1;
 	}
 	if (cid_list) {
diff -puN drivers/acpi/thermal.c~gcc-34-compilation-fixes drivers/acpi/thermal.c
--- 25/drivers/acpi/thermal.c~gcc-34-compilation-fixes	2004-01-17 15:10:38.000000000 -0800
+++ 25-akpm/drivers/acpi/thermal.c	2004-01-17 15:10:38.000000000 -0800
@@ -1246,9 +1246,9 @@ acpi_thermal_add (
 	memset(tz, 0, sizeof(struct acpi_thermal));
 
 	tz->handle = device->handle;
-	sprintf(tz->name, "%s", device->pnp.bus_id);
-	sprintf(acpi_device_name(device), "%s", ACPI_THERMAL_DEVICE_NAME);
-	sprintf(acpi_device_class(device), "%s", ACPI_THERMAL_CLASS);
+	strcpy(tz->name, device->pnp.bus_id);
+	strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME);
+	strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS);
 	acpi_driver_data(device) = tz;
 
 	result = acpi_thermal_get_info(tz);
diff -puN fs/reiserfs/prints.c~gcc-34-compilation-fixes fs/reiserfs/prints.c
--- 25/fs/reiserfs/prints.c~gcc-34-compilation-fixes	2004-01-17 15:10:38.000000000 -0800
+++ 25-akpm/fs/reiserfs/prints.c	2004-01-17 15:10:38.000000000 -0800
@@ -110,7 +110,7 @@ static void sprintf_de_head( char *buf, 
 static void sprintf_item_head (char * buf, struct item_head * ih)
 {
     if (ih) {
-	sprintf (buf, "%s", (ih_version (ih) == KEY_FORMAT_3_6) ? "*3.6* " : "*3.5*");
+	strcpy (buf, (ih_version (ih) == KEY_FORMAT_3_6) ? "*3.6* " : "*3.5*");
 	sprintf_le_key (buf + strlen (buf), &(ih->ih_key));
 	sprintf (buf + strlen (buf), ", item_len %d, item_location %d, "
 		 "free_space(entry_count) %d",

_