From: Nicholas Mc Guire Date: Mon, 9 Feb 2015 17:21:05 +0000 (-0500) Subject: ab8500_fg: use jiffies_to_msecs for jiffies conversion X-Git-Tag: firefly_0821_release~176^2~2007^2~44 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=298631e1ecad278f9d442062035d29d9787b6994;p=firefly-linux-kernel-4.4.55.git ab8500_fg: use jiffies_to_msecs for jiffies conversion Converting jiffies to milliseconds by "val * 1000 / HZ" is technically OK but jiffies_to_msecs(val) is the cleaner solution and handles all corner cases correctly. This is a minor API consolidation only and should make things more readable. Signed-off-by: Nicholas Mc Guire Signed-off-by: Sebastian Reichel --- diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c index 73288dac0521..40344e01df80 100644 --- a/drivers/power/ab8500_fg.c +++ b/drivers/power/ab8500_fg.c @@ -629,7 +629,7 @@ int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res) &di->ab8500_fg_complete, INS_CURR_TIMEOUT); dev_dbg(di->dev, "Finalize time: %d ms\n", - ((INS_CURR_TIMEOUT - timeout) * 1000) / HZ); + jiffies_to_msecs(INS_CURR_TIMEOUT - timeout)); if (!timeout) { ret = -ETIME; disable_irq(di->irq); @@ -731,7 +731,7 @@ int ab8500_fg_inst_curr_blocking(struct ab8500_fg *di) &di->ab8500_fg_started, INS_CURR_TIMEOUT); dev_dbg(di->dev, "Start time: %d ms\n", - ((INS_CURR_TIMEOUT - timeout) * 1000) / HZ); + jiffies_to_msecs(INS_CURR_TIMEOUT - timeout)); if (!timeout) { ret = -ETIME; dev_err(di->dev, "completion timed out [%d]\n",