Merge branch 'acpi-assorted'
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 15 Feb 2013 12:58:43 +0000 (13:58 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 15 Feb 2013 12:58:43 +0000 (13:58 +0100)
* acpi-assorted:
  ACPI: Add DMI entry for Sony VGN-FW41E_H
  ACPI: fix obsolete comment in custom_method.c
  ACPI / thermal: Use mode to enable/disable kernel thermal processing
  ACPI thermal: remove unnecessary newline from exception message
  ACPI sysfs: remove unnecessary newline from exception
  ACPI video: remove unnecessary newline from error messages
  ACPI: SRAT: report non-volatile memory in debug
  ACPI: Rework acpi_get_child() to be more efficient

1  2 
drivers/acpi/glue.c
drivers/acpi/numa.c
drivers/acpi/sleep.c
drivers/acpi/thermal.c
drivers/acpi/video.c

diff --combined drivers/acpi/glue.c
index 9aee4fc2b218116c97de440fba0f061296cde5ab,e9e486f79b3505986f0984463e21b24a59e9a870..ef6f155469b58ed370aa9d1232d5c2e6bb14c29a
@@@ -68,9 -68,6 +68,9 @@@ static struct acpi_bus_type *acpi_get_b
  {
        struct acpi_bus_type *tmp, *ret = NULL;
  
 +      if (!type)
 +              return NULL;
 +
        down_read(&bus_type_sem);
        list_for_each_entry(tmp, &bus_type_list, list) {
                if (tmp->bus == type) {
@@@ -98,40 -95,31 +98,31 @@@ static int acpi_find_bridge_device(stru
        return ret;
  }
  
- /* Get device's handler per its address under its parent */
- struct acpi_find_child {
-       acpi_handle handle;
-       u64 address;
- };
- static acpi_status
- do_acpi_find_child(acpi_handle handle, u32 lvl, void *context, void **rv)
+ static acpi_status do_acpi_find_child(acpi_handle handle, u32 lvl_not_used,
+                                     void *addr_p, void **ret_p)
  {
+       unsigned long long addr;
        acpi_status status;
-       struct acpi_device_info *info;
-       struct acpi_find_child *find = context;
-       status = acpi_get_object_info(handle, &info);
-       if (ACPI_SUCCESS(status)) {
-               if ((info->address == find->address)
-                       && (info->valid & ACPI_VALID_ADR))
-                       find->handle = handle;
-               kfree(info);
+       status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &addr);
+       if (ACPI_SUCCESS(status) && addr == *((u64 *)addr_p)) {
+               *ret_p = handle;
+               return AE_CTRL_TERMINATE;
        }
        return AE_OK;
  }
  
  acpi_handle acpi_get_child(acpi_handle parent, u64 address)
  {
-       struct acpi_find_child find = { NULL, address };
+       void *ret = NULL;
  
        if (!parent)
                return NULL;
-       acpi_walk_namespace(ACPI_TYPE_DEVICE, parent,
-                           1, do_acpi_find_child, NULL, &find, NULL);
-       return find.handle;
- }
  
+       acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, 1, NULL,
+                           do_acpi_find_child, &address, &ret);
+       return (acpi_handle)ret;
+ }
  EXPORT_SYMBOL(acpi_get_child);
  
  static int acpi_bind_one(struct device *dev, acpi_handle handle)
@@@ -272,39 -260,28 +263,39 @@@ static int acpi_platform_notify(struct 
  {
        struct acpi_bus_type *type;
        acpi_handle handle;
 -      int ret = -EINVAL;
 +      int ret;
  
        ret = acpi_bind_one(dev, NULL);
 -      if (!ret)
 -              goto out;
 -
 -      if (!dev->bus || !dev->parent) {
 +      if (ret && (!dev->bus || !dev->parent)) {
                /* bridge devices genernally haven't bus or parent */
                ret = acpi_find_bridge_device(dev, &handle);
 -              goto end;
 +              if (!ret) {
 +                      ret = acpi_bind_one(dev, handle);
 +                      if (ret)
 +                              goto out;
 +              }
        }
 +
        type = acpi_get_bus_type(dev->bus);
 -      if (!type) {
 -              DBG("No ACPI bus support for %s\n", dev_name(dev));
 -              ret = -EINVAL;
 -              goto end;
 +      if (ret) {
 +              if (!type || !type->find_device) {
 +                      DBG("No ACPI bus support for %s\n", dev_name(dev));
 +                      ret = -EINVAL;
 +                      goto out;
 +              }
 +
 +              ret = type->find_device(dev, &handle);
 +              if (ret) {
 +                      DBG("Unable to get handle for %s\n", dev_name(dev));
 +                      goto out;
 +              }
 +              ret = acpi_bind_one(dev, handle);
 +              if (ret)
 +                      goto out;
        }
 -      if ((ret = type->find_device(dev, &handle)) != 0)
 -              DBG("Can't get handler for %s\n", dev_name(dev));
 - end:
 -      if (!ret)
 -              acpi_bind_one(dev, handle);
 +
 +      if (type && type->setup)
 +              type->setup(dev);
  
   out:
  #if ACPI_GLUE_DEBUG
  
  static int acpi_platform_notify_remove(struct device *dev)
  {
 +      struct acpi_bus_type *type;
 +
 +      type = acpi_get_bus_type(dev->bus);
 +      if (type && type->cleanup)
 +              type->cleanup(dev);
 +
        acpi_unbind_one(dev);
        return 0;
  }
diff --combined drivers/acpi/numa.c
index 5ddbc65e0f6ee971634b69ce8fc238263ba6a1f0,2935d3a2bd7a8160c358eafd64e2f9124f6a8268..33e609f6358580647412dd0d029f065fdfb73741
@@@ -116,14 -116,16 +116,16 @@@ acpi_table_print_srat_entry(struct acpi
                        struct acpi_srat_mem_affinity *p =
                            (struct acpi_srat_mem_affinity *)header;
                        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                         "SRAT Memory (0x%lx length 0x%lx) in proximity domain %d %s%s\n",
+                                         "SRAT Memory (0x%lx length 0x%lx) in proximity domain %d %s%s%s\n",
                                          (unsigned long)p->base_address,
                                          (unsigned long)p->length,
                                          p->proximity_domain,
                                          (p->flags & ACPI_SRAT_MEM_ENABLED)?
                                          "enabled" : "disabled",
                                          (p->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE)?
-                                         " hot-pluggable" : ""));
+                                         " hot-pluggable" : "",
+                                         (p->flags & ACPI_SRAT_MEM_NON_VOLATILE)?
+                                         " non-volatile" : ""));
                }
  #endif                                /* ACPI_DEBUG_OUTPUT */
                break;
@@@ -273,7 -275,7 +275,7 @@@ static int __init acpi_parse_srat(struc
  
  static int __init
  acpi_table_parse_srat(enum acpi_srat_type id,
 -                    acpi_table_entry_handler handler, unsigned int max_entries)
 +                    acpi_tbl_entry_handler handler, unsigned int max_entries)
  {
        return acpi_table_parse_entries(ACPI_SIG_SRAT,
                                            sizeof(struct acpi_table_srat), id,
diff --combined drivers/acpi/sleep.c
index 277aa825edd9d52015e9f067ca50c59811e3cb76,df8505147b278b914144390709fbb36521dbb55e..6d3a06a629a1f8e1627f1218d88053cf7857053d
@@@ -177,6 -177,14 +177,14 @@@ static struct dmi_system_id __initdata 
        },
        {
        .callback = init_nvs_nosave,
+       .ident = "Sony Vaio VGN-FW41E_H",
+       .matches = {
+               DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
+               DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FW41E_H"),
+               },
+       },
+       {
+       .callback = init_nvs_nosave,
        .ident = "Sony Vaio VGN-FW21E",
        .matches = {
                DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
@@@ -386,8 -394,6 +394,8 @@@ static void acpi_pm_finish(void
  
        acpi_target_sleep_state = ACPI_STATE_S0;
  
 +      acpi_resume_power_resources();
 +
        /* If we were woken with the fixed power button, provide a small
         * hint to userspace in the form of a wakeup event on the fixed power
         * button device (if it can be found).
@@@ -579,28 -585,7 +587,28 @@@ static const struct platform_suspend_op
        .end = acpi_pm_end,
        .recover = acpi_pm_finish,
  };
 -#endif /* CONFIG_SUSPEND */
 +
 +static void acpi_sleep_suspend_setup(void)
 +{
 +      int i;
 +
 +      for (i = ACPI_STATE_S1; i < ACPI_STATE_S4; i++) {
 +              acpi_status status;
 +              u8 type_a, type_b;
 +
 +              status = acpi_get_sleep_type_data(i, &type_a, &type_b);
 +              if (ACPI_SUCCESS(status)) {
 +                      sleep_states[i] = 1;
 +                      pr_cont(" S%d", i);
 +              }
 +      }
 +
 +      suspend_set_ops(old_suspend_ordering ?
 +              &acpi_suspend_ops_old : &acpi_suspend_ops);
 +}
 +#else /* !CONFIG_SUSPEND */
 +static inline void acpi_sleep_suspend_setup(void) {}
 +#endif /* !CONFIG_SUSPEND */
  
  #ifdef CONFIG_HIBERNATION
  static unsigned long s4_hardware_signature;
@@@ -721,30 -706,7 +729,30 @@@ static const struct platform_hibernatio
        .restore_cleanup = acpi_pm_thaw,
        .recover = acpi_pm_finish,
  };
 -#endif /* CONFIG_HIBERNATION */
 +
 +static void acpi_sleep_hibernate_setup(void)
 +{
 +      acpi_status status;
 +      u8 type_a, type_b;
 +
 +      status = acpi_get_sleep_type_data(ACPI_STATE_S4, &type_a, &type_b);
 +      if (ACPI_FAILURE(status))
 +              return;
 +
 +      hibernation_set_ops(old_suspend_ordering ?
 +                      &acpi_hibernation_ops_old : &acpi_hibernation_ops);
 +      sleep_states[ACPI_STATE_S4] = 1;
 +      pr_cont(KERN_CONT " S4");
 +      if (nosigcheck)
 +              return;
 +
 +      acpi_get_table(ACPI_SIG_FACS, 1, (struct acpi_table_header **)&facs);
 +      if (facs)
 +              s4_hardware_signature = facs->hardware_signature;
 +}
 +#else /* !CONFIG_HIBERNATION */
 +static inline void acpi_sleep_hibernate_setup(void) {}
 +#endif /* !CONFIG_HIBERNATION */
  
  int acpi_suspend(u32 acpi_state)
  {
@@@ -780,6 -742,9 +788,6 @@@ int __init acpi_sleep_init(void
  {
        acpi_status status;
        u8 type_a, type_b;
 -#ifdef CONFIG_SUSPEND
 -      int i = 0;
 -#endif
  
        if (acpi_disabled)
                return 0;
        acpi_sleep_dmi_check();
  
        sleep_states[ACPI_STATE_S0] = 1;
 -      printk(KERN_INFO PREFIX "(supports S0");
 +      pr_info(PREFIX "(supports S0");
  
 -#ifdef CONFIG_SUSPEND
 -      for (i = ACPI_STATE_S1; i < ACPI_STATE_S4; i++) {
 -              status = acpi_get_sleep_type_data(i, &type_a, &type_b);
 -              if (ACPI_SUCCESS(status)) {
 -                      sleep_states[i] = 1;
 -                      printk(KERN_CONT " S%d", i);
 -              }
 -      }
 +      acpi_sleep_suspend_setup();
 +      acpi_sleep_hibernate_setup();
  
 -      suspend_set_ops(old_suspend_ordering ?
 -              &acpi_suspend_ops_old : &acpi_suspend_ops);
 -#endif
 -
 -#ifdef CONFIG_HIBERNATION
 -      status = acpi_get_sleep_type_data(ACPI_STATE_S4, &type_a, &type_b);
 -      if (ACPI_SUCCESS(status)) {
 -              hibernation_set_ops(old_suspend_ordering ?
 -                      &acpi_hibernation_ops_old : &acpi_hibernation_ops);
 -              sleep_states[ACPI_STATE_S4] = 1;
 -              printk(KERN_CONT " S4");
 -              if (!nosigcheck) {
 -                      acpi_get_table(ACPI_SIG_FACS, 1,
 -                              (struct acpi_table_header **)&facs);
 -                      if (facs)
 -                              s4_hardware_signature =
 -                                      facs->hardware_signature;
 -              }
 -      }
 -#endif
        status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
        if (ACPI_SUCCESS(status)) {
                sleep_states[ACPI_STATE_S5] = 1;
 -              printk(KERN_CONT " S5");
 +              pr_cont(" S5");
                pm_power_off_prepare = acpi_power_off_prepare;
                pm_power_off = acpi_power_off;
        }
 -      printk(KERN_CONT ")\n");
 +      pr_cont(")\n");
        /*
         * Register the tts_notifier to reboot notifier list so that the _TTS
         * object can also be evaluated when the system enters S5.
diff --combined drivers/acpi/thermal.c
index da079d4e0baa12d7e4bfe05410ccfd4f28b383d0,dc047336cc373c19ad5ed68e74cda2d60ca4c1e8..8470771e5eae1a2c69bc9df34c70c09138403128
@@@ -97,7 -97,7 +97,7 @@@ module_param(psv, int, 0644)
  MODULE_PARM_DESC(psv, "Disable or override all passive trip points.");
  
  static int acpi_thermal_add(struct acpi_device *device);
 -static int acpi_thermal_remove(struct acpi_device *device, int type);
 +static int acpi_thermal_remove(struct acpi_device *device);
  static void acpi_thermal_notify(struct acpi_device *device, u32 event);
  
  static const struct acpi_device_id  thermal_device_ids[] = {
@@@ -288,7 -288,7 +288,7 @@@ do {       
        if (flags != ACPI_TRIPS_INIT)   \
                ACPI_EXCEPTION((AE_INFO, AE_ERROR,      \
                "ACPI thermal trip point %s changed\n"  \
-               "Please send acpidump to linux-acpi@vger.kernel.org\n", str)); \
+               "Please send acpidump to linux-acpi@vger.kernel.org", str)); \
  } while (0)
  
  static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
@@@ -531,6 -531,10 +531,10 @@@ static void acpi_thermal_check(void *da
  {
        struct acpi_thermal *tz = data;
  
+       if (!tz->tz_enabled) {
+               pr_warn("thermal zone is disabled \n");
+               return;
+       }
        thermal_zone_device_update(tz->thermal_zone);
  }
  
@@@ -1111,7 -1115,7 +1115,7 @@@ end
        return result;
  }
  
 -static int acpi_thermal_remove(struct acpi_device *device, int type)
 +static int acpi_thermal_remove(struct acpi_device *device)
  {
        struct acpi_thermal *tz = NULL;
  
diff --combined drivers/acpi/video.c
index 5be60ad8381f26694ac29cbfe069e47b6b435299,b03bb26365ae235774f32995b5766955336b6943..313f959413dc09a89c8a8262957b35081b1e2b0b
@@@ -88,7 -88,7 +88,7 @@@ module_param(use_bios_initial_backlight
  
  static int register_count = 0;
  static int acpi_video_bus_add(struct acpi_device *device);
 -static int acpi_video_bus_remove(struct acpi_device *device, int type);
 +static int acpi_video_bus_remove(struct acpi_device *device);
  static void acpi_video_bus_notify(struct acpi_device *device, u32 event);
  
  static const struct acpi_device_id video_device_ids[] = {
@@@ -673,7 -673,7 +673,7 @@@ acpi_video_init_brightness(struct acpi_
                        br->levels[i] = br->levels[i - level_ac_battery];
                count += level_ac_battery;
        } else if (level_ac_battery > 2)
-               ACPI_ERROR((AE_INFO, "Too many duplicates in _BCL package\n"));
+               ACPI_ERROR((AE_INFO, "Too many duplicates in _BCL package"));
  
        /* Check if the _BCL package is in a reversed order */
        if (max_level == br->levels[2]) {
                        acpi_video_cmp_level, NULL);
        } else if (max_level != br->levels[count - 1])
                ACPI_ERROR((AE_INFO,
-                           "Found unordered _BCL package\n"));
+                           "Found unordered _BCL package"));
  
        br->count = count;
        device->brightness = br;
@@@ -1740,7 -1740,7 +1740,7 @@@ static int acpi_video_bus_add(struct ac
        return error;
  }
  
 -static int acpi_video_bus_remove(struct acpi_device *device, int type)
 +static int acpi_video_bus_remove(struct acpi_device *device)
  {
        struct acpi_video_bus *video = NULL;