Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: (vexpress-hwmon) Use of_device_get_match_data()

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>
Link: https://lore.kernel.org/r/20220307033631.2075160-1-chi.minghao@zte.com.cn
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Minghao Chi (CGEL ZTE) and committed by
Guenter Roeck
92abe504 007e433c

+2 -4
+2 -4
drivers/hwmon/vexpress-hwmon.c
··· 207 207 208 208 static int vexpress_hwmon_probe(struct platform_device *pdev) 209 209 { 210 - const struct of_device_id *match; 211 210 struct vexpress_hwmon_data *data; 212 211 const struct vexpress_hwmon_type *type; 213 212 ··· 215 216 return -ENOMEM; 216 217 platform_set_drvdata(pdev, data); 217 218 218 - match = of_match_device(vexpress_hwmon_of_match, &pdev->dev); 219 - if (!match) 219 + type = of_device_get_match_data(&pdev->dev); 220 + if (!type) 220 221 return -ENODEV; 221 - type = match->data; 222 222 223 223 data->reg = devm_regmap_init_vexpress_config(&pdev->dev); 224 224 if (IS_ERR(data->reg))