Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 86118
b: refs/heads/master
c: cbb1484
h: refs/heads/master
v: v3
  • Loading branch information
Henrique de Moraes Holschuh authored and Len Brown committed Feb 16, 2008
1 parent 6931624 commit 4c93b2e
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 77 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 69f6b8dd6b94ac594b6920b4530a3390fb1d3fd6
refs/heads/master: cbb14842137ff78df10038da8ca8a97917a5a926
30 changes: 12 additions & 18 deletions trunk/drivers/acpi/fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
37 changes: 15 additions & 22 deletions trunk/drivers/acpi/processor_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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;

Expand Down
3 changes: 0 additions & 3 deletions trunk/drivers/acpi/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 4 additions & 7 deletions trunk/drivers/misc/intel_menlow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/misc/thinkpad_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
39 changes: 14 additions & 25 deletions trunk/drivers/thermal/thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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);
Expand All @@ -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 */
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -581,25 +570,25 @@ 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);
mutex_init(&tz->lock);
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);
Expand All @@ -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 */
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 4c93b2e

Please sign in to comment.