linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers/hwmon: Use of_device_get_match_data()
@ 2022-03-07  3:36 cgel.zte
  2022-03-08 17:18 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2022-03-07  3:36 UTC (permalink / raw)
  To: jdelvare
  Cc: linux, liviu.dudau, sudeep.holla, lorenzo.pieralisi, linux-hwmon,
	linux-kernel, linux-arm-kernel, Minghao Chi, Zeal Robot

From: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>

Use of_device_get_match_data() to simplify the code.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
---
 drivers/hwmon/vexpress-hwmon.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/hwmon/vexpress-hwmon.c b/drivers/hwmon/vexpress-hwmon.c
index 44d798be3d59..2ac5fb96bba4 100644
--- a/drivers/hwmon/vexpress-hwmon.c
+++ b/drivers/hwmon/vexpress-hwmon.c
@@ -207,7 +207,6 @@ MODULE_DEVICE_TABLE(of, vexpress_hwmon_of_match);
 
 static int vexpress_hwmon_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *match;
 	struct vexpress_hwmon_data *data;
 	const struct vexpress_hwmon_type *type;
 
@@ -216,10 +215,9 @@ static int vexpress_hwmon_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	platform_set_drvdata(pdev, data);
 
-	match = of_match_device(vexpress_hwmon_of_match, &pdev->dev);
-	if (!match)
+	type = of_device_get_match_data(&pdev->dev);
+	if (!type)
 		return -ENODEV;
-	type = match->data;
 
 	data->reg = devm_regmap_init_vexpress_config(&pdev->dev);
 	if (IS_ERR(data->reg))
-- 
2.25.1


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

* Re: [PATCH] drivers/hwmon: Use of_device_get_match_data()
  2022-03-07  3:36 [PATCH] drivers/hwmon: Use of_device_get_match_data() cgel.zte
@ 2022-03-08 17:18 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2022-03-08 17:18 UTC (permalink / raw)
  To: cgel.zte
  Cc: jdelvare, liviu.dudau, sudeep.holla, lorenzo.pieralisi,
	linux-hwmon, linux-kernel, linux-arm-kernel, Minghao Chi,
	Zeal Robot

Hi,

On Mon, Mar 07, 2022 at 03:36:31AM +0000, cgel.zte@gmail.com wrote:
> From: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
> 
> Use of_device_get_match_data() to simplify the code.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>

This is not the first patch from issues reported by Zeal Robot
with an inappropriate subject. "drivers/hwmon:" doesn't say anything.
The subject should either be "<subsystem>: <driver>: <description>" or,
as commonly used in hwmon, "hwmon: (driver) <description". I fixed
the subject and applied the patch, but don't expect me to do this
again in the future.

Guenter

> ---
>  drivers/hwmon/vexpress-hwmon.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hwmon/vexpress-hwmon.c b/drivers/hwmon/vexpress-hwmon.c
> index 44d798be3d59..2ac5fb96bba4 100644
> --- a/drivers/hwmon/vexpress-hwmon.c
> +++ b/drivers/hwmon/vexpress-hwmon.c
> @@ -207,7 +207,6 @@ MODULE_DEVICE_TABLE(of, vexpress_hwmon_of_match);
>  
>  static int vexpress_hwmon_probe(struct platform_device *pdev)
>  {
> -	const struct of_device_id *match;
>  	struct vexpress_hwmon_data *data;
>  	const struct vexpress_hwmon_type *type;
>  
> @@ -216,10 +215,9 @@ static int vexpress_hwmon_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  	platform_set_drvdata(pdev, data);
>  
> -	match = of_match_device(vexpress_hwmon_of_match, &pdev->dev);
> -	if (!match)
> +	type = of_device_get_match_data(&pdev->dev);
> +	if (!type)
>  		return -ENODEV;
> -	type = match->data;
>  
>  	data->reg = devm_regmap_init_vexpress_config(&pdev->dev);
>  	if (IS_ERR(data->reg))

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

end of thread, other threads:[~2022-03-08 17:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-07  3:36 [PATCH] drivers/hwmon: Use of_device_get_match_data() cgel.zte
2022-03-08 17:18 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).