aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-05-22 13:43:56 -0400
committerLen Brown <len.brown@intel.com>2009-06-18 00:13:15 -0400
commitff754e2e85557ed7244385f0f2053c80e8ac9948 (patch)
tree28fe431134c4ceaa3258df4697ab3df6a62e6052 /drivers/acpi
parentcdd5b8ca122cc4239375dee7fcdc658315c119e4 (diff)
ACPI: use handle, not device, in system notification path
This patch changes the global system notification path so it uses the acpi_handle, not the acpi_device. System notifications often deal with device presence and status change. In these cases, we may not have an acpi_device. For example, we may get a Device Check notification on an object that previously was not present. Since the object was not present, we would not have had an acpi_device for it. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/bus.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 2b08c3dc79da..2876fc70c3a9 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -450,11 +450,14 @@ int acpi_bus_receive_event(struct acpi_bus_event *event)
450 Notification Handling 450 Notification Handling
451 -------------------------------------------------------------------------- */ 451 -------------------------------------------------------------------------- */
452 452
453static void acpi_bus_check_device(struct acpi_device *device) 453static void acpi_bus_check_device(acpi_handle handle)
454{ 454{
455 struct acpi_device *device;
455 acpi_status status; 456 acpi_status status;
456 struct acpi_device_status old_status; 457 struct acpi_device_status old_status;
457 458
459 if (acpi_bus_get_device(handle, &device))
460 return;
458 if (!device) 461 if (!device)
459 return; 462 return;
460 463
@@ -488,13 +491,10 @@ static void acpi_bus_check_device(struct acpi_device *device)
488 } 491 }
489} 492}
490 493
491static void acpi_bus_check_scope(struct acpi_device *device) 494static void acpi_bus_check_scope(acpi_handle handle)
492{ 495{
493 if (!device)
494 return;
495
496 /* Status Change? */ 496 /* Status Change? */
497 acpi_bus_check_device(device); 497 acpi_bus_check_device(handle);
498 498
499 /* 499 /*
500 * TBD: Enumerate child devices within this device's scope and 500 * TBD: Enumerate child devices within this device's scope and
@@ -531,13 +531,10 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
531 blocking_notifier_call_chain(&acpi_bus_notify_list, 531 blocking_notifier_call_chain(&acpi_bus_notify_list,
532 type, (void *)handle); 532 type, (void *)handle);
533 533
534 if (acpi_bus_get_device(handle, &device))
535 return;
536
537 switch (type) { 534 switch (type) {
538 535
539 case ACPI_NOTIFY_BUS_CHECK: 536 case ACPI_NOTIFY_BUS_CHECK:
540 acpi_bus_check_scope(device); 537 acpi_bus_check_scope(handle);
541 /* 538 /*
542 * TBD: We'll need to outsource certain events to non-ACPI 539 * TBD: We'll need to outsource certain events to non-ACPI
543 * drivers via the device manager (device.c). 540 * drivers via the device manager (device.c).
@@ -545,7 +542,7 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
545 break; 542 break;
546 543
547 case ACPI_NOTIFY_DEVICE_CHECK: 544 case ACPI_NOTIFY_DEVICE_CHECK:
548 acpi_bus_check_device(device); 545 acpi_bus_check_device(handle);
549 /* 546 /*
550 * TBD: We'll need to outsource certain events to non-ACPI 547 * TBD: We'll need to outsource certain events to non-ACPI
551 * drivers via the device manager (device.c). 548 * drivers via the device manager (device.c).
@@ -583,10 +580,13 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
583 break; 580 break;
584 } 581 }
585 582
586 driver = device->driver; 583 acpi_bus_get_device(handle, &device);
587 if (driver && driver->ops.notify && 584 if (device) {
588 (driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS)) 585 driver = device->driver;
589 driver->ops.notify(device, type); 586 if (driver && driver->ops.notify &&
587 (driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS))
588 driver->ops.notify(device, type);
589 }
590} 590}
591 591
592/* -------------------------------------------------------------------------- 592/* --------------------------------------------------------------------------