diff options
| -rw-r--r-- | drivers/acpi/thermal.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index e8c143caf0fd..0914eaa9a097 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
| @@ -98,6 +98,7 @@ MODULE_PARM_DESC(psv, "Disable or override all passive trip points."); | |||
| 98 | static int acpi_thermal_add(struct acpi_device *device); | 98 | static int acpi_thermal_add(struct acpi_device *device); |
| 99 | static int acpi_thermal_remove(struct acpi_device *device, int type); | 99 | static int acpi_thermal_remove(struct acpi_device *device, int type); |
| 100 | static int acpi_thermal_resume(struct acpi_device *device); | 100 | static int acpi_thermal_resume(struct acpi_device *device); |
| 101 | static void acpi_thermal_notify(struct acpi_device *device, u32 event); | ||
| 101 | static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); | 102 | static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); |
| 102 | static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); | 103 | static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); |
| 103 | static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); | 104 | static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); |
| @@ -123,6 +124,7 @@ static struct acpi_driver acpi_thermal_driver = { | |||
| 123 | .add = acpi_thermal_add, | 124 | .add = acpi_thermal_add, |
| 124 | .remove = acpi_thermal_remove, | 125 | .remove = acpi_thermal_remove, |
| 125 | .resume = acpi_thermal_resume, | 126 | .resume = acpi_thermal_resume, |
| 127 | .notify = acpi_thermal_notify, | ||
| 126 | }, | 128 | }, |
| 127 | }; | 129 | }; |
| 128 | 130 | ||
| @@ -1264,17 +1266,14 @@ static int acpi_thermal_remove_fs(struct acpi_device *device) | |||
| 1264 | Driver Interface | 1266 | Driver Interface |
| 1265 | -------------------------------------------------------------------------- */ | 1267 | -------------------------------------------------------------------------- */ |
| 1266 | 1268 | ||
| 1267 | static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) | 1269 | static void acpi_thermal_notify(struct acpi_device *device, u32 event) |
| 1268 | { | 1270 | { |
| 1269 | struct acpi_thermal *tz = data; | 1271 | struct acpi_thermal *tz = acpi_driver_data(device); |
| 1270 | struct acpi_device *device = NULL; | ||
| 1271 | 1272 | ||
| 1272 | 1273 | ||
| 1273 | if (!tz) | 1274 | if (!tz) |
| 1274 | return; | 1275 | return; |
| 1275 | 1276 | ||
| 1276 | device = tz->device; | ||
| 1277 | |||
| 1278 | switch (event) { | 1277 | switch (event) { |
| 1279 | case ACPI_THERMAL_NOTIFY_TEMPERATURE: | 1278 | case ACPI_THERMAL_NOTIFY_TEMPERATURE: |
| 1280 | acpi_thermal_check(tz); | 1279 | acpi_thermal_check(tz); |
| @@ -1298,8 +1297,6 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) | |||
| 1298 | "Unsupported event [0x%x]\n", event)); | 1297 | "Unsupported event [0x%x]\n", event)); |
| 1299 | break; | 1298 | break; |
| 1300 | } | 1299 | } |
| 1301 | |||
| 1302 | return; | ||
| 1303 | } | 1300 | } |
| 1304 | 1301 | ||
| 1305 | static int acpi_thermal_get_info(struct acpi_thermal *tz) | 1302 | static int acpi_thermal_get_info(struct acpi_thermal *tz) |
| @@ -1337,7 +1334,6 @@ static int acpi_thermal_get_info(struct acpi_thermal *tz) | |||
| 1337 | static int acpi_thermal_add(struct acpi_device *device) | 1334 | static int acpi_thermal_add(struct acpi_device *device) |
| 1338 | { | 1335 | { |
| 1339 | int result = 0; | 1336 | int result = 0; |
| 1340 | acpi_status status = AE_OK; | ||
| 1341 | struct acpi_thermal *tz = NULL; | 1337 | struct acpi_thermal *tz = NULL; |
| 1342 | 1338 | ||
| 1343 | 1339 | ||
| @@ -1368,21 +1364,11 @@ static int acpi_thermal_add(struct acpi_device *device) | |||
| 1368 | if (result) | 1364 | if (result) |
| 1369 | goto unregister_thermal_zone; | 1365 | goto unregister_thermal_zone; |
| 1370 | 1366 | ||
| 1371 | status = acpi_install_notify_handler(device->handle, | ||
| 1372 | ACPI_DEVICE_NOTIFY, | ||
| 1373 | acpi_thermal_notify, tz); | ||
| 1374 | if (ACPI_FAILURE(status)) { | ||
| 1375 | result = -ENODEV; | ||
| 1376 | goto remove_fs; | ||
| 1377 | } | ||
| 1378 | |||
| 1379 | printk(KERN_INFO PREFIX "%s [%s] (%ld C)\n", | 1367 | printk(KERN_INFO PREFIX "%s [%s] (%ld C)\n", |
| 1380 | acpi_device_name(device), acpi_device_bid(device), | 1368 | acpi_device_name(device), acpi_device_bid(device), |
| 1381 | KELVIN_TO_CELSIUS(tz->temperature)); | 1369 | KELVIN_TO_CELSIUS(tz->temperature)); |
| 1382 | goto end; | 1370 | goto end; |
| 1383 | 1371 | ||
| 1384 | remove_fs: | ||
| 1385 | acpi_thermal_remove_fs(device); | ||
| 1386 | unregister_thermal_zone: | 1372 | unregister_thermal_zone: |
| 1387 | thermal_zone_device_unregister(tz->thermal_zone); | 1373 | thermal_zone_device_unregister(tz->thermal_zone); |
| 1388 | free_memory: | 1374 | free_memory: |
| @@ -1393,7 +1379,6 @@ end: | |||
| 1393 | 1379 | ||
| 1394 | static int acpi_thermal_remove(struct acpi_device *device, int type) | 1380 | static int acpi_thermal_remove(struct acpi_device *device, int type) |
| 1395 | { | 1381 | { |
| 1396 | acpi_status status = AE_OK; | ||
| 1397 | struct acpi_thermal *tz = NULL; | 1382 | struct acpi_thermal *tz = NULL; |
| 1398 | 1383 | ||
| 1399 | if (!device || !acpi_driver_data(device)) | 1384 | if (!device || !acpi_driver_data(device)) |
| @@ -1401,10 +1386,6 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) | |||
| 1401 | 1386 | ||
| 1402 | tz = acpi_driver_data(device); | 1387 | tz = acpi_driver_data(device); |
| 1403 | 1388 | ||
| 1404 | status = acpi_remove_notify_handler(device->handle, | ||
| 1405 | ACPI_DEVICE_NOTIFY, | ||
| 1406 | acpi_thermal_notify); | ||
| 1407 | |||
| 1408 | acpi_thermal_remove_fs(device); | 1389 | acpi_thermal_remove_fs(device); |
| 1409 | acpi_thermal_unregister_thermal_zone(tz); | 1390 | acpi_thermal_unregister_thermal_zone(tz); |
| 1410 | mutex_destroy(&tz->lock); | 1391 | mutex_destroy(&tz->lock); |
