Skip to content

Commit 4c58e9d

Browse files
robherringvireshk
authored andcommitted
opp: ti: Use device_get_match_data()
Use preferred device_get_match_data() instead of of_match_device() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. As this driver only does DT based matching, of_match_device() will never return NULL if we've gotten to probe(). Therefore, the NULL check and error return for it can be dropped. Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
1 parent b85ea95 commit 4c58e9d

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

drivers/opp/ti-opp-supply.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/of.h>
1919
#include <linux/platform_device.h>
2020
#include <linux/pm_opp.h>
21+
#include <linux/property.h>
2122
#include <linux/regulator/consumer.h>
2223
#include <linux/slab.h>
2324

@@ -373,23 +374,15 @@ static int ti_opp_supply_probe(struct platform_device *pdev)
373374
{
374375
struct device *dev = &pdev->dev;
375376
struct device *cpu_dev = get_cpu_device(0);
376-
const struct of_device_id *match;
377377
const struct ti_opp_supply_of_data *of_data;
378378
int ret = 0;
379379

380-
match = of_match_device(ti_opp_supply_of_match, dev);
381-
if (!match) {
382-
/* We do not expect this to happen */
383-
dev_err(dev, "%s: Unable to match device\n", __func__);
384-
return -ENODEV;
385-
}
386-
if (!match->data) {
380+
of_data = device_get_match_data(dev);
381+
if (!of_data) {
387382
/* Again, unlikely.. but mistakes do happen */
388383
dev_err(dev, "%s: Bad data in match\n", __func__);
389384
return -EINVAL;
390385
}
391-
of_data = match->data;
392-
393386
dev_set_drvdata(dev, (void *)of_data);
394387

395388
/* If we need optimized voltage */

0 commit comments

Comments
 (0)