Commit cabfa5b4 authored by Minghao Chi (CGEL ZTE)'s avatar Minghao Chi (CGEL ZTE) Committed by Nishanth Menon

soc: ti: omap_prm: Use of_device_get_match_data()

Since omap_prm_id_table all have (and expected to have) data entries,
use of_device_get_match_data() to simplify the code.
Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
Signed-off-by: default avatarMinghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
Signed-off-by: default avatarNishanth Menon <nm@ti.com>
Link: https://lore.kernel.org/r/20220307033736.2075221-1-chi.minghao@zte.com.cn
parent f25d2b2b
...@@ -941,23 +941,20 @@ static int omap_prm_probe(struct platform_device *pdev) ...@@ -941,23 +941,20 @@ static int omap_prm_probe(struct platform_device *pdev)
struct resource *res; struct resource *res;
const struct omap_prm_data *data; const struct omap_prm_data *data;
struct omap_prm *prm; struct omap_prm *prm;
const struct of_device_id *match;
int ret; int ret;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) if (!res)
return -ENODEV; return -ENODEV;
match = of_match_device(omap_prm_id_table, &pdev->dev); data = of_device_get_match_data(&pdev->dev);
if (!match) if (!data)
return -ENOTSUPP; return -ENOTSUPP;
prm = devm_kzalloc(&pdev->dev, sizeof(*prm), GFP_KERNEL); prm = devm_kzalloc(&pdev->dev, sizeof(*prm), GFP_KERNEL);
if (!prm) if (!prm)
return -ENOMEM; return -ENOMEM;
data = match->data;
while (data->base != res->start) { while (data->base != res->start) {
if (!data->base) if (!data->base)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment