]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge branch 'acpi-hotplug'
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sun, 12 Jan 2014 22:45:04 +0000 (23:45 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sun, 12 Jan 2014 22:45:04 +0000 (23:45 +0100)
* acpi-hotplug:
  ACPI / scan: ACPI device object sysfs attribute for _STA evaluation
  ACPI / hotplug / driver core: Handle containers in a special way
  ACPI / hotplug: Add demand_offline hotplug profile flag
  ACPI / bind: Move acpi_get_child() to drivers/ide/ide-acpi.c
  ACPI / bind: Pass struct acpi_device pointer to acpi_bind_one()
  ACPI / bind: Rework struct acpi_bus_type
  ACPI / bind: Redefine acpi_preset_companion()
  ACPI / bind: Redefine acpi_get_child()
  PCI / ACPI: Use acpi_find_child_device() for child devices lookup
  ACPI / bind: Simplify child device lookups
  ACPI / scan: Use direct recurrence for device hierarchy walks
  ACPI: Introduce acpi_set_device_status()
  ACPI / hotplug: Drop unfinished global notification handling routines
  ACPI / hotplug: Rework generic code to handle suprise removals
  ACPI / hotplug: Move container-specific code out of the core
  ACPI / hotplug: Make ACPI PCI root hotplug use common hotplug code
  ACPI / hotplug: Introduce common hotplug function acpi_device_hotplug()
  ACPI / hotplug: Do not fail bus and device checks for disabled hotplug
  ACPI / scan: Add acpi_device objects for all device nodes in the namespace
  ACPI / scan: Define non-empty device removal handler

1  2 
drivers/acpi/dock.c
drivers/acpi/internal.h
drivers/acpi/osl.c
drivers/pci/pci-acpi.c
include/linux/acpi.h

diff --combined drivers/acpi/dock.c
index 38c2e325f32575828a5cbaf684ad8f2e7f91f6b0,8da6be99ba4206b8ebc82eb669be2f447e53b3ab..c431c88faaffa1f46f4d1e1b4de042f3314a2b9f
@@@ -33,8 -33,6 +33,8 @@@
  #include <linux/stddef.h>
  #include <linux/acpi.h>
  
 +#include "internal.h"
 +
  #define PREFIX "ACPI: "
  
  #define ACPI_DOCK_DRIVER_DESCRIPTION "ACPI Dock Station Driver"
@@@ -323,14 -321,11 +323,11 @@@ static int dock_present(struct dock_sta
   */
  static void dock_create_acpi_device(acpi_handle handle)
  {
-       struct acpi_device *device;
+       struct acpi_device *device = NULL;
        int ret;
  
-       if (acpi_bus_get_device(handle, &device)) {
-               /*
-                * no device created for this object,
-                * so we should create one.
-                */
+       acpi_bus_get_device(handle, &device);
+       if (!acpi_device_enumerated(device)) {
                ret = acpi_bus_scan(handle);
                if (ret)
                        pr_debug("error adding bus, %x\n", -ret);
@@@ -898,6 -893,9 +895,6 @@@ find_dock_and_bay(acpi_handle handle, u
  
  void __init acpi_dock_init(void)
  {
 -      if (acpi_disabled)
 -              return;
 -
        /* look for dock stations and bays */
        acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
                ACPI_UINT32_MAX, find_dock_and_bay, NULL, NULL, NULL);
diff --combined drivers/acpi/internal.h
index 8ef9787dead4295d2e6085a9da502c0037bdc61b,3375129bb5b7a6fff205dc26488609ebae04f344..dedbb2d802f1a87bd5a3c288067124514cad9824
@@@ -28,7 -28,6 +28,6 @@@ int init_acpi_device_notify(void)
  int acpi_scan_init(void);
  void acpi_pci_root_init(void);
  void acpi_pci_link_init(void);
- void acpi_pci_root_hp_init(void);
  void acpi_processor_init(void);
  void acpi_platform_init(void);
  int acpi_sysfs_init(void);
@@@ -73,6 -72,9 +72,9 @@@ void acpi_lpss_init(void)
  static inline void acpi_lpss_init(void) {}
  #endif
  
+ bool acpi_queue_hotplug_work(struct work_struct *work);
+ bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent);
  /* --------------------------------------------------------------------------
                       Device Node Initialization / Removal
     -------------------------------------------------------------------------- */
@@@ -85,9 -87,9 +87,9 @@@ void acpi_init_device_object(struct acp
                             int type, unsigned long long sta);
  void acpi_device_add_finalize(struct acpi_device *device);
  void acpi_free_pnp_ids(struct acpi_device_pnp *pnp);
- int acpi_bind_one(struct device *dev, acpi_handle handle);
+ int acpi_bind_one(struct device *dev, struct acpi_device *adev);
  int acpi_unbind_one(struct device *dev);
void acpi_bus_device_eject(void *data, u32 ost_src);
bool acpi_device_is_present(struct acpi_device *adev);
  
  /* --------------------------------------------------------------------------
                                    Power Resource
@@@ -105,6 -107,8 +107,8 @@@ int acpi_power_get_inferred_state(struc
  int acpi_power_on_resources(struct acpi_device *device, int state);
  int acpi_power_transition(struct acpi_device *device, int state);
  
+ int acpi_device_update_power(struct acpi_device *device, int *state_p);
  int acpi_wakeup_device_init(void);
  void acpi_early_processor_set_pdc(void);
  
@@@ -127,21 -131,12 +131,21 @@@ struct acpi_ec 
  
  extern struct acpi_ec *first_ec;
  
 +/* If we find an EC via the ECDT, we need to keep a ptr to its context */
 +/* External interfaces use first EC only, so remember */
 +typedef int (*acpi_ec_query_func) (void *data);
 +
  int acpi_ec_init(void);
  int acpi_ec_ecdt_probe(void);
  int acpi_boot_ec_enable(void);
  void acpi_ec_block_transactions(void);
  void acpi_ec_unblock_transactions(void);
  void acpi_ec_unblock_transactions_early(void);
 +int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit,
 +                            acpi_handle handle, acpi_ec_query_func func,
 +                            void *data);
 +void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit);
 +
  
  /*--------------------------------------------------------------------------
                                    Suspend/Resume
diff --combined drivers/acpi/osl.c
index 7865a806934093de9a072b4d998e3f684f342784,7e2d8140c33464336cd1eff96bb4a132fceeef5a..fc1aa7909690c3ef148930a4a96080d2bcaaa155
@@@ -39,6 -39,7 +39,6 @@@
  #include <linux/workqueue.h>
  #include <linux/nmi.h>
  #include <linux/acpi.h>
 -#include <linux/acpi_io.h>
  #include <linux/efi.h>
  #include <linux/ioport.h>
  #include <linux/list.h>
@@@ -540,7 -541,7 +540,7 @@@ static u64 acpi_tables_addr
  static int all_tables_size;
  
  /* Copied from acpica/tbutils.c:acpi_tb_checksum() */
 -u8 __init acpi_table_checksum(u8 *buffer, u32 length)
 +static u8 __init acpi_table_checksum(u8 *buffer, u32 length)
  {
        u8 sum = 0;
        u8 *end = buffer + length;
@@@ -1211,6 -1212,10 +1211,10 @@@ acpi_status acpi_hotplug_execute(acpi_h
        return AE_OK;
  }
  
+ bool acpi_queue_hotplug_work(struct work_struct *work)
+ {
+       return queue_work(kacpi_hotplug_wq, work);
+ }
  
  acpi_status
  acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle)
@@@ -1278,7 -1283,7 +1282,7 @@@ acpi_status acpi_os_wait_semaphore(acpi
                jiffies = MAX_SCHEDULE_TIMEOUT;
        else
                jiffies = msecs_to_jiffies(timeout);
 -      
 +
        ret = down_timeout(sem, jiffies);
        if (ret)
                status = AE_TIME;
@@@ -1790,7 -1795,7 +1794,7 @@@ acpi_status __init acpi_os_initialize1(
  {
        kacpid_wq = alloc_workqueue("kacpid", 0, 1);
        kacpi_notify_wq = alloc_workqueue("kacpi_notify", 0, 1);
-       kacpi_hotplug_wq = alloc_workqueue("kacpi_hotplug", 0, 1);
+       kacpi_hotplug_wq = alloc_ordered_workqueue("kacpi_hotplug", 0);
        BUG_ON(!kacpid_wq);
        BUG_ON(!kacpi_notify_wq);
        BUG_ON(!kacpi_hotplug_wq);
diff --combined drivers/pci/pci-acpi.c
index 68128d6bd33d8ec7338ab9eef03fca65a1c84d07,ce31eb0cdca7396ad64a9891d5cee74056887f9e..733a8222b13fcd9b554812beba2b0c7541bbe201
@@@ -303,10 -303,10 +303,10 @@@ void acpi_pci_remove_bus(struct pci_bu
  }
  
  /* ACPI bus type */
- static int acpi_pci_find_device(struct device *dev, acpi_handle *handle)
+ static struct acpi_device *acpi_pci_find_companion(struct device *dev)
  {
        struct pci_dev *pci_dev = to_pci_dev(dev);
-       bool is_bridge;
+       bool check_children;
        u64 addr;
  
        /*
         * is set only after acpi_pci_find_device() has been called for the
         * given device.
         */
-       is_bridge = pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE
+       check_children = pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE
                        || pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS;
        /* Please ref to ACPI spec for the syntax of _ADR */
        addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn);
-       *handle = acpi_find_child(ACPI_HANDLE(dev->parent), addr, is_bridge);
-       if (!*handle)
-               return -ENODEV;
-       return 0;
+       return acpi_find_child_device(ACPI_COMPANION(dev->parent), addr,
+                                     check_children);
  }
  
  static void pci_acpi_setup(struct device *dev)
  {
        struct pci_dev *pci_dev = to_pci_dev(dev);
 -      acpi_handle handle = ACPI_HANDLE(dev);
 -      struct acpi_device *adev;
 +      struct acpi_device *adev = ACPI_COMPANION(dev);
  
 -      if (acpi_bus_get_device(handle, &adev) || !adev->wakeup.flags.valid)
 +      if (!adev)
 +              return;
 +
 +      pci_acpi_add_pm_notifier(adev, pci_dev);
 +      if (!adev->wakeup.flags.valid)
                return;
  
        device_set_wakeup_capable(dev, true);
        acpi_pci_sleep_wake(pci_dev, false);
 -
 -      pci_acpi_add_pm_notifier(adev, pci_dev);
        if (adev->wakeup.flags.run_wake)
                device_set_run_wake(dev, true);
  }
  
  static void pci_acpi_cleanup(struct device *dev)
  {
 -      acpi_handle handle = ACPI_HANDLE(dev);
 -      struct acpi_device *adev;
 +      struct acpi_device *adev = ACPI_COMPANION(dev);
 +
 +      if (!adev)
 +              return;
  
 -      if (!acpi_bus_get_device(handle, &adev) && adev->wakeup.flags.valid) {
 +      pci_acpi_remove_pm_notifier(adev);
 +      if (adev->wakeup.flags.valid) {
                device_set_wakeup_capable(dev, false);
                device_set_run_wake(dev, false);
 -              pci_acpi_remove_pm_notifier(adev);
        }
  }
  
@@@ -364,7 -359,7 +362,7 @@@ static bool pci_acpi_bus_match(struct d
  static struct acpi_bus_type acpi_pci_bus = {
        .name = "PCI",
        .match = pci_acpi_bus_match,
-       .find_device = acpi_pci_find_device,
+       .find_companion = acpi_pci_find_companion,
        .setup = pci_acpi_setup,
        .cleanup = pci_acpi_cleanup,
  };
diff --combined include/linux/acpi.h
index 7aaf7315d33df1446854a6098fa97b00d7fdddda,115c610324d1ec6b9ecc8aa3a67d839636ca35bf..3e3247d95fd9ad7297c7b689b2a50ec1bb8c156c
@@@ -42,7 -42,6 +42,7 @@@
  #include <acpi/acpi_bus.h>
  #include <acpi/acpi_drivers.h>
  #include <acpi/acpi_numa.h>
 +#include <acpi/acpi_io.h>
  #include <asm/acpi.h>
  
  static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
  #define ACPI_COMPANION_SET(dev, adev) ACPI_COMPANION(dev) = (adev)
  #define ACPI_HANDLE(dev)              acpi_device_handle(ACPI_COMPANION(dev))
  
+ static inline void acpi_preset_companion(struct device *dev,
+                                        struct acpi_device *parent, u64 addr)
+ {
+       ACPI_COMPANION_SET(dev, acpi_find_child_device(parent, addr, NULL));
+ }
  static inline const char *acpi_dev_name(struct acpi_device *adev)
  {
        return dev_name(&adev->dev);
@@@ -461,7 -466,7 +467,7 @@@ struct acpi_table_header
  static inline int acpi_table_parse(char *id,
                                int (*handler)(struct acpi_table_header *))
  {
 -      return -1;
 +      return -ENODEV;
  }
  
  static inline int acpi_nvs_register(__u64 start, __u64 size)