summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLadislav Michl <ladis@linux-mips.org>2018-03-21 16:50:00 +0100
committerSebastian Reichel <sebastian.reichel@collabora.co.uk>2018-04-26 00:01:27 +0200
commit111242d6e1aa0cbdf1dd91fff6f210ae0d4d01bc (patch)
tree403c56798556b808f994b176468e292e746a6900 /drivers
parentpower: supply: sysfs: Use enum to specify property (diff)
downloadlinux-111242d6e1aa0cbdf1dd91fff6f210ae0d4d01bc.tar.xz
linux-111242d6e1aa0cbdf1dd91fff6f210ae0d4d01bc.zip
power: supply: charger-manager: Verify polling interval only when polling requested
Driver bails out with -EINVAL when no polling specififaion is requested. Fix that by verifing polling interval only if polling_mode is different from CM_POLL_DISABLE. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/power/supply/charger-manager.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c
index 1de4b4493824..2a50b4654793 100644
--- a/drivers/power/supply/charger-manager.c
+++ b/drivers/power/supply/charger-manager.c
@@ -1700,8 +1700,9 @@ static int charger_manager_probe(struct platform_device *pdev)
power_supply_put(psy);
}
- if (desc->polling_interval_ms == 0 ||
- msecs_to_jiffies(desc->polling_interval_ms) <= CM_JIFFIES_SMALL) {
+ if (cm->desc->polling_mode != CM_POLL_DISABLE &&
+ (desc->polling_interval_ms == 0 ||
+ msecs_to_jiffies(desc->polling_interval_ms) <= CM_JIFFIES_SMALL)) {
dev_err(&pdev->dev, "polling_interval_ms is too small\n");
return -EINVAL;
}