public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: Ensure enough enable time for max8649
@ 2011-08-02  4:54 Axel Lin
  2011-08-02  6:01 ` Mark Brown
  2011-08-08 16:44 ` Liam Girdwood
  0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2011-08-02  4:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Haojian Zhuang, Liam Girdwood, Mark Brown

Integer division may truncate the result, thus max8649_enable_time() may return
slightly shorter enable time. This patch fixes it.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/regulator/max8649.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c
index 30eb9e5..1062cf9 100644
--- a/drivers/regulator/max8649.c
+++ b/drivers/regulator/max8649.c
@@ -221,7 +221,7 @@ static int max8649_enable_time(struct regulator_dev *rdev)
 	ret = (ret & MAX8649_RAMP_MASK) >> 5;
 	rate = (32 * 1000) >> ret;	/* uV/uS */
 
-	return (voltage / rate);
+	return DIV_ROUND_UP(voltage, rate);
 }
 
 static int max8649_set_mode(struct regulator_dev *rdev, unsigned int mode)
-- 
1.7.4.1




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

* Re: [PATCH] regulator: Ensure enough enable time for max8649
  2011-08-02  4:54 [PATCH] regulator: Ensure enough enable time for max8649 Axel Lin
@ 2011-08-02  6:01 ` Mark Brown
  2011-08-08 16:44 ` Liam Girdwood
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2011-08-02  6:01 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Haojian Zhuang, Liam Girdwood

On Tue, Aug 02, 2011 at 12:54:56PM +0800, Axel Lin wrote:
> Integer division may truncate the result, thus max8649_enable_time() may return
> slightly shorter enable time. This patch fixes it.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

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

* Re: [PATCH] regulator: Ensure enough enable time for max8649
  2011-08-02  4:54 [PATCH] regulator: Ensure enough enable time for max8649 Axel Lin
  2011-08-02  6:01 ` Mark Brown
@ 2011-08-08 16:44 ` Liam Girdwood
  1 sibling, 0 replies; 3+ messages in thread
From: Liam Girdwood @ 2011-08-08 16:44 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Haojian Zhuang, Liam Girdwood, Mark Brown

On Tue, 2011-08-02 at 12:54 +0800, Axel Lin wrote:
> Integer division may truncate the result, thus max8649_enable_time() may return
> slightly shorter enable time. This patch fixes it.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
>  drivers/regulator/max8649.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c
> index 30eb9e5..1062cf9 100644
> --- a/drivers/regulator/max8649.c
> +++ b/drivers/regulator/max8649.c
> @@ -221,7 +221,7 @@ static int max8649_enable_time(struct regulator_dev *rdev)
>  	ret = (ret & MAX8649_RAMP_MASK) >> 5;
>  	rate = (32 * 1000) >> ret;	/* uV/uS */
>  
> -	return (voltage / rate);
> +	return DIV_ROUND_UP(voltage, rate);
>  }
>  
>  static int max8649_set_mode(struct regulator_dev *rdev, unsigned int mode)

Applied.

Thanks

Liam


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

end of thread, other threads:[~2011-08-08 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-02  4:54 [PATCH] regulator: Ensure enough enable time for max8649 Axel Lin
2011-08-02  6:01 ` Mark Brown
2011-08-08 16:44 ` Liam Girdwood

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