Skip to content

Commit

Permalink
ab8500_fg: use jiffies_to_msecs for jiffies conversion
Browse files Browse the repository at this point in the history
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 <hofrat@osadl.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
  • Loading branch information
Nicholas Mc Guire authored and Sebastian Reichel committed Feb 25, 2015
1 parent 5ae6e2a commit 298631e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/power/ab8500_fg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 298631e

Please sign in to comment.