diff mbox series

[v5,15/15] clk: use clk_core_get_rate_recalc() in clk_rate_get()

Message ID 20211011112719.3951784-16-claudiu.beznea@microchip.com (mailing list archive)
State Accepted, archived
Headers show
Series clk: at91: updates for power management and dvfs | expand

Commit Message

Claudiu Beznea Oct. 11, 2021, 11:27 a.m. UTC
In case clock flags contains CLK_GET_RATE_NOCACHE the clk_rate_get()
will return the cached rate. Thus, use clk_core_get_rate_recalc() which
takes proper action when clock flags contains CLK_GET_RATE_NOCACHE.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/clk/clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nicolas Ferre Oct. 15, 2021, 8:08 a.m. UTC | #1
On 11/10/2021 at 13:27, Claudiu Beznea wrote:
> In case clock flags contains CLK_GET_RATE_NOCACHE the clk_rate_get()
> will return the cached rate. Thus, use clk_core_get_rate_recalc() which
> takes proper action when clock flags contains CLK_GET_RATE_NOCACHE.
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>

Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

> ---
>   drivers/clk/clk.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 65508eb89ec9..64838754cdef 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -3108,7 +3108,7 @@ static int clk_rate_get(void *data, u64 *val)
>   {
>   	struct clk_core *core = data;
>   
> -	*val = core->rate;
> +	*val = clk_core_get_rate_recalc(core);
>   	return 0;
>   }
>   
>
Stephen Boyd Oct. 27, 2021, 1:26 a.m. UTC | #2
Quoting Claudiu Beznea (2021-10-11 04:27:19)
> In case clock flags contains CLK_GET_RATE_NOCACHE the clk_rate_get()
> will return the cached rate. Thus, use clk_core_get_rate_recalc() which
> takes proper action when clock flags contains CLK_GET_RATE_NOCACHE.
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> ---
>  drivers/clk/clk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 65508eb89ec9..64838754cdef 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -3108,7 +3108,7 @@ static int clk_rate_get(void *data, u64 *val)
>  {
>         struct clk_core *core = data;
>  
> -       *val = core->rate;
> +       *val = clk_core_get_rate_recalc(core);

We need to grab the prepare lock now. I'll fix it when applying.
Claudiu Beznea Oct. 27, 2021, 7:01 a.m. UTC | #3
On 27.10.2021 04:26, Stephen Boyd wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Quoting Claudiu Beznea (2021-10-11 04:27:19)
>> In case clock flags contains CLK_GET_RATE_NOCACHE the clk_rate_get()
>> will return the cached rate. Thus, use clk_core_get_rate_recalc() which
>> takes proper action when clock flags contains CLK_GET_RATE_NOCACHE.
>>
>> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
>> ---
>>  drivers/clk/clk.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
>> index 65508eb89ec9..64838754cdef 100644
>> --- a/drivers/clk/clk.c
>> +++ b/drivers/clk/clk.c
>> @@ -3108,7 +3108,7 @@ static int clk_rate_get(void *data, u64 *val)
>>  {
>>         struct clk_core *core = data;
>>
>> -       *val = core->rate;
>> +       *val = clk_core_get_rate_recalc(core);
> 
> We need to grab the prepare lock now. I'll fix it when applying.

Thank you!

>
diff mbox series

Patch

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 65508eb89ec9..64838754cdef 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -3108,7 +3108,7 @@  static int clk_rate_get(void *data, u64 *val)
 {
 	struct clk_core *core = data;
 
-	*val = core->rate;
+	*val = clk_core_get_rate_recalc(core);
 	return 0;
 }