diff options
author | Matt Ranostay <mranostay@gmail.com> | 2016-10-01 00:45:30 -0400 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2016-10-18 23:06:28 -0400 |
commit | 950b6c2d110e8df65b9d2704cc7039f3d0d9f7b2 (patch) | |
tree | 205f5a3dfec7543484920eaf9671f0945c52c595 | |
parent | 32c52eff6a27798706487e042fae7bac6dd73576 (diff) |
power: supply: bq27xxx_battery: don't update poll_interval param if same
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>
-rw-r--r-- | drivers/power/supply/bq27xxx_battery.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c index 3b0dbc689d72..0c343a0c941e 100644 --- a/drivers/power/supply/bq27xxx_battery.c +++ b/drivers/power/supply/bq27xxx_battery.c | |||
@@ -397,10 +397,11 @@ static LIST_HEAD(bq27xxx_battery_devices); | |||
397 | static int poll_interval_param_set(const char *val, const struct kernel_param *kp) | 397 | static int poll_interval_param_set(const char *val, const struct kernel_param *kp) |
398 | { | 398 | { |
399 | struct bq27xxx_device_info *di; | 399 | struct bq27xxx_device_info *di; |
400 | unsigned int prev_val = *(unsigned int *) kp->arg; | ||
400 | int ret; | 401 | int ret; |
401 | 402 | ||
402 | ret = param_set_uint(val, kp); | 403 | ret = param_set_uint(val, kp); |
403 | if (ret < 0) | 404 | if (ret < 0 || prev_val == *(unsigned int *) kp->arg) |
404 | return ret; | 405 | return ret; |
405 | 406 | ||
406 | mutex_lock(&bq27xxx_list_lock); | 407 | mutex_lock(&bq27xxx_list_lock); |