diff mbox series

[1/2] clk: cdce9xx: Convert .of_xlate to .request

Message ID 20211201194403.2172991-1-seanga2@gmail.com
State Superseded
Delegated to: Lukasz Majewski
Headers show
Series [1/2] clk: cdce9xx: Convert .of_xlate to .request | expand

Commit Message

Sean Anderson Dec. 1, 2021, 7:44 p.m. UTC
This xlate function just performs some checking. We can do this in
request() instead and use the default xlate.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

 drivers/clk/clk-cdce9xx.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

Comments

Tom Rini Dec. 1, 2021, 8:08 p.m. UTC | #1
On Wed, Dec 01, 2021 at 02:44:02PM -0500, Sean Anderson wrote:

> This xlate function just performs some checking. We can do this in
> request() instead and use the default xlate.
> 
> Signed-off-by: Sean Anderson <seanga2@gmail.com>
> ---
> 
>  drivers/clk/clk-cdce9xx.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/clk/clk-cdce9xx.c b/drivers/clk/clk-cdce9xx.c
> index 6634b7b799..c15e9f210e 100644
> --- a/drivers/clk/clk-cdce9xx.c
> +++ b/drivers/clk/clk-cdce9xx.c
> @@ -86,19 +86,13 @@ static int cdce9xx_reg_write(struct udevice *dev, u8 addr, u8 val)
>  	return ret;
>  }
>  
> -static int cdce9xx_clk_of_xlate(struct clk *clk,
> -				struct ofnode_phandle_args *args)
> +static int cdce9xx_clk_of_request(struct clk *clk)
>  {
>  	struct cdce9xx_clk_data *data = dev_get_priv(clk->dev);
>  
> -	if (args->args_count != 1)
> +	if (clk->id > data->chip->num_outputs)
>  		return -EINVAL;
>  
> -	if (args->args[0] > data->chip->num_outputs)
> -		return -EINVAL;
> -
> -	clk->id = args->args[0];
> -
>  	return 0;
>  }
>  
> @@ -241,7 +235,7 @@ static const struct udevice_id cdce9xx_clk_of_match[] = {
>  };
>  
>  static const struct clk_ops cdce9xx_clk_ops = {
> -	.of_xlate = cdce9xx_clk_of_xlate,
> +	.request = cdce9xx_clk_request,
>  	.get_rate = cdce9xx_clk_get_rate,
>  	.set_rate = cdce9xx_clk_set_rate,
>  };

Adding Tero...
Sean Anderson Dec. 1, 2021, 8:10 p.m. UTC | #2
On 12/1/21 3:08 PM, Tom Rini wrote:
> On Wed, Dec 01, 2021 at 02:44:02PM -0500, Sean Anderson wrote:
> 
>> This xlate function just performs some checking. We can do this in
>> request() instead and use the default xlate.
>>
>> Signed-off-by: Sean Anderson <seanga2@gmail.com>
>> ---
>>
>>   drivers/clk/clk-cdce9xx.c | 12 +++---------
>>   1 file changed, 3 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/clk/clk-cdce9xx.c b/drivers/clk/clk-cdce9xx.c
>> index 6634b7b799..c15e9f210e 100644
>> --- a/drivers/clk/clk-cdce9xx.c
>> +++ b/drivers/clk/clk-cdce9xx.c
>> @@ -86,19 +86,13 @@ static int cdce9xx_reg_write(struct udevice *dev, u8 addr, u8 val)
>>   	return ret;
>>   }
>>   
>> -static int cdce9xx_clk_of_xlate(struct clk *clk,
>> -				struct ofnode_phandle_args *args)
>> +static int cdce9xx_clk_of_request(struct clk *clk)
>>   {
>>   	struct cdce9xx_clk_data *data = dev_get_priv(clk->dev);
>>   
>> -	if (args->args_count != 1)
>> +	if (clk->id > data->chip->num_outputs)
>>   		return -EINVAL;
>>   
>> -	if (args->args[0] > data->chip->num_outputs)
>> -		return -EINVAL;
>> -
>> -	clk->id = args->args[0];
>> -
>>   	return 0;
>>   }
>>   
>> @@ -241,7 +235,7 @@ static const struct udevice_id cdce9xx_clk_of_match[] = {
>>   };
>>   
>>   static const struct clk_ops cdce9xx_clk_ops = {
>> -	.of_xlate = cdce9xx_clk_of_xlate,
>> +	.request = cdce9xx_clk_request,
>>   	.get_rate = cdce9xx_clk_get_rate,
>>   	.set_rate = cdce9xx_clk_set_rate,
>>   };
> 
> Adding Tero...
> 

Thanks. Perhaps .mailmap should be updated?

--Sean
Tero Kristo Dec. 3, 2021, 8:18 a.m. UTC | #3
On 01/12/2021 22:10, Sean Anderson wrote:
> On 12/1/21 3:08 PM, Tom Rini wrote:
>> On Wed, Dec 01, 2021 at 02:44:02PM -0500, Sean Anderson wrote:
>>
>>> This xlate function just performs some checking. We can do this in
>>> request() instead and use the default xlate.
>>>
>>> Signed-off-by: Sean Anderson <seanga2@gmail.com>

Hi Sean,

Did you compile this? I see...

>>> ---
>>>
>>>   drivers/clk/clk-cdce9xx.c | 12 +++---------
>>>   1 file changed, 3 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/drivers/clk/clk-cdce9xx.c b/drivers/clk/clk-cdce9xx.c
>>> index 6634b7b799..c15e9f210e 100644
>>> --- a/drivers/clk/clk-cdce9xx.c
>>> +++ b/drivers/clk/clk-cdce9xx.c
>>> @@ -86,19 +86,13 @@ static int cdce9xx_reg_write(struct udevice *dev, 
>>> u8 addr, u8 val)
>>>       return ret;
>>>   }
>>> -static int cdce9xx_clk_of_xlate(struct clk *clk,
>>> -                struct ofnode_phandle_args *args)
>>> +static int cdce9xx_clk_of_request(struct clk *clk)

cdce9xx_clk_of_request here...

>>>   {
>>>       struct cdce9xx_clk_data *data = dev_get_priv(clk->dev);
>>> -    if (args->args_count != 1)
>>> +    if (clk->id > data->chip->num_outputs)
>>>           return -EINVAL;
>>> -    if (args->args[0] > data->chip->num_outputs)
>>> -        return -EINVAL;
>>> -
>>> -    clk->id = args->args[0];
>>> -
>>>       return 0;
>>>   }
>>> @@ -241,7 +235,7 @@ static const struct udevice_id 
>>> cdce9xx_clk_of_match[] = {
>>>   };
>>>   static const struct clk_ops cdce9xx_clk_ops = {
>>> -    .of_xlate = cdce9xx_clk_of_xlate,
>>> +    .request = cdce9xx_clk_request,

but cdce9xx_clk_request here.

Other than that, looks fine to me.

-Tero

>>>       .get_rate = cdce9xx_clk_get_rate,
>>>       .set_rate = cdce9xx_clk_set_rate,
>>>   };
>>
>> Adding Tero...
>>
> 
> Thanks. Perhaps .mailmap should be updated?
> 
> --Sean
Sean Anderson Dec. 15, 2021, 4:47 p.m. UTC | #4
On 12/3/21 3:18 AM, Tero Kristo wrote:
> On 01/12/2021 22:10, Sean Anderson wrote:
>> On 12/1/21 3:08 PM, Tom Rini wrote:
>>> On Wed, Dec 01, 2021 at 02:44:02PM -0500, Sean Anderson wrote:
>>>
>>>> This xlate function just performs some checking. We can do this in
>>>> request() instead and use the default xlate.
>>>>
>>>> Signed-off-by: Sean Anderson <seanga2@gmail.com>
> 
> Hi Sean,
> 
> Did you compile this? I see...
> 
>>>> ---
>>>>
>>>>   drivers/clk/clk-cdce9xx.c | 12 +++---------
>>>>   1 file changed, 3 insertions(+), 9 deletions(-)
>>>>
>>>> diff --git a/drivers/clk/clk-cdce9xx.c b/drivers/clk/clk-cdce9xx.c
>>>> index 6634b7b799..c15e9f210e 100644
>>>> --- a/drivers/clk/clk-cdce9xx.c
>>>> +++ b/drivers/clk/clk-cdce9xx.c
>>>> @@ -86,19 +86,13 @@ static int cdce9xx_reg_write(struct udevice *dev, u8 addr, u8 val)
>>>>       return ret;
>>>>   }
>>>> -static int cdce9xx_clk_of_xlate(struct clk *clk,
>>>> -                struct ofnode_phandle_args *args)
>>>> +static int cdce9xx_clk_of_request(struct clk *clk)
> 
> cdce9xx_clk_of_request here...
> 
>>>>   {
>>>>       struct cdce9xx_clk_data *data = dev_get_priv(clk->dev);
>>>> -    if (args->args_count != 1)
>>>> +    if (clk->id > data->chip->num_outputs)
>>>>           return -EINVAL;
>>>> -    if (args->args[0] > data->chip->num_outputs)
>>>> -        return -EINVAL;
>>>> -
>>>> -    clk->id = args->args[0];
>>>> -
>>>>       return 0;
>>>>   }
>>>> @@ -241,7 +235,7 @@ static const struct udevice_id cdce9xx_clk_of_match[] = {
>>>>   };
>>>>   static const struct clk_ops cdce9xx_clk_ops = {
>>>> -    .of_xlate = cdce9xx_clk_of_xlate,
>>>> +    .request = cdce9xx_clk_request,
> 
> but cdce9xx_clk_request here.
> 
> Other than that, looks fine to me.

Oops. Thanks for catching that.

Resubmitted after compile-testing :)

--Sean
diff mbox series

Patch

diff --git a/drivers/clk/clk-cdce9xx.c b/drivers/clk/clk-cdce9xx.c
index 6634b7b799..c15e9f210e 100644
--- a/drivers/clk/clk-cdce9xx.c
+++ b/drivers/clk/clk-cdce9xx.c
@@ -86,19 +86,13 @@  static int cdce9xx_reg_write(struct udevice *dev, u8 addr, u8 val)
 	return ret;
 }
 
-static int cdce9xx_clk_of_xlate(struct clk *clk,
-				struct ofnode_phandle_args *args)
+static int cdce9xx_clk_of_request(struct clk *clk)
 {
 	struct cdce9xx_clk_data *data = dev_get_priv(clk->dev);
 
-	if (args->args_count != 1)
+	if (clk->id > data->chip->num_outputs)
 		return -EINVAL;
 
-	if (args->args[0] > data->chip->num_outputs)
-		return -EINVAL;
-
-	clk->id = args->args[0];
-
 	return 0;
 }
 
@@ -241,7 +235,7 @@  static const struct udevice_id cdce9xx_clk_of_match[] = {
 };
 
 static const struct clk_ops cdce9xx_clk_ops = {
-	.of_xlate = cdce9xx_clk_of_xlate,
+	.request = cdce9xx_clk_request,
 	.get_rate = cdce9xx_clk_get_rate,
 	.set_rate = cdce9xx_clk_set_rate,
 };