]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
power: supply: bq27xxx_battery: don't update poll_interval param if same
authorMatt Ranostay <mranostay@gmail.com>
Sat, 1 Oct 2016 04:45:30 +0000 (21:45 -0700)
committerSebastian Reichel <sre@kernel.org>
Wed, 19 Oct 2016 03:06:28 +0000 (05:06 +0200)
To avoid canceling the delayed workqueue needlessly, and scheduling an
immediate polling. Check if the new poll_interval value is different
than the previous setting.

Cc: Tony Lindgren <tony@atomide.com>
Cc: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Matt Ranostay <matt@ranostay.consulting>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
drivers/power/supply/bq27xxx_battery.c

index 3b0dbc689d7299bde340b044311ab8ad859bd726..0c343a0c941e049ab6e0bba27481969432f39eb4 100644 (file)
@@ -397,10 +397,11 @@ static LIST_HEAD(bq27xxx_battery_devices);
 static int poll_interval_param_set(const char *val, const struct kernel_param *kp)
 {
        struct bq27xxx_device_info *di;
+       unsigned int prev_val = *(unsigned int *) kp->arg;
        int ret;
 
        ret = param_set_uint(val, kp);
-       if (ret < 0)
+       if (ret < 0 || prev_val == *(unsigned int *) kp->arg)
                return ret;
 
        mutex_lock(&bq27xxx_list_lock);