From 71efc9104156892215aa6564fd5dbc8ac61e08b8 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 3 Feb 2004 18:34:24 -0800 Subject: [PATCH] [PATCH] More 3.4 compilation fixes From: Jan Hubicka 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 --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 5e662d741dd21..ae23bdf54371b 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c @@ -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 --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index a98b0c8ea671a..349581f250f43 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c @@ -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; diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index af01a902eee06..41e4316b22d2c 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -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 --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 4e0b3a935df7a..92d271af01c2c 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -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 --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 3d33c72614836..f5f7b0a02e0fb 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -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 --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index d566f0552aace..ee6419591a6f7 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -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 --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index e19add0030deb..63967329262a8 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c @@ -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 --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 5d87c28307c91..ffa316c1feb69 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -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 --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 943cbe17f8154..19e7099963959 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -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 --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 63e825ac06e24..f6f8fc121474f 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c @@ -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 --git a/drivers/acpi/processor.c b/drivers/acpi/processor.c index b472015bb9457..1b85aff25b964 100644 --- a/drivers/acpi/processor.c +++ b/drivers/acpi/processor.c @@ -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 --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 2166d127a5d59..aedb3aeae381d 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -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) { diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index a949f561489b2..3e048a2d37907 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -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 --git a/fs/reiserfs/prints.c b/fs/reiserfs/prints.c index 3a88a16caa7a7..862311f0365ec 100644 --- a/fs/reiserfs/prints.c +++ b/fs/reiserfs/prints.c @@ -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", -- 2.53.0