Commit ff754e2e85557ed7244385f0f2053c80e8ac9948

Authored by Bjorn Helgaas
Committed by Len Brown
1 parent cdd5b8ca12

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>

Showing 1 changed file with 15 additions and 15 deletions Side-by-side Diff

... ... @@ -450,11 +450,14 @@
450 450 Notification Handling
451 451 -------------------------------------------------------------------------- */
452 452  
453   -static void acpi_bus_check_device(struct acpi_device *device)
  453 +static void acpi_bus_check_device(acpi_handle handle)
454 454 {
  455 + struct acpi_device *device;
455 456 acpi_status status;
456 457 struct acpi_device_status old_status;
457 458  
  459 + if (acpi_bus_get_device(handle, &device))
  460 + return;
458 461 if (!device)
459 462 return;
460 463  
461 464  
462 465  
... ... @@ -488,13 +491,10 @@
488 491 }
489 492 }
490 493  
491   -static void acpi_bus_check_scope(struct acpi_device *device)
  494 +static void acpi_bus_check_scope(acpi_handle handle)
492 495 {
493   - if (!device)
494   - return;
495   -
496 496 /* Status Change? */
497   - acpi_bus_check_device(device);
  497 + acpi_bus_check_device(handle);
498 498  
499 499 /*
500 500 * TBD: Enumerate child devices within this device's scope and
501 501  
... ... @@ -531,13 +531,10 @@
531 531 blocking_notifier_call_chain(&acpi_bus_notify_list,
532 532 type, (void *)handle);
533 533  
534   - if (acpi_bus_get_device(handle, &device))
535   - return;
536   -
537 534 switch (type) {
538 535  
539 536 case ACPI_NOTIFY_BUS_CHECK:
540   - acpi_bus_check_scope(device);
  537 + acpi_bus_check_scope(handle);
541 538 /*
542 539 * TBD: We'll need to outsource certain events to non-ACPI
543 540 * drivers via the device manager (device.c).
... ... @@ -545,7 +542,7 @@
545 542 break;
546 543  
547 544 case ACPI_NOTIFY_DEVICE_CHECK:
548   - acpi_bus_check_device(device);
  545 + acpi_bus_check_device(handle);
549 546 /*
550 547 * TBD: We'll need to outsource certain events to non-ACPI
551 548 * drivers via the device manager (device.c).
... ... @@ -583,10 +580,13 @@
583 580 break;
584 581 }
585 582  
586   - driver = device->driver;
587   - if (driver && driver->ops.notify &&
588   - (driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS))
589   - driver->ops.notify(device, type);
  583 + acpi_bus_get_device(handle, &device);
  584 + if (device) {
  585 + driver = device->driver;
  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 /* --------------------------------------------------------------------------