Merge back earlier 'acpi-assorted' material
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 14 Aug 2013 21:22:45 +0000 (23:22 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 14 Aug 2013 21:22:45 +0000 (23:22 +0200)
1  2 
drivers/acpi/battery.c
drivers/acpi/internal.h
drivers/acpi/processor_core.c
drivers/acpi/processor_driver.c
drivers/acpi/scan.c
drivers/acpi/video.c
include/acpi/acpi_bus.h

diff --combined drivers/acpi/battery.c
index d405fbad406ac75cc9bb41c8734a457d60e14222,33dfa851899d1ef1f062c959b7e8d085ffc3fcb9..85332872da45b0ad4a7ce7808d920cbc9e5890fb
@@@ -117,7 -117,6 +117,7 @@@ struct acpi_battery 
        struct acpi_device *device;
        struct notifier_block pm_nb;
        unsigned long update_time;
 +      int revision;
        int rate_now;
        int capacity_now;
        int voltage_now;
@@@ -360,7 -359,6 +360,7 @@@ static struct acpi_offsets info_offsets
  };
  
  static struct acpi_offsets extended_info_offsets[] = {
 +      {offsetof(struct acpi_battery, revision), 0},
        {offsetof(struct acpi_battery, power_unit), 0},
        {offsetof(struct acpi_battery, design_capacity), 0},
        {offsetof(struct acpi_battery, full_charge_capacity), 0},
@@@ -1036,8 -1034,6 +1036,6 @@@ static void acpi_battery_notify(struct 
        if (event == ACPI_BATTERY_NOTIFY_INFO)
                acpi_battery_refresh(battery);
        acpi_battery_update(battery);
-       acpi_bus_generate_proc_event(device, event,
-                                    acpi_battery_present(battery));
        acpi_bus_generate_netlink_event(device->pnp.device_class,
                                        dev_name(&device->dev), event,
                                        acpi_battery_present(battery));
diff --combined drivers/acpi/internal.h
index 5da44e81dd4d70f7ed42ae1f1587734c0b6a5a55,b636b7481f31bda7e86801bf0f8bb20bd1e177e2..20f423337e1fb73c66379a3771954741860c6d7d
@@@ -23,6 -23,7 +23,7 @@@
  
  #define PREFIX "ACPI: "
  
+ acpi_status acpi_os_initialize1(void);
  int init_acpi_device_notify(void);
  int acpi_scan_init(void);
  #ifdef        CONFIG_ACPI_PCI_SLOT
@@@ -164,13 -165,4 +165,13 @@@ struct platform_device
  int acpi_create_platform_device(struct acpi_device *adev,
                                const struct acpi_device_id *id);
  
 +/*--------------------------------------------------------------------------
 +                                      Video
 +  -------------------------------------------------------------------------- */
 +#if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE)
 +bool acpi_video_backlight_quirks(void);
 +#else
 +static inline bool acpi_video_backlight_quirks(void) { return false; }
 +#endif
 +
  #endif /* _ACPI_INTERNAL_H_ */
index a5e9f4a5b2816a9473942b229bc4632ec640bf5c,210079c3ad848278e2a3ece59eacf240ee24b8ab..cf34d903f4fb4a45b7975fc5fce60d141de2b7a9
@@@ -28,7 -28,7 +28,7 @@@ static int __init set_no_mwait(const st
        return 0;
  }
  
- static struct dmi_system_id __initdata processor_idle_dmi_table[] = {
+ static struct dmi_system_id processor_idle_dmi_table[] __initdata = {
        {
        set_no_mwait, "Extensa 5220", {
        DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
@@@ -253,7 -253,7 +253,7 @@@ static bool __init processor_physically
        return true;
  }
  
 -static void __cpuinit acpi_set_pdc_bits(u32 *buf)
 +static void acpi_set_pdc_bits(u32 *buf)
  {
        buf[0] = ACPI_PDC_REVISION_ID;
        buf[1] = 1;
        arch_acpi_set_pdc_bits(buf);
  }
  
 -static struct acpi_object_list *__cpuinit acpi_processor_alloc_pdc(void)
 +static struct acpi_object_list *acpi_processor_alloc_pdc(void)
  {
        struct acpi_object_list *obj_list;
        union acpi_object *obj;
   * _PDC is required for a BIOS-OS handshake for most of the newer
   * ACPI processor features.
   */
 -static int __cpuinit
 +static int
  acpi_processor_eval_pdc(acpi_handle handle, struct acpi_object_list *pdc_in)
  {
        acpi_status status = AE_OK;
        return status;
  }
  
 -void __cpuinit acpi_processor_set_pdc(acpi_handle handle)
 +void acpi_processor_set_pdc(acpi_handle handle)
  {
        struct acpi_object_list *obj_list;
  
index 870eaf5fa547b935bdde1fe31a7bf31d2ab3d222,94b7b3b5559e27b852d645c38d3333976259c5d0..bd11ef93b0ceb943b821528b943579884b410c15
@@@ -91,21 -91,17 +91,17 @@@ static void acpi_processor_notify(acpi_
                acpi_processor_ppc_has_changed(pr, 1);
                if (saved == pr->performance_platform_limit)
                        break;
-               acpi_bus_generate_proc_event(device, event,
-                                       pr->performance_platform_limit);
                acpi_bus_generate_netlink_event(device->pnp.device_class,
                                                  dev_name(&device->dev), event,
                                                  pr->performance_platform_limit);
                break;
        case ACPI_PROCESSOR_NOTIFY_POWER:
                acpi_processor_cst_has_changed(pr);
-               acpi_bus_generate_proc_event(device, event, 0);
                acpi_bus_generate_netlink_event(device->pnp.device_class,
                                                  dev_name(&device->dev), event, 0);
                break;
        case ACPI_PROCESSOR_NOTIFY_THROTTLING:
                acpi_processor_tstate_has_changed(pr);
-               acpi_bus_generate_proc_event(device, event, 0);
                acpi_bus_generate_netlink_event(device->pnp.device_class,
                                                  dev_name(&device->dev), event, 0);
                break;
        return;
  }
  
 -static __cpuinit int __acpi_processor_start(struct acpi_device *device);
 +static int __acpi_processor_start(struct acpi_device *device);
  
 -static int __cpuinit acpi_cpu_soft_notify(struct notifier_block *nfb,
 +static int acpi_cpu_soft_notify(struct notifier_block *nfb,
                                          unsigned long action, void *hcpu)
  {
        unsigned int cpu = (unsigned long)hcpu;
@@@ -162,7 -158,7 +158,7 @@@ static struct notifier_block __refdata 
            .notifier_call = acpi_cpu_soft_notify,
  };
  
 -static __cpuinit int __acpi_processor_start(struct acpi_device *device)
 +static int __acpi_processor_start(struct acpi_device *device)
  {
        struct acpi_processor *pr = acpi_driver_data(device);
        acpi_status status;
        return result;
  }
  
 -static int __cpuinit acpi_processor_start(struct device *dev)
 +static int acpi_processor_start(struct device *dev)
  {
        struct acpi_device *device;
  
diff --combined drivers/acpi/scan.c
index 8a46c924effd4e5bef09cb645429170e70ed380a,4b2679342e8260b56cb825e36fb457e22c7a2acd..7d9e285da4526bee132d3589a8fe5666b62fcbe4
@@@ -352,12 -352,10 +352,12 @@@ static void acpi_scan_bus_device_check(
        mutex_lock(&acpi_scan_lock);
        lock_device_hotplug();
  
 -      acpi_bus_get_device(handle, &device);
 -      if (device) {
 -              dev_warn(&device->dev, "Attempt to re-insert\n");
 -              goto out;
 +      if (ost_source != ACPI_NOTIFY_BUS_CHECK) {
 +              acpi_bus_get_device(handle, &device);
 +              if (device) {
 +                      dev_warn(&device->dev, "Attempt to re-insert\n");
 +                      goto out;
 +              }
        }
        acpi_evaluate_hotplug_ost(handle, ost_source,
                                  ACPI_OST_SC_INSERT_IN_PROGRESS, NULL);
@@@ -999,6 -997,28 +999,28 @@@ struct bus_type acpi_bus_type = 
        .uevent         = acpi_device_uevent,
  };
  
+ static void acpi_bus_data_handler(acpi_handle handle, void *context)
+ {
+       /* Intentionally empty. */
+ }
+ int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device)
+ {
+       acpi_status status;
+       if (!device)
+               return -EINVAL;
+       status = acpi_get_data(handle, acpi_bus_data_handler, (void **)device);
+       if (ACPI_FAILURE(status) || !*device) {
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No context for object [%p]\n",
+                                 handle));
+               return -ENODEV;
+       }
+       return 0;
+ }
+ EXPORT_SYMBOL_GPL(acpi_bus_get_device);
  int acpi_device_add(struct acpi_device *device,
                    void (*release)(struct device *))
  {
@@@ -1210,14 -1230,6 +1232,6 @@@ acpi_bus_get_ejd(acpi_handle handle, ac
  }
  EXPORT_SYMBOL_GPL(acpi_bus_get_ejd);
  
- void acpi_bus_data_handler(acpi_handle handle, void *context)
- {
-       /* TBD */
-       return;
- }
  static int acpi_bus_extract_wakeup_device_power_package(acpi_handle handle,
                                        struct acpi_device_wakeup *wakeup)
  {
@@@ -1983,9 -1995,6 +1997,9 @@@ static acpi_status acpi_bus_device_atta
        if (acpi_bus_get_device(handle, &device))
                return AE_CTRL_DEPTH;
  
 +      if (device->handler)
 +              return AE_OK;
 +
        ret = acpi_scan_attach_handler(device);
        if (ret)
                return ret > 0 ? AE_OK : AE_CTRL_DEPTH;
diff --combined drivers/acpi/video.c
index e1284b8dc6eef9b800f997ecbf6bc5e60214eacc,8f91a378319176063c6dfe11559a369c3221e121..9c4ebfcbe8652abb23840fa10eff5bfbbe9714db
@@@ -44,8 -44,6 +44,8 @@@
  #include <linux/suspend.h>
  #include <acpi/video.h>
  
 +#include "internal.h"
 +
  #define PREFIX "ACPI: "
  
  #define ACPI_VIDEO_BUS_NAME           "Video Bus"
@@@ -450,14 -448,6 +450,14 @@@ static struct dmi_system_id video_dmi_t
                DMI_MATCH(DMI_PRODUCT_NAME, "HP Folio 13 - 2000 Notebook PC"),
                },
        },
 +      {
 +       .callback = video_ignore_initial_backlight,
 +       .ident = "Fujitsu E753",
 +       .matches = {
 +              DMI_MATCH(DMI_BOARD_VENDOR, "FUJITSU"),
 +              DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E753"),
 +              },
 +      },
        {
         .callback = video_ignore_initial_backlight,
         .ident = "HP Pavilion dm4",
@@@ -689,7 -679,7 +689,7 @@@ static int acpi_video_bqc_quirk(struct 
         * Some systems always report current brightness level as maximum
         * through _BQC, we need to test another value for them.
         */
 -      test_level = current_level == max_level ? br->levels[2] : max_level;
 +      test_level = current_level == max_level ? br->levels[3] : max_level;
  
        result = acpi_video_device_lcd_set_level(device, test_level);
        if (result)
@@@ -908,9 -898,6 +908,9 @@@ static void acpi_video_device_find_cap(
                device->cap._DDC = 1;
        }
  
 +      if (acpi_video_init_brightness(device))
 +              return;
 +
        if (acpi_video_backlight_support()) {
                struct backlight_properties props;
                struct pci_dev *pdev;
                static int count = 0;
                char *name;
  
 -              result = acpi_video_init_brightness(device);
 -              if (result)
 -                      return;
                name = kasprintf(GFP_KERNEL, "acpi_video%d", count);
                if (!name)
                        return;
                if (result)
                        printk(KERN_ERR PREFIX "Create sysfs link\n");
  
 +      } else {
 +              /* Remove the brightness object. */
 +              kfree(device->brightness->levels);
 +              kfree(device->brightness);
 +              device->brightness = NULL;
        }
  }
  
@@@ -1547,20 -1532,14 +1547,20 @@@ static int acpi_video_bus_put_devices(s
  
  /* acpi_video interface */
  
 +/*
 + * Win8 requires setting bit2 of _DOS to let firmware know it shouldn't
 + * preform any automatic brightness change on receiving a notification.
 + */
  static int acpi_video_bus_start_devices(struct acpi_video_bus *video)
  {
 -      return acpi_video_bus_DOS(video, 0, 0);
 +      return acpi_video_bus_DOS(video, 0,
 +                                acpi_video_backlight_quirks() ? 1 : 0);
  }
  
  static int acpi_video_bus_stop_devices(struct acpi_video_bus *video)
  {
 -      return acpi_video_bus_DOS(video, 0, 1);
 +      return acpi_video_bus_DOS(video, 0,
 +                                acpi_video_backlight_quirks() ? 0 : 1);
  }
  
  static void acpi_video_bus_notify(struct acpi_device *device, u32 event)
        switch (event) {
        case ACPI_VIDEO_NOTIFY_SWITCH:  /* User requested a switch,
                                         * most likely via hotkey. */
-               acpi_bus_generate_proc_event(device, event, 0);
                keycode = KEY_SWITCHVIDEOMODE;
                break;
  
                                         * connector. */
                acpi_video_device_enumerate(video);
                acpi_video_device_rebind(video);
-               acpi_bus_generate_proc_event(device, event, 0);
                keycode = KEY_SWITCHVIDEOMODE;
                break;
  
        case ACPI_VIDEO_NOTIFY_CYCLE:   /* Cycle Display output hotkey pressed. */
-               acpi_bus_generate_proc_event(device, event, 0);
                keycode = KEY_SWITCHVIDEOMODE;
                break;
        case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT:     /* Next Display output hotkey pressed. */
-               acpi_bus_generate_proc_event(device, event, 0);
                keycode = KEY_VIDEO_NEXT;
                break;
        case ACPI_VIDEO_NOTIFY_PREV_OUTPUT:     /* previous Display output hotkey pressed. */
-               acpi_bus_generate_proc_event(device, event, 0);
                keycode = KEY_VIDEO_PREV;
                break;
  
@@@ -1641,31 -1615,26 +1636,26 @@@ static void acpi_video_device_notify(ac
        case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS:        /* Cycle brightness */
                if (brightness_switch_enabled)
                        acpi_video_switch_brightness(video_device, event);
-               acpi_bus_generate_proc_event(device, event, 0);
                keycode = KEY_BRIGHTNESS_CYCLE;
                break;
        case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS:  /* Increase brightness */
                if (brightness_switch_enabled)
                        acpi_video_switch_brightness(video_device, event);
-               acpi_bus_generate_proc_event(device, event, 0);
                keycode = KEY_BRIGHTNESSUP;
                break;
        case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS:  /* Decrease brightness */
                if (brightness_switch_enabled)
                        acpi_video_switch_brightness(video_device, event);
-               acpi_bus_generate_proc_event(device, event, 0);
                keycode = KEY_BRIGHTNESSDOWN;
                break;
        case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS: /* zero brightness */
                if (brightness_switch_enabled)
                        acpi_video_switch_brightness(video_device, event);
-               acpi_bus_generate_proc_event(device, event, 0);
                keycode = KEY_BRIGHTNESS_ZERO;
                break;
        case ACPI_VIDEO_NOTIFY_DISPLAY_OFF:     /* display device off */
                if (brightness_switch_enabled)
                        acpi_video_switch_brightness(video_device, event);
-               acpi_bus_generate_proc_event(device, event, 0);
                keycode = KEY_DISPLAY_OFF;
                break;
        default:
diff --combined include/acpi/acpi_bus.h
index 94383a70c1a3d738413e06389cc6937909554823,2a42cb36d238042172866cb094069e5bc587ab6d..a87eeda2562718967f08f600036b71a42e6c6f7e
@@@ -274,12 -274,15 +274,12 @@@ struct acpi_device_wakeup 
  };
  
  struct acpi_device_physical_node {
 -      u8 node_id;
 +      unsigned int node_id;
        struct list_head node;
        struct device *dev;
        bool put_online:1;
  };
  
 -/* set maximum of physical nodes to 32 for expansibility */
 -#define ACPI_MAX_PHYSICAL_NODE        32
 -
  /* Device */
  struct acpi_device {
        int device_type;
        struct acpi_driver *driver;
        void *driver_data;
        struct device dev;
 -      u8 physical_node_count;
 +      unsigned int physical_node_count;
        struct list_head physical_node_list;
        struct mutex physical_node_lock;
 -      DECLARE_BITMAP(physical_node_id_bitmap, ACPI_MAX_PHYSICAL_NODE);
        struct list_head power_dependent;
        void (*remove)(struct acpi_device *);
  };
@@@ -359,7 -363,6 +359,6 @@@ extern void unregister_acpi_bus_notifie
   */
  
  int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device);
- void acpi_bus_data_handler(acpi_handle handle, void *context);
  acpi_status acpi_bus_get_status_handle(acpi_handle handle,
                                       unsigned long long *sta);
  int acpi_bus_get_status(struct acpi_device *device);
@@@ -379,15 -382,6 +378,6 @@@ bool acpi_bus_can_wakeup(acpi_handle ha
  static inline bool acpi_bus_can_wakeup(acpi_handle handle) { return false; }
  #endif
  
- #ifdef CONFIG_ACPI_PROC_EVENT
- int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data);
- int acpi_bus_generate_proc_event4(const char *class, const char *bid, u8 type, int data);
- int acpi_bus_receive_event(struct acpi_bus_event *event);
- #else
- static inline int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data)
-       { return 0; }
- #endif
  void acpi_scan_lock_acquire(void);
  void acpi_scan_lock_release(void);
  int acpi_scan_add_handler(struct acpi_scan_handler *handler);
@@@ -441,11 -435,7 +431,11 @@@ struct acpi_pci_root 
  };
  
  /* helper */
 -acpi_handle acpi_get_child(acpi_handle, u64);
 +acpi_handle acpi_find_child(acpi_handle, u64, bool);
 +static inline acpi_handle acpi_get_child(acpi_handle handle, u64 addr)
 +{
 +      return acpi_find_child(handle, addr, false);
 +}
  int acpi_is_root_bridge(acpi_handle);
  struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle);
  #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)ACPI_HANDLE(dev))