1. 25 11月, 2013 1 次提交
  2. 23 11月, 2013 8 次提交
    • R
      ACPI: Introduce acpi_set_device_status() · 25db115b
      Rafael J. Wysocki 提交于
      Introduce a static inline function for setting the status field
      of struct acpi_device on the basis of a supplied u32 number,
      acpi_set_device_status(), and use it instead of the horrible
      horrible STRUCT_TO_INT() macro wherever applicable.  Having done
      that, drop STRUCT_TO_INT() (and pretend that it has never existed).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      25db115b
    • R
      ACPI / hotplug: Rework generic code to handle suprise removals · 443fc820
      Rafael J. Wysocki 提交于
      The generic ACPI hotplug code used for several types of device
      doesn't handle surprise removals, mostly because those devices
      currently cannot be removed by surprise in the majority of systems.
      However, surprise removals should be handled by that code as well
      as surprise additions of devices, so make it do that.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      443fc820
    • R
      ACPI / hotplug: Move container-specific code out of the core · 46394fd0
      Rafael J. Wysocki 提交于
      Move container-specific uevents from the core hotplug code to the
      container scan handler's .attach() and .detach() callbacks.
      
      This way the core will not have to special-case containers and
      the uevents will be guaranteed to happen every time a container
      is either scanned or trimmed as appropriate.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      46394fd0
    • R
      ACPI / hotplug: Make ACPI PCI root hotplug use common hotplug code · 3338db00
      Rafael J. Wysocki 提交于
      Rework the common ACPI device hotplug code so that it is suitable
      for PCI host bridge hotplug and switch the PCI host bridge scan
      handler to using the common hotplug code.
      
      This allows quite a few lines of code that are not necessary any more
      to be dropped from the PCI host bridge scan handler and removes
      arbitrary differences in behavior between PCI host bridge hotplug
      and ACPI-based hotplug of other components, like CPUs and memory.
      
      Also acpi_device_hotplug() can be static now.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      3338db00
    • R
      ACPI / hotplug: Introduce common hotplug function acpi_device_hotplug() · c27b2c33
      Rafael J. Wysocki 提交于
      Modify the common ACPI device hotplug code to always queue up the
      same function, acpi_device_hotplug(), using acpi_hotplug_execute()
      and make the PCI host bridge hotplug code use that function too for
      device hot removal.
      
      This allows some code duplication to be reduced and a race condition
      where the relevant ACPI handle may become invalid between the
      notification handler and the function queued up by it via
      acpi_hotplug_execute() to be avoided.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      c27b2c33
    • R
      ACPI / hotplug: Do not fail bus and device checks for disabled hotplug · 1ceaba05
      Rafael J. Wysocki 提交于
      If the scan handler for the given device has hotplug.enabled
      unset, it doesn't really make sense to fail bus check and device
      check notifications.
      
      First, bus check may not have anything to do with the device it is
      signaled for, but it may concern another device on the bus below
      this one.  For this reason, bus check notifications should not be
      failed if hotplug is disabled for the target device.
      
      Second, device check notifications are signaled only after a device
      has already appeared (or disappeared), so failing it can only prevent
      scan handlers and drivers from attaching to that (already existing)
      device, which is not very useful.
      
      Consequently, if device hotplug is disabled through the device's
      scan handler, fail eject request notifications only.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      1ceaba05
    • R
      ACPI / scan: Add acpi_device objects for all device nodes in the namespace · 202317a5
      Rafael J. Wysocki 提交于
      Modify the ACPI namespace scanning code to register a struct
      acpi_device object for every namespace node representing a device,
      processor and so on, even if the device represented by that namespace
      node is reported to be not present and not functional by _STA.
      
      There are multiple reasons to do that.  First of all, it avoids
      quite a lot of overhead when struct acpi_device objects are
      deleted every time acpi_bus_trim() is run and then added again
      by a subsequent acpi_bus_scan() for the same scope, although the
      namespace objects they correspond to stay in memory all the time
      (which always is the case on a vast majority of systems).
      
      Second, it will allow user space to see that there are namespace
      nodes representing devices that are not present at the moment and may
      be added to the system.  It will also allow user space to evaluate
      _SUN for those nodes to check what physical slots the "missing"
      devices may be put into and it will make sense to add a sysfs
      attribute for _STA evaluation after this change (that will be
      useful for thermal management on some systems).
      
      Next, it will help to consolidate the ACPI hotplug handling among
      subsystems by making it possible to store hotplug-related information
      in struct acpi_device objects in a standard common way.
      
      Finally, it will help to avoid a race condition related to the
      deletion of ACPI namespace nodes.  Namely, namespace nodes may be
      deleted as a result of a table unload triggered by _EJ0 or _DCK.
      If a hotplug notification for one of those nodes is triggered
      right before the deletion and it executes a hotplug callback
      via acpi_hotplug_execute(), the ACPI handle passed to that
      callback may be stale when the callback actually runs.  One way
      to work around that is to always pass struct acpi_device pointers
      to hotplug callbacks after doing a get_device() on the objects in
      question which eliminates the use-after-free possibility (the ACPI
      handles in those objects are invalidated by acpi_scan_drop_device(),
      so they will trigger ACPICA errors on attempts to use them).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      202317a5
    • R
      ACPI / scan: Define non-empty device removal handler · d783156e
      Rafael J. Wysocki 提交于
      If an ACPI namespace node is removed (usually, as a result of a
      table unload), and there is a data object attached to that node,
      acpi_ns_delete_node() executes the removal handler submitted to
      acpi_attach_data() for that object.  That handler is currently empty
      for struct acpi_device objects, so it is necessary to detach those
      objects from the corresponding ACPI namespace nodes in advance every
      time a table unload may happen.  That is cumbersome and inefficient
      and leads to some design constraints that turn out to be quite
      inconvenient (in particular, struct acpi_device objects cannot be
      registered for namespace nodes representing devices that are not
      reported as present or functional by _STA).
      
      For this reason, introduce a non-empty removal handler for ACPI
      device objects that will unregister them when their ACPI namespace
      nodes go away.
      
      This code modification alone should not change functionality except
      for the ordering of the ACPI hotplug workqueue which should not
      matter (without subsequent code changes).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      d783156e
  3. 20 11月, 2013 1 次提交
    • T
      ACPI / hotplug: Fix conflicted PCI bridge notify handlers · ca499fc8
      Toshi Kani 提交于
      The PCI host bridge scan handler installs its own notify handler,
      handle_hotplug_event_root(), by itself.  Nevertheless, the ACPI
      hotplug framework also installs the common notify handler,
      acpi_hotplug_notify_cb(), for PCI root bridges.  This causes
      acpi_hotplug_notify_cb() to call _OST method with unsupported
      error as hotplug.enabled is not set.
      
      To address this issue, introduce hotplug.ignore flag, which
      indicates that the scan handler installs its own notify handler by
      itself.  The ACPI hotplug framework does not install the common
      notify handler when this flag is set.
      Signed-off-by: NToshi Kani <toshi.kani@hp.com>
      [rjw: Changed the name of the new flag]
      Cc: 3.9+ <stable@vger.kernel.org> # 3.9+
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ca499fc8
  4. 19 11月, 2013 3 次提交
  5. 08 11月, 2013 1 次提交
    • R
      ACPI / hotplug: Consolidate deferred execution of ACPI hotplug routines · 7b98118a
      Rafael J. Wysocki 提交于
      There are two different interfaces for queuing up work items on the
      ACPI hotplug workqueue, alloc_acpi_hp_work() used by PCI and PCI host
      bridge hotplug code and acpi_os_hotplug_execute() used by the common
      ACPI hotplug code and docking stations.  They both are somewhat
      cumbersome to use and work slightly differently.
      
      The users of alloc_acpi_hp_work() have to submit a work function that
      will extract the necessary data items from a struct acpi_hp_work
      object allocated by alloc_acpi_hp_work() and then will free that
      object, while it would be more straightforward to simply use a work
      function with one more argument and let the interface take care of
      the execution details.
      
      The users of acpi_os_hotplug_execute() also have to deal with the
      fact that it takes only one argument in addition to the work function
      pointer, although acpi_os_execute_deferred() actually takes care of
      the allocation and freeing of memory, so it would have been able to
      pass more arguments to the work function if it hadn't been
      constrained by the connection with acpi_os_execute().
      
      Moreover, while alloc_acpi_hp_work() makes GFP_KERNEL memory
      allocations, which is correct, because hotplug work items are
      always queued up from process context, acpi_os_hotplug_execute()
      uses GFP_ATOMIC, as that is needed by acpi_os_execute().  Also,
      acpi_os_execute_deferred() queued up by it waits for the ACPI event
      workqueues to flush before executing the work function, whereas
      alloc_acpi_hp_work() can't do anything similar.  That leads to
      somewhat arbitrary differences in behavior between various ACPI
      hotplug code paths and has to be straightened up.
      
      For this reason, replace both alloc_acpi_hp_work() and
      acpi_os_hotplug_execute() with a single interface,
      acpi_hotplug_execute(), combining their behavior and being more
      friendly to its users than any of the two.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      7b98118a
  6. 07 11月, 2013 7 次提交
  7. 17 10月, 2013 1 次提交
  8. 02 10月, 2013 1 次提交
  9. 26 9月, 2013 1 次提交
  10. 31 8月, 2013 1 次提交
  11. 30 8月, 2013 1 次提交
    • R
      ACPI / hotplug: Remove containers synchronously · f943db40
      Rafael J. Wysocki 提交于
      The current protocol for handling hot remove of containers is very
      fragile and causes acpi_eject_store() to acquire acpi_scan_lock
      which may deadlock with the removal of the device that it is called
      for (the reason is that device sysfs attributes cannot be removed
      while their callbacks are being executed and ACPI device objects
      are removed under acpi_scan_lock).
      
      The problem is related to the fact that containers are handled by
      acpi_bus_device_eject() in a special way, which is to emit an
      offline uevent instead of just removing the container.  Then, user
      space is expected to handle that uevent and use the container's
      "eject" attribute to actually remove it.  That is fragile, because
      user space may fail to complete the ejection (for example, by not
      using the container's "eject" attribute at all) leaving the BIOS
      kind of in a limbo.  Moreover, if the eject event is not signaled
      for a container itself, but for its parent device object (or
      generally, for an ancestor above it in the ACPI namespace), the
      container will be removed straight away without doing that whole
      dance.
      
      For this reason, modify acpi_bus_device_eject() to remove containers
      synchronously like any other objects (user space will get its uevent
      anyway in case it does some other things in response to it) and
      remove the eject_pending ACPI device flag that is not used any more.
      This way acpi_eject_store() doesn't have a reason to acquire
      acpi_scan_lock any more and one possible deadlock scenario goes
      away (plus the code is simplified a bit).
      Reported-and-tested-by: NGu Zheng <guz.fnst@cn.fujitsu.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      f943db40
  12. 06 8月, 2013 1 次提交
  13. 30 7月, 2013 1 次提交
  14. 15 7月, 2013 5 次提交
  15. 04 7月, 2013 1 次提交
  16. 28 6月, 2013 1 次提交
  17. 23 6月, 2013 1 次提交
  18. 20 6月, 2013 1 次提交
  19. 16 6月, 2013 1 次提交
    • R
      ACPI / scan: Simplify ACPI driver probing · d9e455f5
      Rafael J. Wysocki 提交于
      There is no particular reason why acpi_bus_driver_init() needs to be
      a separate function and its location with respect to its only caller,
      acpi_device_probe(), makes the code a bit difficult to follow.
      
      Besides, it doesn't really make sense to check if 'device' is not
      NULL in acpi_bus_driver_init(), because we've already dereferenced
      dev->driver in acpi_device_probe() at that point and, moreover,
      'device' cannot be NULL then, because acpi_device_probe() is called
      via really_probe() (which also sets dev->driver for that matter).
      
      For these reasons, drop acpi_bus_driver_init() altogether and move
      the remaining code from it directly into acpi_device_probe().
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d9e455f5
  20. 10 6月, 2013 1 次提交
  21. 08 6月, 2013 1 次提交