mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 22:02:02 +00:00
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>
This commit is contained in:
parent
007e433cf0
commit
92abe50490
1 changed files with 2 additions and 4 deletions
|
@ -207,7 +207,6 @@ MODULE_DEVICE_TABLE(of, vexpress_hwmon_of_match);
|
||||||
|
|
||||||
static int vexpress_hwmon_probe(struct platform_device *pdev)
|
static int vexpress_hwmon_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
const struct of_device_id *match;
|
|
||||||
struct vexpress_hwmon_data *data;
|
struct vexpress_hwmon_data *data;
|
||||||
const struct vexpress_hwmon_type *type;
|
const struct vexpress_hwmon_type *type;
|
||||||
|
|
||||||
|
@ -216,10 +215,9 @@ static int vexpress_hwmon_probe(struct platform_device *pdev)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
platform_set_drvdata(pdev, data);
|
platform_set_drvdata(pdev, data);
|
||||||
|
|
||||||
match = of_match_device(vexpress_hwmon_of_match, &pdev->dev);
|
type = of_device_get_match_data(&pdev->dev);
|
||||||
if (!match)
|
if (!type)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
type = match->data;
|
|
||||||
|
|
||||||
data->reg = devm_regmap_init_vexpress_config(&pdev->dev);
|
data->reg = devm_regmap_init_vexpress_config(&pdev->dev);
|
||||||
if (IS_ERR(data->reg))
|
if (IS_ERR(data->reg))
|
||||||
|
|
Loading…
Reference in a new issue