mbox series

[v2,00/10] power: supply: bq27xxx/bq25890 status update fixes

Message ID 20230415182341.86916-1-hdegoede@redhat.com (mailing list archive)
Headers show
Series power: supply: bq27xxx/bq25890 status update fixes | expand

Message

Hans de Goede April 15, 2023, 6:23 p.m. UTC
Hi all,

Here is v2 if my bq* status update fixes series

Changes in v2:
- Do not use bq->charger in bq25890_external_power_changed(),
  because it may not be set yet (avoid NULL ptr deref on race)
- Add "power: supply: bq24190: Call power_supply_changed()
  after updating input current" to the series

The main goal of this series is to fix userspace sometimes not
getting notified in a timely manner of charging <-> discharging
status changes, causing e.g. battery status icons to lag
and the lagging of updates also effects power_supply_leds.c .

While working on this I noticed a number of races surrounding
bq27xxx_battery_update(), so patches 1-4 fix those first.

Patches 5-10 take care of the status update lagging issues.

Regards,

Hans


Hans de Goede (10):
  power: supply: bq27xxx: Fix bq27xxx_battery_update() race condition
  power: supply: bq27xxx: Fix I2C IRQ race on remove
  power: supply: bq27xxx: Fix poll_interval handling and races on remove
  power: supply: bq27xxx: Add cache parameter to
    bq27xxx_battery_current_and_status()
  power: supply: bq27xxx: Move bq27xxx_battery_update() down
  power: supply: bq27xxx: Ensure power_supply_changed() is called on
    current sign changes
  power: supply: bq27xxx: After charger plug in/out wait 0.5s for things
    to stabilize
  power: supply: bq27xxx: Use mod_delayed_work() instead of cancel() +
    schedule()
  power: supply: bq25890: Call power_supply_changed() after updating
    input current or voltage
  power: supply: bq24190: Call power_supply_changed() after updating
    input current

 drivers/power/supply/bq24190_charger.c     |   1 +
 drivers/power/supply/bq25890_charger.c     |   3 +
 drivers/power/supply/bq27xxx_battery.c     | 181 +++++++++++----------
 drivers/power/supply/bq27xxx_battery_i2c.c |   3 +-
 include/linux/power/bq27xxx_battery.h      |   4 +
 5 files changed, 108 insertions(+), 84 deletions(-)

Comments

Sebastian Reichel May 8, 2023, 1:30 p.m. UTC | #1
Hi,

On Sat, Apr 15, 2023 at 08:23:31PM +0200, Hans de Goede wrote:
> Hi all,
> 
> Here is v2 if my bq* status update fixes series
> 
> Changes in v2:
> - Do not use bq->charger in bq25890_external_power_changed(),
>   because it may not be set yet (avoid NULL ptr deref on race)
> - Add "power: supply: bq24190: Call power_supply_changed()
>   after updating input current" to the series
> 
> The main goal of this series is to fix userspace sometimes not
> getting notified in a timely manner of charging <-> discharging
> status changes, causing e.g. battery status icons to lag
> and the lagging of updates also effects power_supply_leds.c .
> 
> While working on this I noticed a number of races surrounding
> bq27xxx_battery_update(), so patches 1-4 fix those first.
> 
> Patches 5-10 take care of the status update lagging issues.
> 
> Regards,
> 
> Hans

Thanks, I queued to the full series to my fixes branch.

-- Sebastian

> 
> 
> Hans de Goede (10):
>   power: supply: bq27xxx: Fix bq27xxx_battery_update() race condition
>   power: supply: bq27xxx: Fix I2C IRQ race on remove
>   power: supply: bq27xxx: Fix poll_interval handling and races on remove
>   power: supply: bq27xxx: Add cache parameter to
>     bq27xxx_battery_current_and_status()
>   power: supply: bq27xxx: Move bq27xxx_battery_update() down
>   power: supply: bq27xxx: Ensure power_supply_changed() is called on
>     current sign changes
>   power: supply: bq27xxx: After charger plug in/out wait 0.5s for things
>     to stabilize
>   power: supply: bq27xxx: Use mod_delayed_work() instead of cancel() +
>     schedule()
>   power: supply: bq25890: Call power_supply_changed() after updating
>     input current or voltage
>   power: supply: bq24190: Call power_supply_changed() after updating
>     input current
> 
>  drivers/power/supply/bq24190_charger.c     |   1 +
>  drivers/power/supply/bq25890_charger.c     |   3 +
>  drivers/power/supply/bq27xxx_battery.c     | 181 +++++++++++----------
>  drivers/power/supply/bq27xxx_battery_i2c.c |   3 +-
>  include/linux/power/bq27xxx_battery.h      |   4 +
>  5 files changed, 108 insertions(+), 84 deletions(-)
> 
> -- 
> 2.39.1
>