]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
Merge branch 'acpi-general'
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 7 Dec 2012 22:14:35 +0000 (23:14 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 7 Dec 2012 22:14:35 +0000 (23:14 +0100)
* acpi-general:
  pnpacpi: fix incorrect TEST_ALPHA() test
  ACPI / video: ignore BIOS initial backlight value for HP Folio 13-2000
  ACPI : do not use Lid and Sleep button for S5 wakeup

1  2 
drivers/acpi/scan.c
drivers/pnp/pnpacpi/core.c

diff --combined drivers/acpi/scan.c
index 8ee379ef309aeecf85bfdc9ce201ead781eae291,bd523bfbaad115de3ffd0bedb28ea5bc0c608868..53502d1bbf26f1bc9b5ac46d7db7ec11caa792a7
@@@ -29,27 -29,6 +29,27 @@@ extern struct acpi_device *acpi_root
  
  static const char *dummy_hid = "device";
  
 +/*
 + * The following ACPI IDs are known to be suitable for representing as
 + * platform devices.
 + */
 +static const struct acpi_device_id acpi_platform_device_ids[] = {
 +
 +      { "PNP0D40" },
 +
 +      /* Haswell LPSS devices */
 +      { "INT33C0", 0 },
 +      { "INT33C1", 0 },
 +      { "INT33C2", 0 },
 +      { "INT33C3", 0 },
 +      { "INT33C4", 0 },
 +      { "INT33C5", 0 },
 +      { "INT33C6", 0 },
 +      { "INT33C7", 0 },
 +
 +      { }
 +};
 +
  static LIST_HEAD(acpi_device_list);
  static LIST_HEAD(acpi_bus_id_list);
  DEFINE_MUTEX(acpi_device_lock);
@@@ -418,8 -397,8 +418,8 @@@ static void acpi_device_remove_files(st
                        ACPI Bus operations
     -------------------------------------------------------------------------- */
  
 -int acpi_match_device_ids(struct acpi_device *device,
 -                        const struct acpi_device_id *ids)
 +static const struct acpi_device_id *__acpi_match_device(
 +      struct acpi_device *device, const struct acpi_device_id *ids)
  {
        const struct acpi_device_id *id;
        struct acpi_hardware_id *hwid;
         * driver for it.
         */
        if (!device->status.present)
 -              return -ENODEV;
 +              return NULL;
  
        for (id = ids; id->id[0]; id++)
                list_for_each_entry(hwid, &device->pnp.ids, list)
                        if (!strcmp((char *) id->id, hwid->id))
 -                              return 0;
 +                              return id;
  
 -      return -ENOENT;
 +      return NULL;
 +}
 +
 +/**
 + * acpi_match_device - Match a struct device against a given list of ACPI IDs
 + * @ids: Array of struct acpi_device_id object to match against.
 + * @dev: The device structure to match.
 + *
 + * Check if @dev has a valid ACPI handle and if there is a struct acpi_device
 + * object for that handle and use that object to match against a given list of
 + * device IDs.
 + *
 + * Return a pointer to the first matching ID on success or %NULL on failure.
 + */
 +const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
 +                                             const struct device *dev)
 +{
 +      struct acpi_device *adev;
 +
 +      if (!ids || !ACPI_HANDLE(dev)
 +          || ACPI_FAILURE(acpi_bus_get_device(ACPI_HANDLE(dev), &adev)))
 +              return NULL;
 +
 +      return __acpi_match_device(adev, ids);
 +}
 +EXPORT_SYMBOL_GPL(acpi_match_device);
 +
 +int acpi_match_device_ids(struct acpi_device *device,
 +                        const struct acpi_device_id *ids)
 +{
 +      return __acpi_match_device(device, ids) ? 0 : -ENOENT;
  }
  EXPORT_SYMBOL(acpi_match_device_ids);
  
@@@ -968,8 -917,8 +968,8 @@@ acpi_bus_extract_wakeup_device_power_pa
  static void acpi_bus_set_run_wake_flags(struct acpi_device *device)
  {
        struct acpi_device_id button_device_ids[] = {
-               {"PNP0C0D", 0},
                {"PNP0C0C", 0},
+               {"PNP0C0D", 0},
                {"PNP0C0E", 0},
                {"", 0},
        };
        /* Power button, Lid switch always enable wakeup */
        if (!acpi_match_device_ids(device, button_device_ids)) {
                device->wakeup.flags.run_wake = 1;
+               if (!acpi_match_device_ids(device, &button_device_ids[1])) {
+                       /* Do not use Lid/sleep button for S5 wakeup */
+                       if (device->wakeup.sleep_state == ACPI_STATE_S5)
+                               device->wakeup.sleep_state = ACPI_STATE_S4;
+               }
                device_set_wakeup_capable(&device->dev, true);
                return;
        }
@@@ -1074,10 -1028,8 +1079,10 @@@ static int acpi_bus_get_power_flags(str
                 * D3hot is only valid if _PR3 present.
                 */
                if (ps->resources.count ||
 -                  (ps->flags.explicit_set && i < ACPI_STATE_D3_HOT))
 +                  (ps->flags.explicit_set && i < ACPI_STATE_D3_HOT)) {
                        ps->flags.valid = 1;
 +                      ps->flags.os_accessible = 1;
 +              }
  
                ps->power = -1; /* Unknown - driver assigned */
                ps->latency = -1;       /* Unknown - driver assigned */
        if (device->power.states[ACPI_STATE_D3_HOT].flags.explicit_set)
                device->power.states[ACPI_STATE_D3_COLD].flags.explicit_set = 1;
  
 +      /* Presence of _PS3 or _PRx means we can put the device into D3 cold */
 +      if (device->power.states[ACPI_STATE_D3_HOT].flags.explicit_set ||
 +                      device->power.flags.power_resources)
 +              device->power.states[ACPI_STATE_D3_COLD].flags.os_accessible = 1;
 +
        acpi_bus_init_power(device);
  
        return 0;
@@@ -1296,7 -1243,7 +1301,7 @@@ static void acpi_device_set_id(struct a
  {
        acpi_status status;
        struct acpi_device_info *info;
 -      struct acpica_device_id_list *cid_list;
 +      struct acpi_pnp_device_id_list *cid_list;
        int i;
  
        switch (device->device_type) {
@@@ -1597,13 -1544,8 +1602,13 @@@ static acpi_status acpi_bus_check_add(a
         */
        device = NULL;
        acpi_bus_get_device(handle, &device);
 -      if (ops->acpi_op_add && !device)
 +      if (ops->acpi_op_add && !device) {
                acpi_add_single_object(&device, handle, type, sta, ops);
 +              /* Is the device a known good platform device? */
 +              if (device
 +                  && !acpi_match_device_ids(device, acpi_platform_device_ids))
 +                      acpi_create_platform_device(device);
 +      }
  
        if (!device)
                return AE_CTRL_DEPTH;
index 93a16ee14a9fc8f0661bff722cd3332874cf645a,767f526209e83ed92e8818974de7de15dba38dce..72e822e17d475c3ba632fc8e33afbadc55d52d33
@@@ -58,7 -58,7 +58,7 @@@ static inline int __init is_exclusive_d
        if (!(('0' <= (c) && (c) <= '9') || ('A' <= (c) && (c) <= 'F'))) \
                return 0
  #define TEST_ALPHA(c) \
-       if (!('@' <= (c) || (c) <= 'Z')) \
+       if (!('A' <= (c) && (c) <= 'Z')) \
                return 0
  static int __init ispnpidacpi(const char *id)
  {
@@@ -245,10 -245,6 +245,10 @@@ static int __init pnpacpi_add_device(st
        char *pnpid;
        struct acpi_hardware_id *id;
  
 +      /* Skip devices that are already bound */
 +      if (device->physical_node_count)
 +              return 0;
 +
        /*
         * If a PnPacpi device is not present , the device
         * driver should not be loaded.