public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel
@ 2013-01-09 11:34 Axel Lin
  2013-01-10 12:56 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2013-01-09 11:34 UTC (permalink / raw)
  To: Mark Brown
  Cc: Thomas Abraham, Kyungmin Park, MyungJoo Ham, Liam Girdwood,
	linux-kernel

Use DIV_ROUND_UP to prevent truncation by integer division issue.
This ensures we return enough delay time.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
v2: Only fix integer division truncation issue, remove other optimization.
 drivers/regulator/max8998.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c
index 06be8cc..1f0df40 100644
--- a/drivers/regulator/max8998.c
+++ b/drivers/regulator/max8998.c
@@ -447,7 +447,7 @@ static int max8998_set_voltage_buck_time_sel(struct regulator_dev *rdev,
 
 	difference = (new_selector - old_selector) * desc->step / 1000;
 	if (difference > 0)
-		return difference / ((val & 0x0f) + 1);
+		return DIV_ROUND_UP(difference, (val & 0x0f) + 1);
 
 	return 0;
 }
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel
  2013-01-09 11:34 [PATCH v2] regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel Axel Lin
@ 2013-01-10 12:56 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2013-01-10 12:56 UTC (permalink / raw)
  To: Axel Lin
  Cc: Thomas Abraham, Kyungmin Park, MyungJoo Ham, Liam Girdwood,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 188 bytes --]

On Wed, Jan 09, 2013 at 07:34:57PM +0800, Axel Lin wrote:
> Use DIV_ROUND_UP to prevent truncation by integer division issue.
> This ensures we return enough delay time.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-10 12:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-09 11:34 [PATCH v2] regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel Axel Lin
2013-01-10 12:56 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox