public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] clk: scmi: Fix the rounding of clock rate
@ 2018-07-27 14:01 Amit Daniel Kachhap
  2018-07-27 16:37 ` Stephen Boyd
  2018-07-30 11:36 ` Sudeep Holla
  0 siblings, 2 replies; 9+ messages in thread
From: Amit Daniel Kachhap @ 2018-07-27 14:01 UTC (permalink / raw)
  To: linux-arm-kernel

This fix rounds the clock rate properly by using quotient and not
remainder in the calculation. This issue was found while testing HDMI
in the Juno platform.

Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
---
 drivers/clk/clk-scmi.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c
index bb2a6f2..a985bf5 100644
--- a/drivers/clk/clk-scmi.c
+++ b/drivers/clk/clk-scmi.c
@@ -38,7 +38,6 @@ static unsigned long scmi_clk_recalc_rate(struct clk_hw *hw,
 static long scmi_clk_round_rate(struct clk_hw *hw, unsigned long rate,
 				unsigned long *parent_rate)
 {
-	int step;
 	u64 fmin, fmax, ftmp;
 	struct scmi_clk *clk = to_scmi_clk(hw);
 
@@ -60,9 +59,9 @@ static long scmi_clk_round_rate(struct clk_hw *hw, unsigned long rate,
 
 	ftmp = rate - fmin;
 	ftmp += clk->info->range.step_size - 1; /* to round up */
-	step = do_div(ftmp, clk->info->range.step_size);
+	do_div(ftmp, clk->info->range.step_size);
 
-	return step * clk->info->range.step_size + fmin;
+	return ftmp * clk->info->range.step_size + fmin;
 }
 
 static int scmi_clk_set_rate(struct clk_hw *hw, unsigned long rate,
-- 
2.7.4

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

* [PATCH] clk: scmi: Fix the rounding of clock rate
  2018-07-27 14:01 [PATCH] clk: scmi: Fix the rounding of clock rate Amit Daniel Kachhap
@ 2018-07-27 16:37 ` Stephen Boyd
  2018-07-30  5:33   ` Amit Daniel Kachhap
  2018-07-30 11:36 ` Sudeep Holla
  1 sibling, 1 reply; 9+ messages in thread
From: Stephen Boyd @ 2018-07-27 16:37 UTC (permalink / raw)
  To: linux-arm-kernel

Quoting Amit Daniel Kachhap (2018-07-27 07:01:52)
> This fix rounds the clock rate properly by using quotient and not
> remainder in the calculation. This issue was found while testing HDMI
> in the Juno platform.
> 
> Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>

Any Fixes: tag here?

> ---
>  drivers/clk/clk-scmi.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c
> index bb2a6f2..a985bf5 100644
> --- a/drivers/clk/clk-scmi.c
> +++ b/drivers/clk/clk-scmi.c
> @@ -60,9 +59,9 @@ static long scmi_clk_round_rate(struct clk_hw *hw, unsigned long rate,
>  
>         ftmp = rate - fmin;
>         ftmp += clk->info->range.step_size - 1; /* to round up */
> -       step = do_div(ftmp, clk->info->range.step_size);
> +       do_div(ftmp, clk->info->range.step_size);
>  
> -       return step * clk->info->range.step_size + fmin;
> +       return ftmp * clk->info->range.step_size + fmin;

Good catch.

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

* [PATCH] clk: scmi: Fix the rounding of clock rate
  2018-07-27 16:37 ` Stephen Boyd
@ 2018-07-30  5:33   ` Amit Daniel Kachhap
  2018-07-30 11:40     ` Sudeep Holla
  0 siblings, 1 reply; 9+ messages in thread
From: Amit Daniel Kachhap @ 2018-07-30  5:33 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Fri, Jul 27, 2018 at 10:07 PM, Stephen Boyd <sboyd@kernel.org> wrote:
> Quoting Amit Daniel Kachhap (2018-07-27 07:01:52)
>> This fix rounds the clock rate properly by using quotient and not
>> remainder in the calculation. This issue was found while testing HDMI
>> in the Juno platform.
>>
>> Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
>
> Any Fixes: tag here?
Yes, This patch is tested with Linux v4.18-rc6 tag.
>
>> ---
>>  drivers/clk/clk-scmi.c | 5 ++---
>>  1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c
>> index bb2a6f2..a985bf5 100644
>> --- a/drivers/clk/clk-scmi.c
>> +++ b/drivers/clk/clk-scmi.c
>> @@ -60,9 +59,9 @@ static long scmi_clk_round_rate(struct clk_hw *hw, unsigned long rate,
>>
>>         ftmp = rate - fmin;
>>         ftmp += clk->info->range.step_size - 1; /* to round up */
>> -       step = do_div(ftmp, clk->info->range.step_size);
>> +       do_div(ftmp, clk->info->range.step_size);
>>
>> -       return step * clk->info->range.step_size + fmin;
>> +       return ftmp * clk->info->range.step_size + fmin;
>
> Good catch.
Thanks.
>
Regards,
Amit

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

* [PATCH] clk: scmi: Fix the rounding of clock rate
  2018-07-27 14:01 [PATCH] clk: scmi: Fix the rounding of clock rate Amit Daniel Kachhap
  2018-07-27 16:37 ` Stephen Boyd
@ 2018-07-30 11:36 ` Sudeep Holla
  1 sibling, 0 replies; 9+ messages in thread
From: Sudeep Holla @ 2018-07-30 11:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 27, 2018 at 07:31:52PM +0530, Amit Daniel Kachhap wrote:
> This fix rounds the clock rate properly by using quotient and not
> remainder in the calculation. This issue was found while testing HDMI
> in the Juno platform.
>
Good find, thanks.

Acked-by: Sudeep Holla <sudeep.holla@arm.com>

--
Regards,
Sudeep

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

* [PATCH] clk: scmi: Fix the rounding of clock rate
  2018-07-30  5:33   ` Amit Daniel Kachhap
@ 2018-07-30 11:40     ` Sudeep Holla
  2018-07-30 16:26       ` Stephen Boyd
  2018-07-31  5:21       ` Amit Daniel Kachhap
  0 siblings, 2 replies; 9+ messages in thread
From: Sudeep Holla @ 2018-07-30 11:40 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jul 30, 2018 at 11:03:51AM +0530, Amit Daniel Kachhap wrote:
> Hi,
> 
> On Fri, Jul 27, 2018 at 10:07 PM, Stephen Boyd <sboyd@kernel.org> wrote:
> > Quoting Amit Daniel Kachhap (2018-07-27 07:01:52)
> >> This fix rounds the clock rate properly by using quotient and not
> >> remainder in the calculation. This issue was found while testing HDMI
> >> in the Juno platform.
> >>
> >> Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
> >
> > Any Fixes: tag here?
> Yes, This patch is tested with Linux v4.18-rc6 tag.
>

No Stephen meant the commit that this fixes, something like below:

Fixes: 6d6a1d82eaef ("clk: add support for clocks provided by SCMI")

so that it can get backported if required.

--
Regards,
Sudeep

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

* [PATCH] clk: scmi: Fix the rounding of clock rate
  2018-07-30 11:40     ` Sudeep Holla
@ 2018-07-30 16:26       ` Stephen Boyd
  2018-07-31  5:55         ` Amit Daniel Kachhap
  2018-07-31  5:21       ` Amit Daniel Kachhap
  1 sibling, 1 reply; 9+ messages in thread
From: Stephen Boyd @ 2018-07-30 16:26 UTC (permalink / raw)
  To: linux-arm-kernel

Quoting Sudeep Holla (2018-07-30 04:40:56)
> On Mon, Jul 30, 2018 at 11:03:51AM +0530, Amit Daniel Kachhap wrote:
> > Hi,
> > 
> > On Fri, Jul 27, 2018 at 10:07 PM, Stephen Boyd <sboyd@kernel.org> wrote:
> > > Quoting Amit Daniel Kachhap (2018-07-27 07:01:52)
> > >> This fix rounds the clock rate properly by using quotient and not
> > >> remainder in the calculation. This issue was found while testing HDMI
> > >> in the Juno platform.
> > >>
> > >> Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
> > >
> > > Any Fixes: tag here?
> > Yes, This patch is tested with Linux v4.18-rc6 tag.
> >
> 
> No Stephen meant the commit that this fixes, something like below:
> 
> Fixes: 6d6a1d82eaef ("clk: add support for clocks provided by SCMI")
> 
> so that it can get backported if required.
> 

Yep! Thanks!

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

* [PATCH] clk: scmi: Fix the rounding of clock rate
  2018-07-30 11:40     ` Sudeep Holla
  2018-07-30 16:26       ` Stephen Boyd
@ 2018-07-31  5:21       ` Amit Daniel Kachhap
  1 sibling, 0 replies; 9+ messages in thread
From: Amit Daniel Kachhap @ 2018-07-31  5:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jul 30, 2018 at 5:10 PM, Sudeep Holla <sudeep.holla@arm.com> wrote:
> On Mon, Jul 30, 2018 at 11:03:51AM +0530, Amit Daniel Kachhap wrote:
>> Hi,
>>
>> On Fri, Jul 27, 2018 at 10:07 PM, Stephen Boyd <sboyd@kernel.org> wrote:
>> > Quoting Amit Daniel Kachhap (2018-07-27 07:01:52)
>> >> This fix rounds the clock rate properly by using quotient and not
>> >> remainder in the calculation. This issue was found while testing HDMI
>> >> in the Juno platform.
>> >>
>> >> Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
>> >
>> > Any Fixes: tag here?
>> Yes, This patch is tested with Linux v4.18-rc6 tag.
>>
>
> No Stephen meant the commit that this fixes, something like below:
>
> Fixes: 6d6a1d82eaef ("clk: add support for clocks provided by SCMI")
>
> so that it can get backported if required.

ok my mistake. Thanks for the clarification.

>
> --
> Regards,
> Sudeep

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

* [PATCH] clk: scmi: Fix the rounding of clock rate
  2018-07-30 16:26       ` Stephen Boyd
@ 2018-07-31  5:55         ` Amit Daniel Kachhap
  2018-08-02 20:50           ` Stephen Boyd
  0 siblings, 1 reply; 9+ messages in thread
From: Amit Daniel Kachhap @ 2018-07-31  5:55 UTC (permalink / raw)
  To: linux-arm-kernel

This fix rounds the clock rate properly by using quotient and not
remainder in the calculation. This issue was found while testing HDMI
in the Juno platform.

Fixes: 6d6a1d82eaef7 ("clk: add support for clocks provided by SCMI")
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
---
 drivers/clk/clk-scmi.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c
index bb2a6f2..a985bf5 100644
--- a/drivers/clk/clk-scmi.c
+++ b/drivers/clk/clk-scmi.c
@@ -38,7 +38,6 @@ static unsigned long scmi_clk_recalc_rate(struct clk_hw *hw,
 static long scmi_clk_round_rate(struct clk_hw *hw, unsigned long rate,
 				unsigned long *parent_rate)
 {
-	int step;
 	u64 fmin, fmax, ftmp;
 	struct scmi_clk *clk = to_scmi_clk(hw);
 
@@ -60,9 +59,9 @@ static long scmi_clk_round_rate(struct clk_hw *hw, unsigned long rate,
 
 	ftmp = rate - fmin;
 	ftmp += clk->info->range.step_size - 1; /* to round up */
-	step = do_div(ftmp, clk->info->range.step_size);
+	do_div(ftmp, clk->info->range.step_size);
 
-	return step * clk->info->range.step_size + fmin;
+	return ftmp * clk->info->range.step_size + fmin;
 }
 
 static int scmi_clk_set_rate(struct clk_hw *hw, unsigned long rate,
-- 
2.7.4

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

* [PATCH] clk: scmi: Fix the rounding of clock rate
  2018-07-31  5:55         ` Amit Daniel Kachhap
@ 2018-08-02 20:50           ` Stephen Boyd
  0 siblings, 0 replies; 9+ messages in thread
From: Stephen Boyd @ 2018-08-02 20:50 UTC (permalink / raw)
  To: linux-arm-kernel

Quoting Amit Daniel Kachhap (2018-07-30 22:55:55)
> This fix rounds the clock rate properly by using quotient and not
> remainder in the calculation. This issue was found while testing HDMI
> in the Juno platform.
> 
> Fixes: 6d6a1d82eaef7 ("clk: add support for clocks provided by SCMI")
> Acked-by: Sudeep Holla <sudeep.holla@arm.com>
> Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
> ---

Applied to clk-next

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

end of thread, other threads:[~2018-08-02 20:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-27 14:01 [PATCH] clk: scmi: Fix the rounding of clock rate Amit Daniel Kachhap
2018-07-27 16:37 ` Stephen Boyd
2018-07-30  5:33   ` Amit Daniel Kachhap
2018-07-30 11:40     ` Sudeep Holla
2018-07-30 16:26       ` Stephen Boyd
2018-07-31  5:55         ` Amit Daniel Kachhap
2018-08-02 20:50           ` Stephen Boyd
2018-07-31  5:21       ` Amit Daniel Kachhap
2018-07-30 11:36 ` Sudeep Holla

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