1. 15 7月, 2013 1 次提交
  2. 20 6月, 2013 3 次提交
  3. 02 6月, 2013 1 次提交
  4. 30 5月, 2013 1 次提交
  5. 22 5月, 2013 1 次提交
    • R
      ACPI / PM: Allow device power states to be used for CONFIG_PM unset · ec4602a9
      Rafael J. Wysocki 提交于
      Currently, drivers/acpi/device_pm.c depends on CONFIG_PM and all of
      the functions defined in there are replaced with static inline stubs
      if that option is unset.  However, CONFIG_PM means, roughly, "runtime
      PM or suspend/hibernation support" and some of those functions are
      useful regardless of that.  For example, they are used by the ACPI
      fan driver for controlling fans and acpi_device_set_power() is called
      during device removal.  Moreover, device initialization may depend on
      setting device power states properly.
      
      For these reasons, make the routines manipulating ACPI device power
      states defined in drivers/acpi/device_pm.c available for CONFIG_PM
      unset too.
      Reported-by: NZhang Rui <rui.zhang@intel.com>
      Reported-and-tested-by: NMichel Lespinasse <walken@google.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: 3.9+ <stable@vger.kernel.org>
      ec4602a9
  6. 12 5月, 2013 1 次提交
    • R
      ACPI / hotplug: Use device offline/online for graceful hot-removal · 683058e3
      Rafael J. Wysocki 提交于
      Modify the generic ACPI hotplug code to be able to check if devices
      scheduled for hot-removal may be gracefully removed from the system
      using the device offline/online mechanism introduced previously.
      
      Namely, make acpi_scan_hot_remove() handling device hot-removal call
      device_offline() for all physical companions of the ACPI device nodes
      involved in the operation and check the results.  If any of the
      device_offline() calls fails, the function will not progress to the
      removal phase (which cannot be aborted), unless its (new) force
      argument is set (in case of a failing offline it will put the devices
      offlined by it back online).
      
      In support of 'forced' device hot-removal, add a new sysfs attribute
      'force_remove' that will reside under /sys/firmware/acpi/hotplug/.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NToshi Kani <toshi.kani@hp.com>
      683058e3
  7. 25 3月, 2013 1 次提交
  8. 04 3月, 2013 4 次提交
    • R
      ACPI / hotplug: Introduce user space interface for hotplug profiles · 3f8055c3
      Rafael J. Wysocki 提交于
      Introduce user space interface for manipulating hotplug profiles
      associated with ACPI scan handlers.
      
      The interface consists of sysfs directories under
      /sys/firmware/acpi/hotplug/, one for each hotplug profile, containing
      an attribute allowing user space to manipulate the enabled field of
      the corresponding profile.  Namely, switching the enabled attribute
      from '0' to '1' will cause the common hotplug notify handler to be
      installed for all ACPI namespace objects representing devices matching
      the scan handler associated with the given hotplug profile (and
      analogously for the converse switch).
      
      Drivers willing to use the new user space interface should add their
      ACPI scan handlers with the help of new funtion
      acpi_scan_add_handler_with_hotplug().
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      Tested-by: NToshi Kani <toshi.kani@hp.com>
      3f8055c3
    • R
      ACPI / scan: Introduce common code for ACPI-based device hotplug · a33ec399
      Rafael J. Wysocki 提交于
      Multiple drivers handling hotplug-capable ACPI device nodes install
      notify handlers covering the same types of events in a very similar
      way.  Moreover, those handlers are installed in separate namespace
      walks, although that really should be done during namespace scans
      carried out by acpi_bus_scan().  This leads to substantial code
      duplication, unnecessary overhead and behavior that is hard to
      follow.
      
      For this reason, introduce common code in drivers/acpi/scan.c for
      handling hotplug-related notification and carrying out device
      insertion and eject operations in a generic fashion, such that it
      may be used by all of the relevant drivers in the future.  To cover
      the existing differences between those drivers introduce struct
      acpi_hotplug_profile for representing collections of hotplug
      settings associated with different ACPI scan handlers that can be
      used by the drivers to make the common code reflect their current
      behavior.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      Tested-by: NToshi Kani <toshi.kani@hp.com>
      a33ec399
    • R
      ACPI / glue: Drop .find_bridge() callback from struct acpi_bus_type · 92414481
      Rafael J. Wysocki 提交于
      After PCI and USB have stopped using the .find_bridge() callback in
      struct acpi_bus_type, the only remaining user of it is SATA, but SATA
      only pretends to be a user, because it points that callback to a stub
      always returning -ENODEV.
      
      For this reason, drop the SATA's dummy .find_bridge() callback and
      remove .find_bridge(), which is not used any more, from struct
      acpi_bus_type entirely.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NJeff Garzik <jgarzik@pobox.com>
      92414481
    • R
      ACPI / glue: Add .match() callback to struct acpi_bus_type · 53540098
      Rafael J. Wysocki 提交于
      USB uses the .find_bridge() callback from struct acpi_bus_type
      incorrectly, because as a result of the way it is used by USB every
      device in the system that doesn't have a bus type or parent is
      passed to usb_acpi_find_device() for inspection.
      
      What USB actually needs, though, is to call usb_acpi_find_device()
      for USB ports that don't have a bus type defined, but have
      usb_port_device_type as their device type, as well as for USB
      devices.
      
      To fix that replace the struct bus_type pointer in struct
      acpi_bus_type used for matching devices to specific subsystems
      with a .match() callback to be used for this purpose and update
      the users of struct acpi_bus_type, including USB, accordingly.
      Define the .match() callback routine for USB, usb_acpi_bus_match(),
      in such a way that it will cover both USB devices and USB ports
      and remove the now redundant .find_bridge() callback pointer from
      usb_acpi_bus.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NJeff Garzik <jgarzik@pobox.com>
      53540098
  9. 13 2月, 2013 1 次提交
    • R
      ACPI / hotplug: Fix concurrency issues and memory leaks · 3757b948
      Rafael J. Wysocki 提交于
      This changeset is aimed at fixing a few different but related
      problems in the ACPI hotplug infrastructure.
      
      First of all, since notify handlers may be run in parallel with
      acpi_bus_scan(), acpi_bus_trim() and acpi_bus_hot_remove_device()
      and some of them are installed for ACPI handles that have no struct
      acpi_device objects attached (i.e. before those objects are created),
      those notify handlers have to take acpi_scan_lock to prevent races
      from taking place (e.g. a struct acpi_device is found to be present
      for the given ACPI handle, but right after that it is removed by
      acpi_bus_trim() running in parallel to the given notify handler).
      Moreover, since some of them call acpi_bus_scan() and
      acpi_bus_trim(), this leads to the conclusion that acpi_scan_lock
      should be acquired by the callers of these two funtions rather by
      these functions themselves.
      
      For these reasons, make all notify handlers that can handle device
      addition and eject events take acpi_scan_lock and remove the
      acpi_scan_lock locking from acpi_bus_scan() and acpi_bus_trim().
      Accordingly, update all of their users to make sure that they
      are always called under acpi_scan_lock.
      
      Furthermore, since eject operations are carried out asynchronously
      with respect to the notify events that trigger them, with the help
      of acpi_bus_hot_remove_device(), even if notify handlers take the
      ACPI scan lock, it still is possible that, for example,
      acpi_bus_trim() will run between acpi_bus_hot_remove_device() and
      the notify handler that scheduled its execution and that
      acpi_bus_trim() will remove the device node passed to
      acpi_bus_hot_remove_device() for ejection.  In that case, the struct
      acpi_device object obtained by acpi_bus_hot_remove_device() will be
      invalid and not-so-funny things will ensue.  To protect agaist that,
      make the users of acpi_bus_hot_remove_device() run get_device() on
      ACPI device node objects that are about to be passed to it and make
      acpi_bus_hot_remove_device() run put_device() on them and check if
      their ACPI handles are not NULL (make acpi_device_unregister() clear
      the device nodes' ACPI handles for that check to work).
      
      Finally, observe that acpi_os_hotplug_execute() actually can fail,
      in which case its caller ought to free memory allocated for the
      context object to prevent leaks from happening.  It also needs to
      run put_device() on the device node that it ran get_device() on
      previously in that case.  Modify the code accordingly.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      3757b948
  10. 30 1月, 2013 1 次提交
    • R
      ACPI / scan: Introduce struct acpi_scan_handler · ca589f94
      Rafael J. Wysocki 提交于
      Introduce struct acpi_scan_handler for representing objects that
      will do configuration tasks depending on ACPI device nodes'
      hardware IDs (HIDs).
      
      Currently, those tasks are done either directly by the ACPI namespace
      scanning code or by ACPI device drivers designed specifically for
      this purpose.  None of the above is desirable, however, because
      doing that directly in the namespace scanning code makes that code
      overly complicated and difficult to follow and doing that in
      "special" device drivers leads to a great deal of confusion about
      their role and to confusing interactions with the driver core (for
      example, sysfs directories are created for those drivers, but they
      are completely unnecessary and only increase the kernel's memory
      footprint in vain).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      ca589f94
  11. 26 1月, 2013 4 次提交
  12. 24 1月, 2013 1 次提交
  13. 20 1月, 2013 1 次提交
  14. 19 1月, 2013 1 次提交
    • R
      ACPI / scan: Drop acpi_bus_add() and use acpi_bus_scan() instead · b8bd759a
      Rafael J. Wysocki 提交于
      The only difference between acpi_bus_scan() and acpi_bus_add() is the
      invocation of acpi_update_all_gpes() in the latter which in fact is
      unnecessary, because acpi_update_all_gpes() has already been called
      by acpi_scan_init() and the way it is implemented guarantees the next
      invocations of it to do nothing.
      
      For this reason, drop acpi_bus_add() and make all its callers use
      acpi_bus_scan() directly instead of it.  Additionally, rearrange the
      code in acpi_scan_init() slightly to improve the visibility of the
      acpi_update_all_gpes() call in there.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      b8bd759a
  15. 17 1月, 2013 5 次提交
    • R
      ACPI / PM: Common string representations of device power states · 96bfd3ce
      Rafael J. Wysocki 提交于
      The function returning string representations of ACPI device power
      states, state_string((), is now static, because it is only used
      internally in drivers/acpi/bus.c.  However, it will be used outside
      of that file going forward, so rename it to
      acpi_power_state_string(), add a kerneldoc comment to it and add its
      header to acpi_bus.h.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      96bfd3ce
    • R
      ACPI / PM: More visible function for retrieving device power states · ad0c3b0e
      Rafael J. Wysocki 提交于
      The function used for retrieving ACPI device power states,
      __acpi_bus_get_power(), is now static, because it is only used
      internally in drivers/acpi/bus.c.  However, it will be used
      outside of that file going forward, so rename it to
      acpi_device_get_power(), in analogy with acpi_device_set_power(),
      add a kerneldoc comment to it and add its header to acpi_bus.h.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ad0c3b0e
    • R
      ACPI / PM: Take order attribute of wakeup power resources into account · 993cbe59
      Rafael J. Wysocki 提交于
      ACPI power resources have an order attribute that should be taken
      into account when turning them on and off, but it is not used now.
      
      Modify the power resources management code to preserve the
      spec-compliant ordering of wakeup power resources.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      993cbe59
    • R
      ACPI / PM: Take order attribute of power resources into account · 0b224527
      Rafael J. Wysocki 提交于
      ACPI power resources have an order attribute that should be taken
      into account when turning them on and off, but it is not used now.
      
      Modify the power resources management code to preserve the
      spec-compliant ordering of power resources that power states of
      devices depend on (analogous changes will be done separately for
      power resources used for wakeup).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      0b224527
    • R
      ACPI / PM: Rework the handling of devices depending on power resources · bc9b6407
      Rafael J. Wysocki 提交于
      Commit 0090def6 (ACPI: Add interface to register/unregister device
      to/from power resources) made it possible to indicate to the ACPI
      core that if the given device depends on any power resources, then
      it should be resumed as soon as all of the power resources required
      by it to transition to the D0 power state have been turned on.
      
      Unfortunately, however, this was a mistake, because all devices
      depending on power resources should be treated this way (i.e. they
      should be resumed when all power resources required by their D0
      state have been turned on) and for the majority of those devices
      the ACPI core can figure out by itself which (physical) devices
      depend on what power resources.
      
      For this reason, replace the code added by commit 0090def6 with a
      new, much more straightforward, mechanism that will be used
      internally by the ACPI core and remove all references to that code
      from kernel subsystems using ACPI.
      
      For the cases when there are (physical) devices that should be
      resumed whenever a not directly related ACPI device node goes into
      D0 as a result of power resources configuration changes, like in
      the SATA case, add two new routines, acpi_dev_pm_add_dependent()
      and acpi_dev_pm_remove_dependent(), allowing subsystems to manage
      such dependencies.  Convert the SATA subsystem to use the new
      functions accordingly.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      bc9b6407
  16. 15 1月, 2013 3 次提交
  17. 14 1月, 2013 2 次提交
    • J
      ACPI: remove unused acpi_op_bind and acpi_op_unbind · 115c9ad8
      Jiang Liu 提交于
      With commit f2a33cde55a03 "ACPI: Drop ACPI device .bind() and .unbind()
      callbacks", acpi_op_bind and acpi_op_unbind are not used any more. So
      remove them.
      Signed-off-by: NJiang Liu <jiang.liu@huawei.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      115c9ad8
    • R
      ACPI / PCI: Set root bridge ACPI handle in advance · 6c0cc950
      Rafael J. Wysocki 提交于
      The ACPI handles of PCI root bridges need to be known to
      acpi_bind_one(), so that it can create the appropriate
      "firmware_node" and "physical_node" files for them, but currently
      the way it gets to know those handles is not exactly straightforward
      (to put it lightly).
      
      This is how it works, roughly:
      
        1. acpi_bus_scan() finds the handle of a PCI root bridge,
           creates a struct acpi_device object for it and passes that
           object to acpi_pci_root_add().
      
        2. acpi_pci_root_add() creates a struct acpi_pci_root object,
           populates its "device" field with its argument's address
           (device->handle is the ACPI handle found in step 1).
      
        3. The struct acpi_pci_root object created in step 2 is passed
           to pci_acpi_scan_root() and used to get resources that are
           passed to pci_create_root_bus().
      
        4. pci_create_root_bus() creates a struct pci_host_bridge object
           and passes its "dev" member to device_register().
      
        5. platform_notify(), which for systems with ACPI is set to
           acpi_platform_notify(), is called.
      
      So far, so good.  Now it starts to be "interesting".
      
        6. acpi_find_bridge_device() is used to find the ACPI handle of
           the given device (which is the PCI root bridge) and executes
           acpi_pci_find_root_bridge(), among other things, for the
           given device object.
      
        7. acpi_pci_find_root_bridge() uses the name (sic!) of the given
           device object to extract the segment and bus numbers of the PCI
           root bridge and passes them to acpi_get_pci_rootbridge_handle().
      
        8. acpi_get_pci_rootbridge_handle() browses the list of ACPI PCI
           root bridges and finds the one that matches the given segment
           and bus numbers.  Its handle is then used to initialize the
           ACPI handle of the PCI root bridge's device object by
           acpi_bind_one().  However, this is *exactly* the ACPI handle we
           started with in step 1.
      
      Needless to say, this is quite embarassing, but it may be avoided
      thanks to commit f3fd0c8a (ACPI: Allow ACPI handles of devices to be
      initialized in advance), which makes it possible to initialize the
      ACPI handle of a device before passing it to device_register().
      
      Accordingly, add a new __weak routine, pcibios_root_bridge_prepare(),
      defaulting to an empty implementation that can be replaced by the
      interested architecutres (x86 and ia64 at the moment) with functions
      that will set the root bridge's ACPI handle before its dev member is
      passed to device_register().  Make both x86 and ia64 provide such
      implementations of pcibios_root_bridge_prepare() and remove
      acpi_pci_find_root_bridge() and acpi_get_pci_rootbridge_handle() that
      aren't necessary any more.
      
      Included is a fix for breakage on systems with non-ACPI PCI host
      bridges from Bjorn Helgaas.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      6c0cc950
  18. 03 1月, 2013 8 次提交