diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/bus.c | 25 | ||||
-rw-r--r-- | drivers/acpi/thermal.c | 11 |
2 files changed, 36 insertions, 0 deletions
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 1b4cf984b081..8df325dafe0f 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -122,6 +122,31 @@ int acpi_bus_get_status(struct acpi_device *device) | |||
122 | 122 | ||
123 | EXPORT_SYMBOL(acpi_bus_get_status); | 123 | EXPORT_SYMBOL(acpi_bus_get_status); |
124 | 124 | ||
125 | void acpi_bus_private_data_handler(acpi_handle handle, | ||
126 | u32 function, void *context) | ||
127 | { | ||
128 | return; | ||
129 | } | ||
130 | EXPORT_SYMBOL(acpi_bus_private_data_handler); | ||
131 | |||
132 | int acpi_bus_get_private_data(acpi_handle handle, void **data) | ||
133 | { | ||
134 | acpi_status status = AE_OK; | ||
135 | |||
136 | if (!*data) | ||
137 | return -EINVAL; | ||
138 | |||
139 | status = acpi_get_data(handle, acpi_bus_private_data_handler, data); | ||
140 | if (ACPI_FAILURE(status) || !*data) { | ||
141 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No context for object [%p]\n", | ||
142 | handle)); | ||
143 | return -ENODEV; | ||
144 | } | ||
145 | |||
146 | return 0; | ||
147 | } | ||
148 | EXPORT_SYMBOL(acpi_bus_get_private_data); | ||
149 | |||
125 | /* -------------------------------------------------------------------------- | 150 | /* -------------------------------------------------------------------------- |
126 | Power Management | 151 | Power Management |
127 | -------------------------------------------------------------------------- */ | 152 | -------------------------------------------------------------------------- */ |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index d317da5c6e9c..740036355722 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -1101,6 +1101,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) | |||
1101 | { | 1101 | { |
1102 | int trips = 0; | 1102 | int trips = 0; |
1103 | int result; | 1103 | int result; |
1104 | acpi_status status; | ||
1104 | int i; | 1105 | int i; |
1105 | 1106 | ||
1106 | if (tz->trips.critical.flags.valid) | 1107 | if (tz->trips.critical.flags.valid) |
@@ -1129,6 +1130,15 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) | |||
1129 | if (result) | 1130 | if (result) |
1130 | return result; | 1131 | return result; |
1131 | 1132 | ||
1133 | status = acpi_attach_data(tz->device->handle, | ||
1134 | acpi_bus_private_data_handler, | ||
1135 | tz->thermal_zone); | ||
1136 | if (ACPI_FAILURE(status)) { | ||
1137 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
1138 | "Error attaching device data\n")); | ||
1139 | return -ENODEV; | ||
1140 | } | ||
1141 | |||
1132 | tz->tz_enabled = 1; | 1142 | tz->tz_enabled = 1; |
1133 | 1143 | ||
1134 | printk(KERN_INFO PREFIX "%s is registered as thermal_zone%d\n", | 1144 | printk(KERN_INFO PREFIX "%s is registered as thermal_zone%d\n", |
@@ -1142,6 +1152,7 @@ static void acpi_thermal_unregister_thermal_zone(struct acpi_thermal *tz) | |||
1142 | sysfs_remove_link(&tz->thermal_zone->device.kobj, "device"); | 1152 | sysfs_remove_link(&tz->thermal_zone->device.kobj, "device"); |
1143 | thermal_zone_device_unregister(tz->thermal_zone); | 1153 | thermal_zone_device_unregister(tz->thermal_zone); |
1144 | tz->thermal_zone = NULL; | 1154 | tz->thermal_zone = NULL; |
1155 | acpi_detach_data(tz->device->handle, acpi_bus_private_data_handler); | ||
1145 | } | 1156 | } |
1146 | 1157 | ||
1147 | 1158 | ||