aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/ac.c1
-rw-r--r--drivers/acpi/acpica/tbxface.c17
-rw-r--r--drivers/acpi/battery.c1
-rw-r--r--drivers/acpi/button.c3
-rw-r--r--drivers/acpi/dock.c2
-rw-r--r--drivers/acpi/event.c6
-rw-r--r--drivers/acpi/fan.c2
-rw-r--r--drivers/acpi/osl.c13
-rw-r--r--drivers/acpi/pci_root.c180
-rw-r--r--drivers/acpi/processor_core.c2
-rw-r--r--drivers/acpi/processor_perflib.c4
-rw-r--r--drivers/acpi/sbs.c1
-rw-r--r--drivers/acpi/tables.c20
-rw-r--r--drivers/acpi/thermal.c4
-rw-r--r--drivers/acpi/video.c5
15 files changed, 221 insertions, 40 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 9b917dac7732..88e42abf5d88 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -191,7 +191,6 @@ static int acpi_ac_add_fs(struct acpi_device *device)
191 acpi_ac_dir); 191 acpi_ac_dir);
192 if (!acpi_device_dir(device)) 192 if (!acpi_device_dir(device))
193 return -ENODEV; 193 return -ENODEV;
194 acpi_device_dir(device)->owner = THIS_MODULE;
195 } 194 }
196 195
197 /* 'state' [R] */ 196 /* 'state' [R] */
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c
index dbca22651504..a88f02bd6c94 100644
--- a/drivers/acpi/acpica/tbxface.c
+++ b/drivers/acpi/acpica/tbxface.c
@@ -363,7 +363,7 @@ ACPI_EXPORT_SYMBOL(acpi_unload_table_id)
363 363
364/******************************************************************************* 364/*******************************************************************************
365 * 365 *
366 * FUNCTION: acpi_get_table 366 * FUNCTION: acpi_get_table_with_size
367 * 367 *
368 * PARAMETERS: Signature - ACPI signature of needed table 368 * PARAMETERS: Signature - ACPI signature of needed table
369 * Instance - Which instance (for SSDTs) 369 * Instance - Which instance (for SSDTs)
@@ -375,8 +375,9 @@ ACPI_EXPORT_SYMBOL(acpi_unload_table_id)
375 * 375 *
376 ******************************************************************************/ 376 ******************************************************************************/
377acpi_status 377acpi_status
378acpi_get_table(char *signature, 378acpi_get_table_with_size(char *signature,
379 u32 instance, struct acpi_table_header **out_table) 379 u32 instance, struct acpi_table_header **out_table,
380 acpi_size *tbl_size)
380{ 381{
381 u32 i; 382 u32 i;
382 u32 j; 383 u32 j;
@@ -405,6 +406,7 @@ acpi_get_table(char *signature,
405 acpi_tb_verify_table(&acpi_gbl_root_table_list.tables[i]); 406 acpi_tb_verify_table(&acpi_gbl_root_table_list.tables[i]);
406 if (ACPI_SUCCESS(status)) { 407 if (ACPI_SUCCESS(status)) {
407 *out_table = acpi_gbl_root_table_list.tables[i].pointer; 408 *out_table = acpi_gbl_root_table_list.tables[i].pointer;
409 *tbl_size = acpi_gbl_root_table_list.tables[i].length;
408 } 410 }
409 411
410 if (!acpi_gbl_permanent_mmap) { 412 if (!acpi_gbl_permanent_mmap) {
@@ -417,6 +419,15 @@ acpi_get_table(char *signature,
417 return (AE_NOT_FOUND); 419 return (AE_NOT_FOUND);
418} 420}
419 421
422acpi_status
423acpi_get_table(char *signature,
424 u32 instance, struct acpi_table_header **out_table)
425{
426 acpi_size tbl_size;
427
428 return acpi_get_table_with_size(signature,
429 instance, out_table, &tbl_size);
430}
420ACPI_EXPORT_SYMBOL(acpi_get_table) 431ACPI_EXPORT_SYMBOL(acpi_get_table)
421 432
422/******************************************************************************* 433/*******************************************************************************
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 2abc03668627..b0de6312919a 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -763,7 +763,6 @@ static int acpi_battery_add_fs(struct acpi_device *device)
763 acpi_battery_dir); 763 acpi_battery_dir);
764 if (!acpi_device_dir(device)) 764 if (!acpi_device_dir(device))
765 return -ENODEV; 765 return -ENODEV;
766 acpi_device_dir(device)->owner = THIS_MODULE;
767 } 766 }
768 767
769 for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) { 768 for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) {
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 171fd914f435..c2f06069dcd4 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -200,12 +200,10 @@ static int acpi_button_add_fs(struct acpi_device *device)
200 200
201 if (!entry) 201 if (!entry)
202 return -ENODEV; 202 return -ENODEV;
203 entry->owner = THIS_MODULE;
204 203
205 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry); 204 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry);
206 if (!acpi_device_dir(device)) 205 if (!acpi_device_dir(device))
207 return -ENODEV; 206 return -ENODEV;
208 acpi_device_dir(device)->owner = THIS_MODULE;
209 207
210 /* 'info' [R] */ 208 /* 'info' [R] */
211 entry = proc_create_data(ACPI_BUTTON_FILE_INFO, 209 entry = proc_create_data(ACPI_BUTTON_FILE_INFO,
@@ -522,7 +520,6 @@ static int __init acpi_button_init(void)
522 acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); 520 acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir);
523 if (!acpi_button_dir) 521 if (!acpi_button_dir)
524 return -ENODEV; 522 return -ENODEV;
525 acpi_button_dir->owner = THIS_MODULE;
526 result = acpi_bus_register_driver(&acpi_button_driver); 523 result = acpi_bus_register_driver(&acpi_button_driver);
527 if (result < 0) { 524 if (result < 0) {
528 remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); 525 remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 8f62fa01a9c7..efb959d6c8a9 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -977,7 +977,7 @@ static int dock_add(acpi_handle handle)
977 sizeof(struct dock_station *)); 977 sizeof(struct dock_station *));
978 978
979 /* we want the dock device to send uevents */ 979 /* we want the dock device to send uevents */
980 dock_device->dev.uevent_suppress = 0; 980 dev_set_uevent_suppress(&dock_device->dev, 0);
981 981
982 if (is_dock(handle)) 982 if (is_dock(handle))
983 dock_station->flags |= DOCK_IS_DOCK; 983 dock_station->flags |= DOCK_IS_DOCK;
diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c
index 0c24bd4d6562..aeb7e5fb4a04 100644
--- a/drivers/acpi/event.c
+++ b/drivers/acpi/event.c
@@ -235,11 +235,7 @@ int acpi_bus_generate_netlink_event(const char *device_class,
235 return result; 235 return result;
236 } 236 }
237 237
238 result = 238 genlmsg_multicast(skb, 0, acpi_event_mcgrp.id, GFP_ATOMIC);
239 genlmsg_multicast(skb, 0, acpi_event_mcgrp.id, GFP_ATOMIC);
240 if (result)
241 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
242 "Failed to send a Genetlink message!\n"));
243 return 0; 239 return 0;
244} 240}
245 241
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index ae41cf3cf4e5..53698ea08371 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -197,7 +197,6 @@ static int acpi_fan_add_fs(struct acpi_device *device)
197 acpi_fan_dir); 197 acpi_fan_dir);
198 if (!acpi_device_dir(device)) 198 if (!acpi_device_dir(device))
199 return -ENODEV; 199 return -ENODEV;
200 acpi_device_dir(device)->owner = THIS_MODULE;
201 } 200 }
202 201
203 /* 'status' [R/W] */ 202 /* 'status' [R/W] */
@@ -351,7 +350,6 @@ static int __init acpi_fan_init(void)
351 acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir); 350 acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir);
352 if (!acpi_fan_dir) 351 if (!acpi_fan_dir)
353 return -ENODEV; 352 return -ENODEV;
354 acpi_fan_dir->owner = THIS_MODULE;
355#endif 353#endif
356 354
357 result = acpi_bus_register_driver(&acpi_fan_driver); 355 result = acpi_bus_register_driver(&acpi_fan_driver);
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index f50ca1ea80c3..d59f08ecaf16 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -272,14 +272,21 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
272} 272}
273EXPORT_SYMBOL_GPL(acpi_os_map_memory); 273EXPORT_SYMBOL_GPL(acpi_os_map_memory);
274 274
275void acpi_os_unmap_memory(void __iomem * virt, acpi_size size) 275void __ref acpi_os_unmap_memory(void __iomem *virt, acpi_size size)
276{ 276{
277 if (acpi_gbl_permanent_mmap) { 277 if (acpi_gbl_permanent_mmap)
278 iounmap(virt); 278 iounmap(virt);
279 } 279 else
280 __acpi_unmap_table(virt, size);
280} 281}
281EXPORT_SYMBOL_GPL(acpi_os_unmap_memory); 282EXPORT_SYMBOL_GPL(acpi_os_unmap_memory);
282 283
284void __init early_acpi_os_unmap_memory(void __iomem *virt, acpi_size size)
285{
286 if (!acpi_gbl_permanent_mmap)
287 __acpi_unmap_table(virt, size);
288}
289
283#ifdef ACPI_FUTURE_USAGE 290#ifdef ACPI_FUTURE_USAGE
284acpi_status 291acpi_status
285acpi_os_get_physical_address(void *virt, acpi_physical_address * phys) 292acpi_os_get_physical_address(void *virt, acpi_physical_address * phys)
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 5b38a026d122..196f97d00956 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -66,11 +66,18 @@ struct acpi_pci_root {
66 struct acpi_device * device; 66 struct acpi_device * device;
67 struct acpi_pci_id id; 67 struct acpi_pci_id id;
68 struct pci_bus *bus; 68 struct pci_bus *bus;
69
70 u32 osc_support_set; /* _OSC state of support bits */
71 u32 osc_control_set; /* _OSC state of control bits */
72 u32 osc_control_qry; /* the latest _OSC query result */
73
74 u32 osc_queried:1; /* has _OSC control been queried? */
69}; 75};
70 76
71static LIST_HEAD(acpi_pci_roots); 77static LIST_HEAD(acpi_pci_roots);
72 78
73static struct acpi_pci_driver *sub_driver; 79static struct acpi_pci_driver *sub_driver;
80static DEFINE_MUTEX(osc_lock);
74 81
75int acpi_pci_register_driver(struct acpi_pci_driver *driver) 82int acpi_pci_register_driver(struct acpi_pci_driver *driver)
76{ 83{
@@ -185,6 +192,175 @@ static void acpi_pci_bridge_scan(struct acpi_device *device)
185 } 192 }
186} 193}
187 194
195static u8 OSC_UUID[16] = {0x5B, 0x4D, 0xDB, 0x33, 0xF7, 0x1F, 0x1C, 0x40,
196 0x96, 0x57, 0x74, 0x41, 0xC0, 0x3D, 0xD7, 0x66};
197
198static acpi_status acpi_pci_run_osc(acpi_handle handle,
199 const u32 *capbuf, u32 *retval)
200{
201 acpi_status status;
202 struct acpi_object_list input;
203 union acpi_object in_params[4];
204 struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
205 union acpi_object *out_obj;
206 u32 errors;
207
208 /* Setting up input parameters */
209 input.count = 4;
210 input.pointer = in_params;
211 in_params[0].type = ACPI_TYPE_BUFFER;
212 in_params[0].buffer.length = 16;
213 in_params[0].buffer.pointer = OSC_UUID;
214 in_params[1].type = ACPI_TYPE_INTEGER;
215 in_params[1].integer.value = 1;
216 in_params[2].type = ACPI_TYPE_INTEGER;
217 in_params[2].integer.value = 3;
218 in_params[3].type = ACPI_TYPE_BUFFER;
219 in_params[3].buffer.length = 12;
220 in_params[3].buffer.pointer = (u8 *)capbuf;
221
222 status = acpi_evaluate_object(handle, "_OSC", &input, &output);
223 if (ACPI_FAILURE(status))
224 return status;
225
226 if (!output.length)
227 return AE_NULL_OBJECT;
228
229 out_obj = output.pointer;
230 if (out_obj->type != ACPI_TYPE_BUFFER) {
231 printk(KERN_DEBUG "_OSC evaluation returned wrong type\n");
232 status = AE_TYPE;
233 goto out_kfree;
234 }
235 /* Need to ignore the bit0 in result code */
236 errors = *((u32 *)out_obj->buffer.pointer) & ~(1 << 0);
237 if (errors) {
238 if (errors & OSC_REQUEST_ERROR)
239 printk(KERN_DEBUG "_OSC request failed\n");
240 if (errors & OSC_INVALID_UUID_ERROR)
241 printk(KERN_DEBUG "_OSC invalid UUID\n");
242 if (errors & OSC_INVALID_REVISION_ERROR)
243 printk(KERN_DEBUG "_OSC invalid revision\n");
244 if (errors & OSC_CAPABILITIES_MASK_ERROR) {
245 if (capbuf[OSC_QUERY_TYPE] & OSC_QUERY_ENABLE)
246 goto out_success;
247 printk(KERN_DEBUG
248 "Firmware did not grant requested _OSC control\n");
249 status = AE_SUPPORT;
250 goto out_kfree;
251 }
252 status = AE_ERROR;
253 goto out_kfree;
254 }
255out_success:
256 *retval = *((u32 *)(out_obj->buffer.pointer + 8));
257 status = AE_OK;
258
259out_kfree:
260 kfree(output.pointer);
261 return status;
262}
263
264static acpi_status acpi_pci_query_osc(struct acpi_pci_root *root, u32 flags)
265{
266 acpi_status status;
267 u32 support_set, result, capbuf[3];
268
269 /* do _OSC query for all possible controls */
270 support_set = root->osc_support_set | (flags & OSC_SUPPORT_MASKS);
271 capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE;
272 capbuf[OSC_SUPPORT_TYPE] = support_set;
273 capbuf[OSC_CONTROL_TYPE] = OSC_CONTROL_MASKS;
274
275 status = acpi_pci_run_osc(root->device->handle, capbuf, &result);
276 if (ACPI_SUCCESS(status)) {
277 root->osc_support_set = support_set;
278 root->osc_control_qry = result;
279 root->osc_queried = 1;
280 }
281 return status;
282}
283
284static acpi_status acpi_pci_osc_support(struct acpi_pci_root *root, u32 flags)
285{
286 acpi_status status;
287 acpi_handle tmp;
288
289 status = acpi_get_handle(root->device->handle, "_OSC", &tmp);
290 if (ACPI_FAILURE(status))
291 return status;
292 mutex_lock(&osc_lock);
293 status = acpi_pci_query_osc(root, flags);
294 mutex_unlock(&osc_lock);
295 return status;
296}
297
298static struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle)
299{
300 struct acpi_pci_root *root;
301 list_for_each_entry(root, &acpi_pci_roots, node) {
302 if (root->device->handle == handle)
303 return root;
304 }
305 return NULL;
306}
307
308/**
309 * acpi_pci_osc_control_set - commit requested control to Firmware
310 * @handle: acpi_handle for the target ACPI object
311 * @flags: driver's requested control bits
312 *
313 * Attempt to take control from Firmware on requested control bits.
314 **/
315acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags)
316{
317 acpi_status status;
318 u32 control_req, result, capbuf[3];
319 acpi_handle tmp;
320 struct acpi_pci_root *root;
321
322 status = acpi_get_handle(handle, "_OSC", &tmp);
323 if (ACPI_FAILURE(status))
324 return status;
325
326 control_req = (flags & OSC_CONTROL_MASKS);
327 if (!control_req)
328 return AE_TYPE;
329
330 root = acpi_pci_find_root(handle);
331 if (!root)
332 return AE_NOT_EXIST;
333
334 mutex_lock(&osc_lock);
335 /* No need to evaluate _OSC if the control was already granted. */
336 if ((root->osc_control_set & control_req) == control_req)
337 goto out;
338
339 /* Need to query controls first before requesting them */
340 if (!root->osc_queried) {
341 status = acpi_pci_query_osc(root, root->osc_support_set);
342 if (ACPI_FAILURE(status))
343 goto out;
344 }
345 if ((root->osc_control_qry & control_req) != control_req) {
346 printk(KERN_DEBUG
347 "Firmware did not grant requested _OSC control\n");
348 status = AE_SUPPORT;
349 goto out;
350 }
351
352 capbuf[OSC_QUERY_TYPE] = 0;
353 capbuf[OSC_SUPPORT_TYPE] = root->osc_support_set;
354 capbuf[OSC_CONTROL_TYPE] = root->osc_control_set | control_req;
355 status = acpi_pci_run_osc(handle, capbuf, &result);
356 if (ACPI_SUCCESS(status))
357 root->osc_control_set = result;
358out:
359 mutex_unlock(&osc_lock);
360 return status;
361}
362EXPORT_SYMBOL(acpi_pci_osc_control_set);
363
188static int __devinit acpi_pci_root_add(struct acpi_device *device) 364static int __devinit acpi_pci_root_add(struct acpi_device *device)
189{ 365{
190 int result = 0; 366 int result = 0;
@@ -217,7 +393,7 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
217 * PCI domains, so we indicate this in _OSC support capabilities. 393 * PCI domains, so we indicate this in _OSC support capabilities.
218 */ 394 */
219 flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT; 395 flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT;
220 pci_acpi_osc_support(device->handle, flags); 396 acpi_pci_osc_support(root, flags);
221 397
222 /* 398 /*
223 * Segment 399 * Segment
@@ -353,7 +529,7 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
353 if (pci_msi_enabled()) 529 if (pci_msi_enabled())
354 flags |= OSC_MSI_SUPPORT; 530 flags |= OSC_MSI_SUPPORT;
355 if (flags != base_flags) 531 if (flags != base_flags)
356 pci_acpi_osc_support(device->handle, flags); 532 acpi_pci_osc_support(root, flags);
357 533
358 end: 534 end:
359 if (result) { 535 if (result) {
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 775324e34ffa..8e683f8cc573 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -359,7 +359,6 @@ static int acpi_processor_add_fs(struct acpi_device *device)
359 if (!acpi_device_dir(device)) 359 if (!acpi_device_dir(device))
360 return -ENODEV; 360 return -ENODEV;
361 } 361 }
362 acpi_device_dir(device)->owner = THIS_MODULE;
363 362
364 /* 'info' [R] */ 363 /* 'info' [R] */
365 entry = proc_create_data(ACPI_PROCESSOR_FILE_INFO, 364 entry = proc_create_data(ACPI_PROCESSOR_FILE_INFO,
@@ -1163,7 +1162,6 @@ static int __init acpi_processor_init(void)
1163 acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir); 1162 acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir);
1164 if (!acpi_processor_dir) 1163 if (!acpi_processor_dir)
1165 return -ENOMEM; 1164 return -ENOMEM;
1166 acpi_processor_dir->owner = THIS_MODULE;
1167 1165
1168 /* 1166 /*
1169 * Check whether the system is DMI table. If yes, OSPM 1167 * Check whether the system is DMI table. If yes, OSPM
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index 215f1bf7d4c1..cafb41000f6b 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -524,7 +524,7 @@ int acpi_processor_preregister_performance(
524 goto err_out; 524 goto err_out;
525 } 525 }
526 526
527 if (!performance || !percpu_ptr(performance, i)) { 527 if (!performance || !per_cpu_ptr(performance, i)) {
528 retval = -EINVAL; 528 retval = -EINVAL;
529 goto err_out; 529 goto err_out;
530 } 530 }
@@ -536,7 +536,7 @@ int acpi_processor_preregister_performance(
536 if (!pr) 536 if (!pr)
537 continue; 537 continue;
538 538
539 pr->performance = percpu_ptr(performance, i); 539 pr->performance = per_cpu_ptr(performance, i);
540 cpumask_set_cpu(i, pr->performance->shared_cpu_map); 540 cpumask_set_cpu(i, pr->performance->shared_cpu_map);
541 if (acpi_processor_get_psd(pr)) { 541 if (acpi_processor_get_psd(pr)) {
542 retval = -EINVAL; 542 retval = -EINVAL;
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index bb8fd1b6054b..4b214b74ebaa 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -493,7 +493,6 @@ acpi_sbs_add_fs(struct proc_dir_entry **dir,
493 if (!*dir) { 493 if (!*dir) {
494 return -ENODEV; 494 return -ENODEV;
495 } 495 }
496 (*dir)->owner = THIS_MODULE;
497 } 496 }
498 497
499 /* 'info' [R] */ 498 /* 'info' [R] */
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
index 991c006a301b..646d39c031ca 100644
--- a/drivers/acpi/tables.c
+++ b/drivers/acpi/tables.c
@@ -211,14 +211,15 @@ acpi_table_parse_entries(char *id,
211 struct acpi_subtable_header *entry; 211 struct acpi_subtable_header *entry;
212 unsigned int count = 0; 212 unsigned int count = 0;
213 unsigned long table_end; 213 unsigned long table_end;
214 acpi_size tbl_size;
214 215
215 if (!handler) 216 if (!handler)
216 return -EINVAL; 217 return -EINVAL;
217 218
218 if (strncmp(id, ACPI_SIG_MADT, 4) == 0) 219 if (strncmp(id, ACPI_SIG_MADT, 4) == 0)
219 acpi_get_table(id, acpi_apic_instance, &table_header); 220 acpi_get_table_with_size(id, acpi_apic_instance, &table_header, &tbl_size);
220 else 221 else
221 acpi_get_table(id, 0, &table_header); 222 acpi_get_table_with_size(id, 0, &table_header, &tbl_size);
222 223
223 if (!table_header) { 224 if (!table_header) {
224 printk(KERN_WARNING PREFIX "%4.4s not present\n", id); 225 printk(KERN_WARNING PREFIX "%4.4s not present\n", id);
@@ -236,8 +237,10 @@ acpi_table_parse_entries(char *id,
236 table_end) { 237 table_end) {
237 if (entry->type == entry_id 238 if (entry->type == entry_id
238 && (!max_entries || count++ < max_entries)) 239 && (!max_entries || count++ < max_entries))
239 if (handler(entry, table_end)) 240 if (handler(entry, table_end)) {
241 early_acpi_os_unmap_memory((char *)table_header, tbl_size);
240 return -EINVAL; 242 return -EINVAL;
243 }
241 244
242 entry = (struct acpi_subtable_header *) 245 entry = (struct acpi_subtable_header *)
243 ((unsigned long)entry + entry->length); 246 ((unsigned long)entry + entry->length);
@@ -247,6 +250,7 @@ acpi_table_parse_entries(char *id,
247 "%i found\n", id, entry_id, count - max_entries, count); 250 "%i found\n", id, entry_id, count - max_entries, count);
248 } 251 }
249 252
253 early_acpi_os_unmap_memory((char *)table_header, tbl_size);
250 return count; 254 return count;
251} 255}
252 256
@@ -271,17 +275,19 @@ acpi_table_parse_madt(enum acpi_madt_type id,
271int __init acpi_table_parse(char *id, acpi_table_handler handler) 275int __init acpi_table_parse(char *id, acpi_table_handler handler)
272{ 276{
273 struct acpi_table_header *table = NULL; 277 struct acpi_table_header *table = NULL;
278 acpi_size tbl_size;
274 279
275 if (!handler) 280 if (!handler)
276 return -EINVAL; 281 return -EINVAL;
277 282
278 if (strncmp(id, ACPI_SIG_MADT, 4) == 0) 283 if (strncmp(id, ACPI_SIG_MADT, 4) == 0)
279 acpi_get_table(id, acpi_apic_instance, &table); 284 acpi_get_table_with_size(id, acpi_apic_instance, &table, &tbl_size);
280 else 285 else
281 acpi_get_table(id, 0, &table); 286 acpi_get_table_with_size(id, 0, &table, &tbl_size);
282 287
283 if (table) { 288 if (table) {
284 handler(table); 289 handler(table);
290 early_acpi_os_unmap_memory(table, tbl_size);
285 return 0; 291 return 0;
286 } else 292 } else
287 return 1; 293 return 1;
@@ -295,8 +301,9 @@ int __init acpi_table_parse(char *id, acpi_table_handler handler)
295static void __init check_multiple_madt(void) 301static void __init check_multiple_madt(void)
296{ 302{
297 struct acpi_table_header *table = NULL; 303 struct acpi_table_header *table = NULL;
304 acpi_size tbl_size;
298 305
299 acpi_get_table(ACPI_SIG_MADT, 2, &table); 306 acpi_get_table_with_size(ACPI_SIG_MADT, 2, &table, &tbl_size);
300 if (table) { 307 if (table) {
301 printk(KERN_WARNING PREFIX 308 printk(KERN_WARNING PREFIX
302 "BIOS bug: multiple APIC/MADT found," 309 "BIOS bug: multiple APIC/MADT found,"
@@ -305,6 +312,7 @@ static void __init check_multiple_madt(void)
305 "If \"acpi_apic_instance=%d\" works better, " 312 "If \"acpi_apic_instance=%d\" works better, "
306 "notify linux-acpi@vger.kernel.org\n", 313 "notify linux-acpi@vger.kernel.org\n",
307 acpi_apic_instance ? 0 : 2); 314 acpi_apic_instance ? 0 : 2);
315 early_acpi_os_unmap_memory(table, tbl_size);
308 316
309 } else 317 } else
310 acpi_apic_instance = 0; 318 acpi_apic_instance = 0;
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 6b959976b7a4..e8c143caf0fd 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -371,7 +371,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
371 /* 371 /*
372 * Treat freezing temperatures as invalid as well; some 372 * Treat freezing temperatures as invalid as well; some
373 * BIOSes return really low values and cause reboots at startup. 373 * BIOSes return really low values and cause reboots at startup.
374 * Below zero (Celcius) values clearly aren't right for sure.. 374 * Below zero (Celsius) values clearly aren't right for sure..
375 * ... so lets discard those as invalid. 375 * ... so lets discard those as invalid.
376 */ 376 */
377 if (ACPI_FAILURE(status) || 377 if (ACPI_FAILURE(status) ||
@@ -1192,7 +1192,6 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
1192 acpi_thermal_dir); 1192 acpi_thermal_dir);
1193 if (!acpi_device_dir(device)) 1193 if (!acpi_device_dir(device))
1194 return -ENODEV; 1194 return -ENODEV;
1195 acpi_device_dir(device)->owner = THIS_MODULE;
1196 } 1195 }
1197 1196
1198 /* 'state' [R] */ 1197 /* 'state' [R] */
@@ -1534,7 +1533,6 @@ static int __init acpi_thermal_init(void)
1534 acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); 1533 acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir);
1535 if (!acpi_thermal_dir) 1534 if (!acpi_thermal_dir)
1536 return -ENODEV; 1535 return -ENODEV;
1537 acpi_thermal_dir->owner = THIS_MODULE;
1538 1536
1539 result = acpi_bus_register_driver(&acpi_thermal_driver); 1537 result = acpi_bus_register_driver(&acpi_thermal_driver);
1540 if (result < 0) { 1538 if (result < 0) {
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index d51d6f06c09b..ab06143672bc 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -1256,8 +1256,6 @@ static int acpi_video_device_add_fs(struct acpi_device *device)
1256 if (!device_dir) 1256 if (!device_dir)
1257 return -ENOMEM; 1257 return -ENOMEM;
1258 1258
1259 device_dir->owner = THIS_MODULE;
1260
1261 /* 'info' [R] */ 1259 /* 'info' [R] */
1262 entry = proc_create_data("info", S_IRUGO, device_dir, 1260 entry = proc_create_data("info", S_IRUGO, device_dir,
1263 &acpi_video_device_info_fops, acpi_driver_data(device)); 1261 &acpi_video_device_info_fops, acpi_driver_data(device));
@@ -1531,8 +1529,6 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
1531 if (!device_dir) 1529 if (!device_dir)
1532 return -ENOMEM; 1530 return -ENOMEM;
1533 1531
1534 device_dir->owner = THIS_MODULE;
1535
1536 /* 'info' [R] */ 1532 /* 'info' [R] */
1537 entry = proc_create_data("info", S_IRUGO, device_dir, 1533 entry = proc_create_data("info", S_IRUGO, device_dir,
1538 &acpi_video_bus_info_fops, 1534 &acpi_video_bus_info_fops,
@@ -2291,7 +2287,6 @@ int acpi_video_register(void)
2291 acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); 2287 acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir);
2292 if (!acpi_video_dir) 2288 if (!acpi_video_dir)
2293 return -ENODEV; 2289 return -ENODEV;
2294 acpi_video_dir->owner = THIS_MODULE;
2295 2290
2296 result = acpi_bus_register_driver(&acpi_video_bus); 2291 result = acpi_bus_register_driver(&acpi_video_bus);
2297 if (result < 0) { 2292 if (result < 0) {