From 4c93b2e7b39d91098587c216a6ba7573e3424d26 Mon Sep 17 00:00:00 2001 From: Henrique de Moraes Holschuh Date: Sat, 16 Feb 2008 02:17:50 -0200 Subject: [PATCH] --- yaml --- r: 86118 b: refs/heads/master c: cbb14842137ff78df10038da8ca8a97917a5a926 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/acpi/fan.c | 30 +++++++++------------- trunk/drivers/acpi/processor_core.c | 37 +++++++++++---------------- trunk/drivers/acpi/video.c | 3 --- trunk/drivers/misc/intel_menlow.c | 11 +++----- trunk/drivers/misc/thinkpad_acpi.c | 2 +- trunk/drivers/thermal/thermal.c | 39 +++++++++++------------------ 7 files changed, 47 insertions(+), 77 deletions(-) diff --git a/[refs] b/[refs] index b2ace63911fd..5e77ac3cd4e5 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 69f6b8dd6b94ac594b6920b4530a3390fb1d3fd6 +refs/heads/master: cbb14842137ff78df10038da8ca8a97917a5a926 diff --git a/trunk/drivers/acpi/fan.c b/trunk/drivers/acpi/fan.c index c8e3cba423ef..48cb705b274a 100644 --- a/trunk/drivers/acpi/fan.c +++ b/trunk/drivers/acpi/fan.c @@ -256,28 +256,22 @@ static int acpi_fan_add(struct acpi_device *device) cdev = thermal_cooling_device_register("Fan", device, &fan_cooling_ops); - if (IS_ERR(cdev)) { - result = PTR_ERR(cdev); - goto end; - } - if (cdev) { + if (cdev) printk(KERN_INFO PREFIX "%s is registered as cooling_device%d\n", device->dev.bus_id, cdev->id); + else + goto end; + acpi_driver_data(device) = cdev; + result = sysfs_create_link(&device->dev.kobj, &cdev->device.kobj, + "thermal_cooling"); + if (result) + return result; - acpi_driver_data(device) = cdev; - result = sysfs_create_link(&device->dev.kobj, - &cdev->device.kobj, - "thermal_cooling"); - if (result) - return result; - - result = sysfs_create_link(&cdev->device.kobj, - &device->dev.kobj, - "device"); - if (result) - return result; - } + result = sysfs_create_link(&cdev->device.kobj, &device->dev.kobj, + "device"); + if (result) + return result; result = acpi_fan_add_fs(device); if (result) diff --git a/trunk/drivers/acpi/processor_core.c b/trunk/drivers/acpi/processor_core.c index b02006951cd0..75ccf5d18bf4 100644 --- a/trunk/drivers/acpi/processor_core.c +++ b/trunk/drivers/acpi/processor_core.c @@ -670,26 +670,21 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device) pr->cdev = thermal_cooling_device_register("Processor", device, &processor_cooling_ops); - if (IS_ERR(pr->cdev)) { - result = PTR_ERR(pr->cdev); - goto end; - } - if (pr->cdev) { + if (pr->cdev) printk(KERN_INFO PREFIX "%s is registered as cooling_device%d\n", device->dev.bus_id, pr->cdev->id); + else + goto end; - result = sysfs_create_link(&device->dev.kobj, - &pr->cdev->device.kobj, - "thermal_cooling"); - if (result) - return result; - result = sysfs_create_link(&pr->cdev->device.kobj, - &device->dev.kobj, - "device"); - if (result) - return result; - } + result = sysfs_create_link(&device->dev.kobj, &pr->cdev->device.kobj, + "thermal_cooling"); + if (result) + return result; + result = sysfs_create_link(&pr->cdev->device.kobj, &device->dev.kobj, + "device"); + if (result) + return result; if (pr->flags.throttling) { printk(KERN_INFO PREFIX "%s [%s] (supports", @@ -814,12 +809,10 @@ static int acpi_processor_remove(struct acpi_device *device, int type) acpi_processor_remove_fs(device); - if (pr->cdev) { - sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); - sysfs_remove_link(&pr->cdev->device.kobj, "device"); - thermal_cooling_device_unregister(pr->cdev); - pr->cdev = NULL; - } + sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); + sysfs_remove_link(&pr->cdev->device.kobj, "device"); + thermal_cooling_device_unregister(pr->cdev); + pr->cdev = NULL; processors[pr->id] = NULL; diff --git a/trunk/drivers/acpi/video.c b/trunk/drivers/acpi/video.c index 12cce69b5441..7f714fa2a454 100644 --- a/trunk/drivers/acpi/video.c +++ b/trunk/drivers/acpi/video.c @@ -731,9 +731,6 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) device->cdev = thermal_cooling_device_register("LCD", device->dev, &video_cooling_ops); - if (IS_ERR(device->cdev)) - return; - if (device->cdev) { printk(KERN_INFO PREFIX "%s is registered as cooling_device%d\n", diff --git a/trunk/drivers/misc/intel_menlow.c b/trunk/drivers/misc/intel_menlow.c index de16e88eb8d3..f70984ab1e1b 100644 --- a/trunk/drivers/misc/intel_menlow.c +++ b/trunk/drivers/misc/intel_menlow.c @@ -170,13 +170,10 @@ static int intel_menlow_memory_add(struct acpi_device *device) cdev = thermal_cooling_device_register("Memory controller", device, &memory_cooling_ops); - if (IS_ERR(cdev)) { - result = PTR_ERR(cdev); - goto end; - } - - if (cdev) { - acpi_driver_data(device) = cdev; + acpi_driver_data(device) = cdev; + if (!cdev) + result = -ENODEV; + else { result = sysfs_create_link(&device->dev.kobj, &cdev->device.kobj, "thermal_cooling"); if (result) diff --git a/trunk/drivers/misc/thinkpad_acpi.c b/trunk/drivers/misc/thinkpad_acpi.c index e2c7edd206a6..723d37b9e6a2 100644 --- a/trunk/drivers/misc/thinkpad_acpi.c +++ b/trunk/drivers/misc/thinkpad_acpi.c @@ -5918,7 +5918,7 @@ MODULE_PARM_DESC(hotkey_report_mode, #define TPACPI_PARAM(feature) \ module_param_call(feature, set_ibm_param, NULL, NULL, 0); \ - MODULE_PARM_DESC(feature, "Simulates thinkpad-aci procfs command " \ + MODULE_PARM_DESC(feature, "Simulates thinkpad-acpi procfs command " \ "at module load, see documentation") TPACPI_PARAM(hotkey); diff --git a/trunk/drivers/thermal/thermal.c b/trunk/drivers/thermal/thermal.c index 8b86e53ccf7a..e782b3e7fcdb 100644 --- a/trunk/drivers/thermal/thermal.c +++ b/trunk/drivers/thermal/thermal.c @@ -306,23 +306,12 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, { struct thermal_cooling_device_instance *dev; struct thermal_cooling_device_instance *pos; - struct thermal_zone_device *pos1; - struct thermal_cooling_device *pos2; int result; if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE)) return -EINVAL; - list_for_each_entry(pos1, &thermal_tz_list, node) { - if (pos1 == tz) - break; - } - list_for_each_entry(pos2, &thermal_cdev_list, node) { - if (pos2 == cdev) - break; - } - - if (tz != pos1 || cdev != pos2) + if (!tz || !cdev) return -EINVAL; dev = @@ -448,20 +437,20 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type, int result; if (strlen(type) >= THERMAL_NAME_LENGTH) - return ERR_PTR(-EINVAL); + return NULL; if (!ops || !ops->get_max_state || !ops->get_cur_state || !ops->set_cur_state) - return ERR_PTR(-EINVAL); + return NULL; cdev = kzalloc(sizeof(struct thermal_cooling_device), GFP_KERNEL); if (!cdev) - return ERR_PTR(-ENOMEM); + return NULL; result = get_idr(&thermal_cdev_idr, &thermal_idr_lock, &cdev->id); if (result) { kfree(cdev); - return ERR_PTR(result); + return NULL; } strcpy(cdev->type, type); @@ -473,7 +462,7 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type, if (result) { release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id); kfree(cdev); - return ERR_PTR(result); + return NULL; } /* sys I/F */ @@ -509,7 +498,7 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type, unregister: release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id); device_unregister(&cdev->device); - return ERR_PTR(result); + return NULL; } EXPORT_SYMBOL(thermal_cooling_device_register); @@ -581,17 +570,17 @@ struct thermal_zone_device *thermal_zone_device_register(char *type, int count; if (strlen(type) >= THERMAL_NAME_LENGTH) - return ERR_PTR(-EINVAL); + return NULL; if (trips > THERMAL_MAX_TRIPS || trips < 0) - return ERR_PTR(-EINVAL); + return NULL; if (!ops || !ops->get_temp) - return ERR_PTR(-EINVAL); + return NULL; tz = kzalloc(sizeof(struct thermal_zone_device), GFP_KERNEL); if (!tz) - return ERR_PTR(-ENOMEM); + return NULL; INIT_LIST_HEAD(&tz->cooling_devices); idr_init(&tz->idr); @@ -599,7 +588,7 @@ struct thermal_zone_device *thermal_zone_device_register(char *type, result = get_idr(&thermal_tz_idr, &thermal_idr_lock, &tz->id); if (result) { kfree(tz); - return ERR_PTR(result); + return NULL; } strcpy(tz->type, type); @@ -612,7 +601,7 @@ struct thermal_zone_device *thermal_zone_device_register(char *type, if (result) { release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); kfree(tz); - return ERR_PTR(result); + return NULL; } /* sys I/F */ @@ -654,7 +643,7 @@ struct thermal_zone_device *thermal_zone_device_register(char *type, unregister: release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); device_unregister(&tz->device); - return ERR_PTR(result); + return NULL; } EXPORT_SYMBOL(thermal_zone_device_register);