[RFC,39/57] drivers: mux: Use class_find_device_by_of_node helper
diff mbox series

Message ID 1559577023-558-40-git-send-email-suzuki.poulose@arm.com
State New
Headers show
Series
  • [RFC,01/57] drivers: s390/cio: Use driver_for_each_device
Related show

Commit Message

Suzuki K Poulose June 3, 2019, 3:50 p.m. UTC
Use the generic helper to find a device matching the of_node.

Cc: Peter Rosin <peda@axentia.se>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 drivers/mux/core.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Comments

Peter Rosin June 3, 2019, 4:22 p.m. UTC | #1
Hi!

This all sounds like nice changes. First a couple of nitpicks:

From the cover letter, included here to spare most of the others...

> subsystems. This series is an attempt to consolidate the and cleanup

s/the and/and/

On 2019-06-03 17:50, Suzuki K Poulose wrote:
> Use the generic helper to find a device matching the of_node.
> 
> Cc: Peter Rosin <peda@axentia.se>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
>  drivers/mux/core.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/mux/core.c b/drivers/mux/core.c
> index d1271c1..3591e40 100644
> --- a/drivers/mux/core.c
> +++ b/drivers/mux/core.c
> @@ -405,18 +405,12 @@ int mux_control_deselect(struct mux_control *mux)
>  }
>  EXPORT_SYMBOL_GPL(mux_control_deselect);
>  
> -static int of_dev_node_match(struct device *dev, const void *data)
> -{
> -	return dev->of_node == data;
> -}
> -
>  /* Note this function returns a reference to the mux_chip dev. */
>  static struct mux_chip *of_find_mux_chip_by_node(struct device_node *np)
>  {
>  	struct device *dev;
>  
> -	dev = class_find_device(&mux_class, NULL, np, of_dev_node_match);
> -

Nitpick #2. Please leave the blank line where it belongs.

However, how can I review this if I do not get to see the patch that
adds the class_find_device_by_of_node function? Please provide a
little bit more context!

Cheers,
Peter

> +	dev = class_find_device_by_of_node(&mux_class, NULL, np);
>  	return dev ? to_mux_chip(dev) : NULL;
>  }
>  
>
Suzuki K Poulose June 3, 2019, 4:45 p.m. UTC | #2
Hi Peter,

Thanks for your comments, please see my response inline.

On 03/06/2019 17:22, Peter Rosin wrote:
> Hi!
> 
> This all sounds like nice changes. First a couple of nitpicks:
> 
>  From the cover letter, included here to spare most of the others...
> 
>> subsystems. This series is an attempt to consolidate the and cleanup
> 
> s/the and/and/

Thanks for spotting.

> 
> On 2019-06-03 17:50, Suzuki K Poulose wrote:
>> Use the generic helper to find a device matching the of_node.
>>
>> Cc: Peter Rosin <peda@axentia.se>
>> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
>> ---
>>   drivers/mux/core.c | 8 +-------
>>   1 file changed, 1 insertion(+), 7 deletions(-)
>>
>> diff --git a/drivers/mux/core.c b/drivers/mux/core.c
>> index d1271c1..3591e40 100644
>> --- a/drivers/mux/core.c
>> +++ b/drivers/mux/core.c
>> @@ -405,18 +405,12 @@ int mux_control_deselect(struct mux_control *mux)
>>   }
>>   EXPORT_SYMBOL_GPL(mux_control_deselect);
>>   
>> -static int of_dev_node_match(struct device *dev, const void *data)
>> -{
>> -	return dev->of_node == data;
>> -}
>> -
>>   /* Note this function returns a reference to the mux_chip dev. */
>>   static struct mux_chip *of_find_mux_chip_by_node(struct device_node *np)
>>   {
>>   	struct device *dev;
>>   
>> -	dev = class_find_device(&mux_class, NULL, np, of_dev_node_match);
>> -
> 
> Nitpick #2. Please leave the blank line where it belongs.

Agreed !

> 
> However, how can I review this if I do not get to see the patch that
> adds the class_find_device_by_of_node function? Please provide a
> little bit more context!

Sorry about that. The routine is a wrapper to class_find_device()
which uses a generic routine to match the of_node, instead of the
driver specific of_dev_node_match(). The series adds such wrappers for
{bus/drivers/class}_find_device(). Unfortunately I didn't add
individual driver maintainers to the patches, which add those wrappers.
For the moment, please find the link below for the patch :

https://lkml.kernel.org/r/1559577023-558-29-git-send-email-suzuki.poulose@arm.com


I will try to address it in the next revision.

Kind regards
Suzuki
Peter Rosin June 3, 2019, 6:39 p.m. UTC | #3
On 2019-06-03 18:45, Suzuki K Poulose wrote:
> Hi Peter,

> Sorry about that. The routine is a wrapper to class_find_device()
> which uses a generic routine to match the of_node, instead of the
> driver specific of_dev_node_match(). The series adds such wrappers for
> {bus/drivers/class}_find_device(). Unfortunately I didn't add
> individual driver maintainers to the patches, which add those wrappers.
> For the moment, please find the link below for the patch :
> 
> https://lkml.kernel.org/r/1559577023-558-29-git-send-email-suzuki.poulose@arm.com
> 
> 
> I will try to address it in the next revision.

For the record, that patch references some other new function
"device_match_of_node" for which I do not have a definition. But with
the above link, I was able to find it without too much effort.

All looks ok to me, so, if you fix that blank line thing,

Reviewed-by: Peter Rosin <peda@axentia.se>

Cheers,
Peter

Patch
diff mbox series

diff --git a/drivers/mux/core.c b/drivers/mux/core.c
index d1271c1..3591e40 100644
--- a/drivers/mux/core.c
+++ b/drivers/mux/core.c
@@ -405,18 +405,12 @@  int mux_control_deselect(struct mux_control *mux)
 }
 EXPORT_SYMBOL_GPL(mux_control_deselect);
 
-static int of_dev_node_match(struct device *dev, const void *data)
-{
-	return dev->of_node == data;
-}
-
 /* Note this function returns a reference to the mux_chip dev. */
 static struct mux_chip *of_find_mux_chip_by_node(struct device_node *np)
 {
 	struct device *dev;
 
-	dev = class_find_device(&mux_class, NULL, np, of_dev_node_match);
-
+	dev = class_find_device_by_of_node(&mux_class, NULL, np);
 	return dev ? to_mux_chip(dev) : NULL;
 }