diff options
author | Pavel Machek <pavel@suse.cz> | 2008-09-22 17:37:34 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-10-10 18:05:53 -0400 |
commit | db89b4f0dbab837d0f3de2c3e9427a8d5393afa3 (patch) | |
tree | e664a0af46cb02d91c699015268d4fa10a6ce190 /drivers/acpi | |
parent | 9e113e0014204bfb44a2baa29b2a141ede41b074 (diff) |
ACPI: catch calls of acpi_driver_data on pointer of wrong type
Catch attempts to use of acpi_driver_data on pointers of wrong type.
akpm: rewritten to use proper C typechecking and remove the
"function"-used-as-lvalue thing.
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/ac.c | 2 | ||||
-rw-r--r-- | drivers/acpi/acpi_memhotplug.c | 2 | ||||
-rw-r--r-- | drivers/acpi/asus_acpi.c | 2 | ||||
-rw-r--r-- | drivers/acpi/battery.c | 2 | ||||
-rw-r--r-- | drivers/acpi/button.c | 2 | ||||
-rw-r--r-- | drivers/acpi/container.c | 2 | ||||
-rw-r--r-- | drivers/acpi/ec.c | 4 | ||||
-rw-r--r-- | drivers/acpi/fan.c | 2 | ||||
-rw-r--r-- | drivers/acpi/pci_link.c | 2 | ||||
-rw-r--r-- | drivers/acpi/pci_root.c | 2 | ||||
-rw-r--r-- | drivers/acpi/power.c | 4 | ||||
-rw-r--r-- | drivers/acpi/processor_core.c | 2 | ||||
-rw-r--r-- | drivers/acpi/sbs.c | 2 | ||||
-rw-r--r-- | drivers/acpi/sbshc.c | 4 | ||||
-rw-r--r-- | drivers/acpi/scan.c | 4 | ||||
-rw-r--r-- | drivers/acpi/thermal.c | 2 | ||||
-rw-r--r-- | drivers/acpi/video.c | 6 |
17 files changed, 23 insertions, 23 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 831883b7d6c9..8b6a84a43b15 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -269,7 +269,7 @@ static int acpi_ac_add(struct acpi_device *device) | |||
269 | ac->device = device; | 269 | ac->device = device; |
270 | strcpy(acpi_device_name(device), ACPI_AC_DEVICE_NAME); | 270 | strcpy(acpi_device_name(device), ACPI_AC_DEVICE_NAME); |
271 | strcpy(acpi_device_class(device), ACPI_AC_CLASS); | 271 | strcpy(acpi_device_class(device), ACPI_AC_CLASS); |
272 | acpi_driver_data(device) = ac; | 272 | device->driver_data = ac; |
273 | 273 | ||
274 | result = acpi_ac_get_state(ac); | 274 | result = acpi_ac_get_state(ac); |
275 | if (result) | 275 | if (result) |
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 5f1127ad5a95..afd955fc0dc2 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c | |||
@@ -403,7 +403,7 @@ static int acpi_memory_device_add(struct acpi_device *device) | |||
403 | mem_device->device = device; | 403 | mem_device->device = device; |
404 | sprintf(acpi_device_name(device), "%s", ACPI_MEMORY_DEVICE_NAME); | 404 | sprintf(acpi_device_name(device), "%s", ACPI_MEMORY_DEVICE_NAME); |
405 | sprintf(acpi_device_class(device), "%s", ACPI_MEMORY_DEVICE_CLASS); | 405 | sprintf(acpi_device_class(device), "%s", ACPI_MEMORY_DEVICE_CLASS); |
406 | acpi_driver_data(device) = mem_device; | 406 | device->driver_data = mem_device; |
407 | 407 | ||
408 | /* Get the range from the _CRS */ | 408 | /* Get the range from the _CRS */ |
409 | result = acpi_memory_get_device_resources(mem_device); | 409 | result = acpi_memory_get_device_resources(mem_device); |
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index d3d0886d637f..91571fc0f17d 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c | |||
@@ -1321,7 +1321,7 @@ static int asus_hotk_add(struct acpi_device *device) | |||
1321 | hotk->handle = device->handle; | 1321 | hotk->handle = device->handle; |
1322 | strcpy(acpi_device_name(device), ACPI_HOTK_DEVICE_NAME); | 1322 | strcpy(acpi_device_name(device), ACPI_HOTK_DEVICE_NAME); |
1323 | strcpy(acpi_device_class(device), ACPI_HOTK_CLASS); | 1323 | strcpy(acpi_device_class(device), ACPI_HOTK_CLASS); |
1324 | acpi_driver_data(device) = hotk; | 1324 | device->driver_data = hotk; |
1325 | hotk->device = device; | 1325 | hotk->device = device; |
1326 | 1326 | ||
1327 | result = asus_hotk_check(); | 1327 | result = asus_hotk_check(); |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index b1c723f9f58d..de8046933bce 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -804,7 +804,7 @@ static int acpi_battery_add(struct acpi_device *device) | |||
804 | battery->device = device; | 804 | battery->device = device; |
805 | strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); | 805 | strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); |
806 | strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); | 806 | strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); |
807 | acpi_driver_data(device) = battery; | 807 | device->driver_data = battery; |
808 | mutex_init(&battery->lock); | 808 | mutex_init(&battery->lock); |
809 | acpi_battery_update(battery); | 809 | acpi_battery_update(battery); |
810 | #ifdef CONFIG_ACPI_PROCFS_POWER | 810 | #ifdef CONFIG_ACPI_PROCFS_POWER |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 1dfec413588c..e22033ea2614 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -384,7 +384,7 @@ static int acpi_button_add(struct acpi_device *device) | |||
384 | return -ENOMEM; | 384 | return -ENOMEM; |
385 | 385 | ||
386 | button->device = device; | 386 | button->device = device; |
387 | acpi_driver_data(device) = button; | 387 | device->driver_data = button; |
388 | 388 | ||
389 | button->input = input = input_allocate_device(); | 389 | button->input = input = input_allocate_device(); |
390 | if (!input) { | 390 | if (!input) { |
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 3c25ec7a1871..03ea8478e393 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c | |||
@@ -108,7 +108,7 @@ static int acpi_container_add(struct acpi_device *device) | |||
108 | container->handle = device->handle; | 108 | container->handle = device->handle; |
109 | strcpy(acpi_device_name(device), ACPI_CONTAINER_DEVICE_NAME); | 109 | strcpy(acpi_device_name(device), ACPI_CONTAINER_DEVICE_NAME); |
110 | strcpy(acpi_device_class(device), ACPI_CONTAINER_CLASS); | 110 | strcpy(acpi_device_class(device), ACPI_CONTAINER_CLASS); |
111 | acpi_driver_data(device) = container; | 111 | device->driver_data = container; |
112 | 112 | ||
113 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n", | 113 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n", |
114 | acpi_device_name(device), acpi_device_bid(device))); | 114 | acpi_device_name(device), acpi_device_bid(device))); |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 13593f9f2197..5741d99d6034 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -788,7 +788,7 @@ static int acpi_ec_add(struct acpi_device *device) | |||
788 | 788 | ||
789 | if (!first_ec) | 789 | if (!first_ec) |
790 | first_ec = ec; | 790 | first_ec = ec; |
791 | acpi_driver_data(device) = ec; | 791 | device->driver_data = ec; |
792 | acpi_ec_add_fs(device); | 792 | acpi_ec_add_fs(device); |
793 | pr_info(PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n", | 793 | pr_info(PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n", |
794 | ec->gpe, ec->command_addr, ec->data_addr); | 794 | ec->gpe, ec->command_addr, ec->data_addr); |
@@ -813,7 +813,7 @@ static int acpi_ec_remove(struct acpi_device *device, int type) | |||
813 | } | 813 | } |
814 | mutex_unlock(&ec->lock); | 814 | mutex_unlock(&ec->lock); |
815 | acpi_ec_remove_fs(device); | 815 | acpi_ec_remove_fs(device); |
816 | acpi_driver_data(device) = NULL; | 816 | device->driver_data = NULL; |
817 | if (ec == first_ec) | 817 | if (ec == first_ec) |
818 | first_ec = NULL; | 818 | first_ec = NULL; |
819 | kfree(ec); | 819 | kfree(ec); |
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 2655bc1b4eeb..e603e4070702 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -265,7 +265,7 @@ static int acpi_fan_add(struct acpi_device *device) | |||
265 | 265 | ||
266 | dev_info(&device->dev, "registered as cooling_device%d\n", cdev->id); | 266 | dev_info(&device->dev, "registered as cooling_device%d\n", cdev->id); |
267 | 267 | ||
268 | acpi_driver_data(device) = cdev; | 268 | device->driver_data = cdev; |
269 | result = sysfs_create_link(&device->dev.kobj, | 269 | result = sysfs_create_link(&device->dev.kobj, |
270 | &cdev->device.kobj, | 270 | &cdev->device.kobj, |
271 | "thermal_cooling"); | 271 | "thermal_cooling"); |
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index cf47805a7448..54cd77a0a78e 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
@@ -737,7 +737,7 @@ static int acpi_pci_link_add(struct acpi_device *device) | |||
737 | link->device = device; | 737 | link->device = device; |
738 | strcpy(acpi_device_name(device), ACPI_PCI_LINK_DEVICE_NAME); | 738 | strcpy(acpi_device_name(device), ACPI_PCI_LINK_DEVICE_NAME); |
739 | strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS); | 739 | strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS); |
740 | acpi_driver_data(device) = link; | 740 | device->driver_data = link; |
741 | 741 | ||
742 | mutex_lock(&acpi_link_lock); | 742 | mutex_lock(&acpi_link_lock); |
743 | result = acpi_pci_link_get_possible(link); | 743 | result = acpi_pci_link_get_possible(link); |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index c3fed31166b5..add1a19bbbfe 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -206,7 +206,7 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device) | |||
206 | root->device = device; | 206 | root->device = device; |
207 | strcpy(acpi_device_name(device), ACPI_PCI_ROOT_DEVICE_NAME); | 207 | strcpy(acpi_device_name(device), ACPI_PCI_ROOT_DEVICE_NAME); |
208 | strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS); | 208 | strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS); |
209 | acpi_driver_data(device) = root; | 209 | device->driver_data = root; |
210 | 210 | ||
211 | device->ops.bind = acpi_pci_bind; | 211 | device->ops.bind = acpi_pci_bind; |
212 | 212 | ||
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 4ab21cb1c8c7..1bef9429189b 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -657,7 +657,7 @@ static int acpi_power_add(struct acpi_device *device) | |||
657 | strcpy(resource->name, device->pnp.bus_id); | 657 | strcpy(resource->name, device->pnp.bus_id); |
658 | strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); | 658 | strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); |
659 | strcpy(acpi_device_class(device), ACPI_POWER_CLASS); | 659 | strcpy(acpi_device_class(device), ACPI_POWER_CLASS); |
660 | acpi_driver_data(device) = resource; | 660 | device->driver_data = resource; |
661 | 661 | ||
662 | /* Evalute the object to get the system level and resource order. */ | 662 | /* Evalute the object to get the system level and resource order. */ |
663 | status = acpi_evaluate_object(device->handle, NULL, NULL, &buffer); | 663 | status = acpi_evaluate_object(device->handle, NULL, NULL, &buffer); |
@@ -733,7 +733,7 @@ static int acpi_power_resume(struct acpi_device *device) | |||
733 | if (!device || !acpi_driver_data(device)) | 733 | if (!device || !acpi_driver_data(device)) |
734 | return -EINVAL; | 734 | return -EINVAL; |
735 | 735 | ||
736 | resource = (struct acpi_power_resource *)acpi_driver_data(device); | 736 | resource = acpi_driver_data(device); |
737 | 737 | ||
738 | result = acpi_power_get_state(resource, &state); | 738 | result = acpi_power_get_state(resource, &state); |
739 | if (result) | 739 | if (result) |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index ee68ac54c0d4..289461649196 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -818,7 +818,7 @@ static int acpi_processor_add(struct acpi_device *device) | |||
818 | pr->handle = device->handle; | 818 | pr->handle = device->handle; |
819 | strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME); | 819 | strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME); |
820 | strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS); | 820 | strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS); |
821 | acpi_driver_data(device) = pr; | 821 | device->driver_data = pr; |
822 | 822 | ||
823 | return 0; | 823 | return 0; |
824 | } | 824 | } |
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 10a36512647c..d0033250b5a9 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -931,7 +931,7 @@ static int acpi_sbs_add(struct acpi_device *device) | |||
931 | sbs->device = device; | 931 | sbs->device = device; |
932 | strcpy(acpi_device_name(device), ACPI_SBS_DEVICE_NAME); | 932 | strcpy(acpi_device_name(device), ACPI_SBS_DEVICE_NAME); |
933 | strcpy(acpi_device_class(device), ACPI_SBS_CLASS); | 933 | strcpy(acpi_device_class(device), ACPI_SBS_CLASS); |
934 | acpi_driver_data(device) = sbs; | 934 | device->driver_data = sbs; |
935 | 935 | ||
936 | result = acpi_charger_add(sbs); | 936 | result = acpi_charger_add(sbs); |
937 | if (result) | 937 | if (result) |
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c index a4e3767b8c64..001d9143a2cb 100644 --- a/drivers/acpi/sbshc.c +++ b/drivers/acpi/sbshc.c | |||
@@ -282,7 +282,7 @@ static int acpi_smbus_hc_add(struct acpi_device *device) | |||
282 | hc->ec = acpi_driver_data(device->parent); | 282 | hc->ec = acpi_driver_data(device->parent); |
283 | hc->offset = (val >> 8) & 0xff; | 283 | hc->offset = (val >> 8) & 0xff; |
284 | hc->query_bit = val & 0xff; | 284 | hc->query_bit = val & 0xff; |
285 | acpi_driver_data(device) = hc; | 285 | device->driver_data = hc; |
286 | 286 | ||
287 | acpi_ec_add_query_handler(hc->ec, hc->query_bit, NULL, smbus_alarm, hc); | 287 | acpi_ec_add_query_handler(hc->ec, hc->query_bit, NULL, smbus_alarm, hc); |
288 | printk(KERN_INFO PREFIX "SBS HC: EC = 0x%p, offset = 0x%0x, query_bit = 0x%0x\n", | 288 | printk(KERN_INFO PREFIX "SBS HC: EC = 0x%p, offset = 0x%0x, query_bit = 0x%0x\n", |
@@ -303,7 +303,7 @@ static int acpi_smbus_hc_remove(struct acpi_device *device, int type) | |||
303 | hc = acpi_driver_data(device); | 303 | hc = acpi_driver_data(device); |
304 | acpi_ec_remove_query_handler(hc->ec, hc->query_bit); | 304 | acpi_ec_remove_query_handler(hc->ec, hc->query_bit); |
305 | kfree(hc); | 305 | kfree(hc); |
306 | acpi_driver_data(device) = NULL; | 306 | device->driver_data = NULL; |
307 | return 0; | 307 | return 0; |
308 | } | 308 | } |
309 | 309 | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index e7b8853c310b..b88536ab040a 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -384,7 +384,7 @@ static int acpi_device_remove(struct device * dev) | |||
384 | acpi_drv->ops.remove(acpi_dev, acpi_dev->removal_type); | 384 | acpi_drv->ops.remove(acpi_dev, acpi_dev->removal_type); |
385 | } | 385 | } |
386 | acpi_dev->driver = NULL; | 386 | acpi_dev->driver = NULL; |
387 | acpi_driver_data(acpi_dev) = NULL; | 387 | acpi_dev->driver_data = NULL; |
388 | 388 | ||
389 | put_device(dev); | 389 | put_device(dev); |
390 | return 0; | 390 | return 0; |
@@ -537,7 +537,7 @@ acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver) | |||
537 | result = driver->ops.add(device); | 537 | result = driver->ops.add(device); |
538 | if (result) { | 538 | if (result) { |
539 | device->driver = NULL; | 539 | device->driver = NULL; |
540 | acpi_driver_data(device) = NULL; | 540 | device->driver_data = NULL; |
541 | return result; | 541 | return result; |
542 | } | 542 | } |
543 | 543 | ||
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 912703691d36..e052a75c29ce 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -1647,7 +1647,7 @@ static int acpi_thermal_add(struct acpi_device *device) | |||
1647 | strcpy(tz->name, device->pnp.bus_id); | 1647 | strcpy(tz->name, device->pnp.bus_id); |
1648 | strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME); | 1648 | strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME); |
1649 | strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS); | 1649 | strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS); |
1650 | acpi_driver_data(device) = tz; | 1650 | device->driver_data = tz; |
1651 | mutex_init(&tz->lock); | 1651 | mutex_init(&tz->lock); |
1652 | 1652 | ||
1653 | 1653 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index e8a51a1700f7..85c6554bcb4c 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -1491,7 +1491,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
1491 | 1491 | ||
1492 | strcpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME); | 1492 | strcpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME); |
1493 | strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS); | 1493 | strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS); |
1494 | acpi_driver_data(device) = data; | 1494 | device->driver_data = data; |
1495 | 1495 | ||
1496 | data->device_id = device_id; | 1496 | data->device_id = device_id; |
1497 | data->video = video; | 1497 | data->video = video; |
@@ -1982,7 +1982,7 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1982 | video->device = device; | 1982 | video->device = device; |
1983 | strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME); | 1983 | strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME); |
1984 | strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS); | 1984 | strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS); |
1985 | acpi_driver_data(device) = video; | 1985 | device->driver_data = video; |
1986 | 1986 | ||
1987 | acpi_video_bus_find_cap(video); | 1987 | acpi_video_bus_find_cap(video); |
1988 | error = acpi_video_bus_check(video); | 1988 | error = acpi_video_bus_check(video); |
@@ -2058,7 +2058,7 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
2058 | acpi_video_bus_remove_fs(device); | 2058 | acpi_video_bus_remove_fs(device); |
2059 | err_free_video: | 2059 | err_free_video: |
2060 | kfree(video); | 2060 | kfree(video); |
2061 | acpi_driver_data(device) = NULL; | 2061 | device->driver_data = NULL; |
2062 | 2062 | ||
2063 | return error; | 2063 | return error; |
2064 | } | 2064 | } |