1. 10 11月, 2020 1 次提交
  2. 22 6月, 2020 1 次提交
  3. 04 3月, 2020 1 次提交
  4. 04 2月, 2020 1 次提交
  5. 16 12月, 2019 3 次提交
    • H
      ACPI / battery: Deal better with neither design nor full capacity not being reported · ff3154d1
      Hans de Goede 提交于
      Commit b41901a2 ("ACPI / battery: Do not export energy_full[_design] on
      devices without full_charge_capacity") added support for some (broken)
      devices which always report 0 for both design_capacity and
      full_charge_capacity.
      
      Since the device that commit was written as a fix for is not reporting any
      form of "full" capacity we cannot calculate the value for the
      POWER_SUPPLY_PROP_CAPACITY, this is worked around by using an alternative
      array of available properties which does not contain this property.
      
      This is necessary because userspace (upower) treats us returning -ENODEV
      as 0 and then typically will trigger an emergency shutdown because of that.
      Userspace does not do this if the capacity sysfs attribute is not present
      at all.
      
      There are two potential problems with that commit:
       1) It assumes that both full_charge- and design-capacity are broken at the
          same time and only checks if full_charge- is broken.
       2) It assumes that this only ever happens for devices which report energy
          units rather then charge units.
      
      This commit fixes both issues by only using the alternative
      array of available properties if both full_charge- and design-capacity are
      broken and by also adding an alternative array of available properties for
      devices using mA units.
      
      Fixes: b41901a2 ("ACPI / battery: Do not export energy_full[_design] on devices without full_charge_capacity")
      Cc: 4.19+ <stable@vger.kernel.org> # 4.19+
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ff3154d1
    • H
      ACPI / battery: Use design-cap for capacity calculations if full-cap is not available · 5b74d1d1
      Hans de Goede 提交于
      The ThunderSoft TS178 tablet's _BIX implementation reports design_capacity
      but not full_charge_capacity.
      
      Before this commit this would cause us to return -ENODEV for the capacity
      attribute, which userspace does not like. Specifically upower does this:
      
              if (sysfs_file_exists (native_path, "capacity")) {
                      percentage = sysfs_get_double (native_path, "capacity");
      
      Where the sysfs_get_double() helper returns 0 when we return -ENODEV,
      so the battery always reads 0% if we return -ENODEV.
      
      This commit fixes this by using the design-capacity instead of the
      full-charge-capacity when the full-charge-capacity is not available.
      
      Fixes: b41901a2 ("ACPI / battery: Do not export energy_full[_design] on devices without full_charge_capacity")
      Cc: 4.19+ <stable@vger.kernel.org> # 4.19+
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      5b74d1d1
    • H
      ACPI / battery: Deal with design or full capacity being reported as -1 · cc99f0ad
      Hans de Goede 提交于
      Commit b41901a2 ("ACPI / battery: Do not export energy_full[_design]
      on devices without full_charge_capacity") added support for some (broken)
      devices which always report 0 for both design- and full_charge-capacity.
      
      This assumes that if the capacity is not being reported it is 0. The
      ThunderSoft TS178 tablet's _BIX implementation falsifies this assumption.
      It reports ACPI_BATTERY_VALUE_UNKNOWN (-1) as full_charge_capacity, which
      we treat as a valid value which causes several problems.
      
      This commit fixes this by adding a new ACPI_BATTERY_CAPACITY_VALID() helper
      which checks that the value is not 0 and not -1; and using this whenever we
      need to test if either design_capacity or full_charge_capacity is valid.
      
      Fixes: b41901a2 ("ACPI / battery: Do not export energy_full[_design] on devices without full_charge_capacity")
      Cc: 4.19+ <stable@vger.kernel.org> # 4.19+
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      cc99f0ad
  6. 18 10月, 2019 1 次提交
  7. 31 5月, 2019 1 次提交
    • T
      treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 · c942fddf
      Thomas Gleixner 提交于
      Based on 3 normalized pattern(s):
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version this program is distributed in the
        hope that it will be useful but without any warranty without even
        the implied warranty of merchantability or fitness for a particular
        purpose see the gnu general public license for more details
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version [author] [kishon] [vijay] [abraham]
        [i] [kishon]@[ti] [com] this program is distributed in the hope that
        it will be useful but without any warranty without even the implied
        warranty of merchantability or fitness for a particular purpose see
        the gnu general public license for more details
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version [author] [graeme] [gregory]
        [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i]
        [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema]
        [hk] [hemahk]@[ti] [com] this program is distributed in the hope
        that it will be useful but without any warranty without even the
        implied warranty of merchantability or fitness for a particular
        purpose see the gnu general public license for more details
      
      extracted by the scancode license scanner the SPDX license identifier
      
        GPL-2.0-or-later
      
      has been chosen to replace the boilerplate/reference in 1105 file(s).
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NAllison Randal <allison@lohutok.net>
      Reviewed-by: NRichard Fontana <rfontana@redhat.com>
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Cc: linux-spdx@vger.kernel.org
      Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c942fddf
  8. 09 8月, 2018 1 次提交
  9. 25 7月, 2018 4 次提交
  10. 24 7月, 2018 1 次提交
  11. 04 7月, 2018 1 次提交
  12. 16 5月, 2018 1 次提交
  13. 10 5月, 2018 1 次提交
    • C
      ACPI / battery: Add quirk to avoid checking for PMIC with native driver · ec625a37
      Carlo Caione 提交于
      With commit dccfae6d (ACPI / battery: Add a blacklist with PMIC ACPI
      HIDs with a native battery driver) a blacklist was introduced to avoid
      using the ACPI drivers for the battery when a native PMIC driver was
      already present. While this is in general a good idea (because of broken
      DSDT or proprietary and undocumented ACPI opregions for the ACPI battery
      devices) there are some Cherry Trail devices which use a separate FG
      controller despite the AXP288 having a builtin FG.
      
      The net effect of blacklisting the ACPI drivers is that on these devices
      the battery reporting is broken since the AXP288 PMIC FG bits are not
      actually used on this hardware.
      
      This commit adds a battery_do_not_check_pmic quirk for this and sets
      this on the 2 devices currently known to use a separate FG controller,
      the ECS EF20EA and the Lenovo Ideapad Miix 320.
      
      [hdegoede@redhat.com: Merge the quirk handling and the adding of the DMI
       table entry into 1 commit, add a second DMI entry for the Miix 320.]
      Signed-off-by: NCarlo Caione <carlo@endlessm.com>
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ec625a37
  14. 02 5月, 2018 3 次提交
    • H
      ACPI / battery: Ignore AC state in handle_discharging on systems where it is broken · 1b799c5c
      Hans de Goede 提交于
      On some devices the "AC" interface ACPI AML code uses the exact same broken
      logic which is causing the battery code to wrongly report discharging to
      determine the "AC" state. Specifically the ACPI AML code is checking the
      charging status bits of the charger-IC rather then the vbus present or
      power-good status bits.
      
      This makes our workaround for devices which wrongly report discharging when
      plugged into AC while the charge is above the start charging threshold not
      work on these devices.
      
      This commit adds a battery_ac_is_broken flag and when that is set it skips
      the power_supply_is_system_supplied() check in the workaround fixing this.
      
      This flag gets set by a DMI quirk selected by systems where we know the AC
      AML code is broken in this way *and* the rate_now value can be trusted.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      1b799c5c
    • H
      ACPI / battery: Add handling for devices which wrongly report discharging state · 19fffc84
      Hans de Goede 提交于
      On quite a few devices the battery code in the ACPI tables is buggy and
      first checks the charging status bits of the charger-IC, and if those
      report not charging it will report discharging, without looking at the
      presence of AC power or at the battery dis(charge) current from the
      fuel-gauge.
      
      This causes the wrong status to be reported for the battery in the
      following quite common scenario:
      
      1) Plug in charger while battery is say half full, battery starts
      charging, charging state bits indicate: pre-charge or fast-charge,
      ACPI reported battery status is ok
      
      2) When fully charged charging state bits indicate: end-of-charge,
      ACPI reported battery status is ok
      
      3) unplug the charger, wait 1 minute, replug. Now the battery voltage is
      still above the start-charging threshold, so the charger will not start
      charging to avoid wrecking the battery by repeatedly recharging the last 1%
      capacity. The charger IC charging state bits now are all 0 (not-charging)
      and the broken ACPI code wrongly translate this to "discharging" and ends
      up setting the ACPI_BATTERY_STATE_DISCHARGING bit in its state field.
      
      Reporting this "not charging" state as discharging is confusing for users,
      making the user think his adapter/power-brick is broken or not properly
      plugged in.
      
      This commit adds a helper for handling the ACPI_BATTERY_STATE_DISCHARGING
      state. This helper checks if we're an AC and the current going out of the
      battery is 0 and in that case reports a status of "not charging" to
      userspace rather then "discharging".
      
      This replaces commit c68f0676 ("ACPI / battery: Add quirk for Asus
      GL502VSK and UX305LA"), a previous fix for this which was reverted.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Reviewed-by: NDaniel Drake <drake@endlessm.com>
      Reviewed-by: NSebastian Reichel <sebastian.reichel@collabora.co.uk>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      19fffc84
    • H
      ACPI / battery: Remove initializer for unused ident dmi_system_id · 91afa076
      Hans de Goede 提交于
      The battery code does not use the dmi_system_id ident member, so there is
      no need to initialize it. This saves us storing the unused strings as
      as const data.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      91afa076
  15. 19 3月, 2018 1 次提交
    • D
      Revert "ACPI / battery: Add quirk for Asus GL502VSK and UX305LA" · 82bf43b2
      Daniel Drake 提交于
      Revert commit c68f0676 ("ACPI / battery: Add quirk for Asus
      GL502VSK and UX305LA") and commit 4446823e ("ACPI / battery: Add
      quirk for Asus UX360UA and UX410UAK").
      
      On many many Asus products, the battery is sometimes reported as
      charging or discharging even when it is full and you are on AC power.
      This change quirked the kernel to avoid advertising the discharging
      state when this happens on 4 laptop models, under the belief that
      this was incorrect information.  I presume it originates from user
      reports who are confused that their battery status icon says that it
      is discharging.
      
      However, the reported information is indeed correct, and the quirk
      approach taken is inadequate and more thought is needed first.
      Specifically:
      
       1. It only quirks discharging state, not charging
      
       2. There are so many different Asus products and DMI naming variants
          within those product families that behave this way; Linux could
          grow to quirk hundreds of products and still not even be close at
          "winning" this battle.
      
       3. Asus previously clarified that this behaviour is intentional. The
          platform will periodically do a partial discharge/charge cycle
          when the battery is full, because this is one way to extend the
          lifetime of the battery (leaving a battery at 100% charge and
          unused will decrease its usable capacity over time).
      
          My understanding is that any decent consumer product will have
          this behaviour, but it appears that Asus is different in that
          they expose this info through ACPI.
      
          However, the behaviour seems correct. The ACPI spec does not
          suggest in that the platform should hide the truth.  It lets you
          report that the battery is full of charge, and discharging, and
          with external power connected; and Asus does this.
      
       4. In terms of not confusing the user, this seems like something that
          could/should be handled by userspace, which can also detect these
          same (accurate) conditions in the general case.
      
      Revert this quirk before it gets included in a release, while we look
      for better approaches.
      Signed-off-by: NDaniel Drake <drake@endlessm.com>
      Acked-by: NKai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      82bf43b2
  16. 13 3月, 2018 1 次提交
  17. 28 2月, 2018 2 次提交
  18. 22 2月, 2018 2 次提交
    • O
      ACPI: battery: Add the ThinkPad "Not Charging" quirk · 91eea70e
      Ognjen Galic 提交于
      The EC/ACPI firmware on Lenovo ThinkPads used to report a status
      of "Unknown" when the battery is between the charge start and
      charge stop thresholds. On Windows, it reports "Not Charging"
      so the quirk has been added to also report correctly.
      
      Now the "status" attribute returns "Not Charging" when the
      battery on ThinkPads is not physicaly charging.
      Reviewed-by: NAndy Shevchenko <andy.shevchenko@gmail.com>
      Signed-off-by: NOgnjen Galic <smclt30p@gmail.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      91eea70e
    • O
      battery: Add the battery hooking API · fa93854f
      Ognjen Galic 提交于
      This is a patch that implements a generic hooking API for the
      generic ACPI battery driver.
      
      With this new generic API, drivers can expose platform specific
      behaviour via sysfs attributes in /sys/class/power_supply/BATn/
      in a generic way.
      
      A perfect example of the need for this API are Lenovo ThinkPads.
      
      Lenovo ThinkPads have a ACPI extension that allows the setting of
      start and stop charge thresholds in the EC and battery firmware
      via ACPI. The thinkpad_acpi module can use this API to expose
      sysfs attributes that it controls inside the ACPI battery driver
      sysfs tree, under /sys/class/power_supply/BATN/.
      
      The file drivers/acpi/battery.h has been moved to
      include/acpi/battery.h and the includes inside ac.c, sbs.c, and
      battery.c have been adjusted to reflect that.
      
      When drivers hooks into the API, the API calls add_battery() for
      each battery in the system that passes it a acpi_battery
      struct. Then, the drivers can use device_create_file() to create
      new sysfs attributes with that struct and identify the batteries
      for per-battery attributes.
      Signed-off-by: NOgnjen Galic <smclt30p@gmail.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      fa93854f
  19. 04 2月, 2018 1 次提交
  20. 18 12月, 2017 1 次提交
  21. 13 12月, 2017 1 次提交
  22. 24 8月, 2017 1 次提交
  23. 15 6月, 2017 1 次提交
    • R
      ACPI / PM: Ignore spurious SCI wakeups from suspend-to-idle · 33e4f80e
      Rafael J. Wysocki 提交于
      The ACPI SCI (System Control Interrupt) is set up as a wakeup IRQ
      during suspend-to-idle transitions and, consequently, any events
      signaled through it wake up the system from that state.  However,
      on some systems some of the events signaled via the ACPI SCI while
      suspended to idle should not cause the system to wake up.  In fact,
      quite often they should just be discarded.
      
      Arguably, systems should not resume entirely on such events, but in
      order to decide which events really should cause the system to resume
      and which are spurious, it is necessary to resume up to the point
      when ACPI SCIs are actually handled and processed, which is after
      executing dpm_resume_noirq() in the system resume path.
      
      For this reasons, add a loop around freeze_enter() in which the
      platforms can process events signaled via multiplexed IRQ lines
      like the ACPI SCI and add suspend-to-idle hooks that can be
      used for this purpose to struct platform_freeze_ops.
      
      In the ACPI case, the ->wake hook is used for checking if the SCI
      has triggered while suspended and deferring the interrupt-induced
      system wakeup until the events signaled through it are actually
      processed sufficiently to decide whether or not the system should
      resume.  In turn, the ->sync hook allows all of the relevant event
      queues to be flushed so as to prevent events from being missed due
      to race conditions.
      
      In addition to that, some ACPI code processing wakeup events needs
      to be modified to use the "hard" version of wakeup triggers, so that
      it will cause a system resume to happen on device-induced wakeup
      events even if the "soft" mechanism to prevent the system from
      suspending is not enabled.  However, to preserve the existing
      behavior with respect to suspend-to-RAM, this only is done in
      the suspend-to-idle case and only if an SCI has occurred while
      suspended.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      33e4f80e
  24. 07 6月, 2017 1 次提交
  25. 06 5月, 2017 1 次提交
    • R
      ACPI / sleep: Ignore spurious SCI wakeups from suspend-to-idle · eed4d47e
      Rafael J. Wysocki 提交于
      The ACPI SCI (System Control Interrupt) is set up as a wakeup IRQ
      during suspend-to-idle transitions and, consequently, any events
      signaled through it wake up the system from that state.  However,
      on some systems some of the events signaled via the ACPI SCI while
      suspended to idle should not cause the system to wake up.  In fact,
      quite often they should just be discarded.
      
      Arguably, systems should not resume entirely on such events, but in
      order to decide which events really should cause the system to resume
      and which are spurious, it is necessary to resume up to the point
      when ACPI SCIs are actually handled and processed, which is after
      executing dpm_resume_noirq() in the system resume path.
      
      For this reasons, add a loop around freeze_enter() in which the
      platforms can process events signaled via multiplexed IRQ lines
      like the ACPI SCI and add suspend-to-idle hooks that can be
      used for this purpose to struct platform_freeze_ops.
      
      In the ACPI case, the ->wake hook is used for checking if the SCI
      has triggered while suspended and deferring the interrupt-induced
      system wakeup until the events signaled through it are actually
      processed sufficiently to decide whether or not the system should
      resume.  In turn, the ->sync hook allows all of the relevant event
      queues to be flushed so as to prevent events from being missed due
      to race conditions.
      
      In addition to that, some ACPI code processing wakeup events needs
      to be modified to use the "hard" version of wakeup triggers, so that
      it will cause a system resume to happen on device-induced wakeup
      events even if the "soft" mechanism to prevent the system from
      suspending is not enabled (that also helps to catch device-induced
      wakeup events occurring during suspend transitions in progress).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      eed4d47e
  26. 20 4月, 2017 2 次提交
  27. 25 12月, 2016 1 次提交
  28. 17 11月, 2016 1 次提交
    • D
      ACPI / battery: If _BIX fails, retry with _BIF · 2d09af4a
      Dave Lambley 提交于
      The Lenovo Yoga 300 laptop's firmware advertises that it provides the _BIX
      the method to retrieve battery information. Unfortunately (some versions
      of?) the implementation return with an error.
      
      [   21.712228] ACPI Exception: AE_AML_PACKAGE_LIMIT, Index (0x000000010) is beyond end of object (length 0xD) (20160422/exoparg2-427)
      [   21.712244] ACPI Error: Method parse/execution failed [\_SB.PCI0.LPCB.H_EC.BAT1._BIX] (Node ffff95f8ff0b20f0), AE_AML_PACKAGE_LIMIT (20160422/psparse-542)
      
      The _BIF method does succeed and returns convincing data. We detect _BIX
      failing and automatically retry with _BIF.
      Signed-off-by: NDave Lambley <linux@davel.me.uk>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      2d09af4a
  29. 31 8月, 2016 1 次提交
    • C
      ACPI / battery: Add sysfs representation after checking _BST · 12c78ca2
      Carlos Garnacho 提交于
      Thus move sysfs_add_battery() after acpi_battery_get_state(), which doesn't
      require the power_supply. Prevents possible hanged tasks if
      acpi_battery_get_state() fails consistently (and takes a long time in doing
      so) when called inside acpi_battery_add().
      
      In this situation the battery module first calls sysfs_add_battery(),
      which creates a power_supply, which spawns an async
      power_supply_deferred_register_work() task, which shall try to hold the
      parent battery device mutex (being already held) so this register work
      is set up after device initialization. If initialization takes long enough
      the thread will be eventually run and try to hold the mutex before
      acpi_battery_add() had the chance to finish.
      
      Eventually the 5 retries in acpi_battery_update_retry() fail, the error
      state is propagated, and results in sysfs_remove_battery() being called
      within the error handling paths of acpi_battery_add(), and the power_supply
      tear down too.
      
      This triggers a cancel_delayed_work_sync() of the deferred_register_work
      task, which ends up in schedule(). The end result is that the deferred
      task is blocked trying to acquire the parent device mutex, which is not
      released because the thread doing initialization (and failure handling)
      went to sleep awaiting for the deferred task to be cancelled.
      
      The hanged tasks look like this:
      
      INFO: task kworker/u8:0:6 blocked for more than 120 seconds.
       ...
      Call Trace:
       [<ffffffff815daec5>] schedule+0x35/0x80
       [<ffffffff815dda3c>] schedule_timeout+0x1ec/0x250
       [<ffffffff810a0572>] ? check_preempt_curr+0x52/0x90
       [<ffffffff810a05c9>] ? ttwu_do_wakeup+0x19/0xe0
       [<ffffffff815db915>] wait_for_common+0xc5/0x190
       [<ffffffff810a1500>] ? wake_up_q+0x70/0x70
       [<ffffffff815db9fd>] wait_for_completion+0x1d/0x20
       [<ffffffff8108ffb1>] flush_work+0x111/0x1c0
       [<ffffffff8108dfe0>] ? flush_workqueue_prep_pwqs+0x1a0/0x1a0
       [<ffffffff810909af>] __cancel_work_timer+0x9f/0x1d0
       [<ffffffff81090b13>] cancel_delayed_work_sync+0x13/0x20
       [<ffffffff8147ac67>] power_supply_unregister+0x37/0xc0
       [<ffffffffa058b03d>] sysfs_remove_battery+0x3d/0x52 [battery]
       [<ffffffffa058bf3a>] acpi_battery_add+0x112/0x181 [battery]
       [<ffffffff81366db6>] acpi_device_probe+0x54/0x19b
       [<ffffffff81427e9c>] driver_probe_device+0x22c/0x440
       [<ffffffff81428181>] __driver_attach+0xd1/0xf0
       [<ffffffff814280b0>] ? driver_probe_device+0x440/0x440
       [<ffffffff8142591c>] bus_for_each_dev+0x6c/0xc0
       [<ffffffff8142758e>] driver_attach+0x1e/0x20
       [<ffffffff81426fc3>] bus_add_driver+0x1c3/0x280
       [<ffffffff81428b00>] driver_register+0x60/0xe0
       [<ffffffff81366c80>] acpi_bus_register_driver+0x3b/0x43
       [<ffffffffa0591040>] acpi_battery_init_async+0x1c/0x1e [battery]
       [<ffffffff81099268>] async_run_entry_fn+0x48/0x150
       [<ffffffff81090d09>] process_one_work+0x1e9/0x440
       [<ffffffff81090fab>] worker_thread+0x4b/0x4f0
       [<ffffffff81090f60>] ? process_one_work+0x440/0x440
       [<ffffffff81096b58>] kthread+0xd8/0xf0
       [<ffffffff815de97f>] ret_from_fork+0x1f/0x40
       [<ffffffff81096a80>] ? kthread_worker_fn+0x180/0x180
      
      INFO: task kworker/u8:4:282 blocked for more than 120 seconds.
       ...
      Call Trace:
       [<ffffffff810ad745>] ? put_prev_entity+0x35/0x8b0
       [<ffffffff815daec5>] schedule+0x35/0x80
       [<ffffffff815db14e>] schedule_preempt_disabled+0xe/0x10
       [<ffffffff815dc533>] __mutex_lock_slowpath+0xb3/0x120
       [<ffffffff815dc5bf>] mutex_lock+0x1f/0x30
       [<ffffffff8147a59b>] power_supply_deferred_register_work+0x2b/0x50
       [<ffffffff81090d09>] process_one_work+0x1e9/0x440
       [<ffffffff81090fab>] worker_thread+0x4b/0x4f0
       [<ffffffff81090f60>] ? process_one_work+0x440/0x440
       [<ffffffff81090f60>] ? process_one_work+0x440/0x440
       [<ffffffff81096b58>] kthread+0xd8/0xf0
       [<ffffffff815de97f>] ret_from_fork+0x1f/0x40
       [<ffffffff81096a80>] ? kthread_worker_fn+0x180/0x180
      
      Making sysfs_add_battery() the last operation here means that the
      power_supply won't be created yet when the acpi_add_battery() failure
      handling happens, the deferred task won't even spawn, and
      sysfs_remove_battery will just skip over the NULL battery->bat.
      Signed-off-by: NCarlos Garnacho <carlosg@gnome.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      12c78ca2
  30. 21 5月, 2016 1 次提交
    • C
      ACPI / battery: Correctly serialise with the pending async probe · 5dfa0c73
      Chris Wilson 提交于
      async_synchronize_cookie() only serialises all tasks up to the specified
      cookie, and importantly does not wait for the task corresponding with
      the cookie. [This is so that it can be trivially used from inside the
      async_func_t in order to serialise with all preceding tasks.] In order
      to serialise with acpi_battery_init_async() we need to compensate and
      pass in the next cookie instead.
      
      The impact today is zero since performing an async_schedule() from inside
      a module init function will trigger an async_synchronize_full() prior to
      the module loader's completion. However, if the probe was moved to its
      own unregistered async_domain, then the async_synchronize_cookie would
      be replaced with an async_synchronize_full_domain.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      5dfa0c73