Commit 71efc910 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] More 3.4 compilation fixes

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.
parent b3f36a2a
......@@ -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);
......
......@@ -869,8 +869,8 @@ static int __init asus_hotk_add(struct acpi_device *device)
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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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? */
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
/*
......
......@@ -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. */
......
......@@ -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);
......
......@@ -486,13 +486,13 @@ static void acpi_device_get_busid(struct acpi_device * device, acpi_handle handl
*/
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 acpi_device * device, acpi_handle handl
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 acpi_device * device, struct acpi_device *
*/
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) {
......
......@@ -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);
......
......@@ -110,7 +110,7 @@ static void sprintf_de_head( char *buf, struct reiserfs_de_head *deh )
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",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment