diff options
author | Puthikorn Voravootivat <puthik@chromium.org> | 2014-10-22 03:15:37 +0200 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2015-01-21 20:03:31 +0100 |
commit | 90f04a28fbadbc179ee6325fd4ee7d5beb27bcf0 (patch) | |
tree | c255eea21c048bd6d121cf80d73ce3f6c216f030 /drivers/power | |
parent | bq27x00_battery: fix register offset for bq27425 (diff) | |
download | linux-90f04a28fbadbc179ee6325fd4ee7d5beb27bcf0.tar.xz linux-90f04a28fbadbc179ee6325fd4ee7d5beb27bcf0.zip |
bq27x00_battery: Call power_supply_changed only when capacity changed
In current driver, power_supply_changed() is called whenever any of
the battery attribute changed. This causes kernel to increases the
'/sys/power/wakeup_count' and make suspend not working correctly.
This patch change this behavior to call power_supply_changed()
only when the battery capacity changed.
Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org>
Reviewed-by: David Riley <davidriley@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/bq27x00_battery.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c index baae2151cb9a..b72ba7c1bd69 100644 --- a/drivers/power/bq27x00_battery.c +++ b/drivers/power/bq27x00_battery.c @@ -497,10 +497,11 @@ static void bq27x00_update(struct bq27x00_device_info *di) di->charge_design_full = bq27x00_battery_read_ilmd(di); } - if (memcmp(&di->cache, &cache, sizeof(cache)) != 0) { - di->cache = cache; + if (di->cache.capacity != cache.capacity) power_supply_changed(&di->bat); - } + + if (memcmp(&di->cache, &cache, sizeof(cache)) != 0) + di->cache = cache; di->last_update = jiffies; } |