diff mbox series

[RESEND] opp: ti: Use device_get_match_data()

Message ID 20231030135411.776744-1-robh@kernel.org (mailing list archive)
State New, archived
Delegated to: viresh kumar
Headers show
Series [RESEND] opp: ti: Use device_get_match_data() | expand

Commit Message

Rob Herring (Arm) Oct. 30, 2023, 1:54 p.m. UTC
Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/opp/ti-opp-supply.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

Comments

Viresh Kumar Oct. 31, 2023, 3:45 a.m. UTC | #1
Hmm, somehow I didn't receive the direct mail last time to my Linaro account
(alias of kernel.org). I do see the message being posted to LKML though.

On 30-10-23, 08:54, Rob Herring wrote:

Isn't it is compulsory to add some details in the commit log ?

> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  drivers/opp/ti-opp-supply.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
Rob Herring (Arm) Oct. 31, 2023, 4:34 p.m. UTC | #2
On Mon, Oct 30, 2023 at 10:45 PM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> Hmm, somehow I didn't receive the direct mail last time to my Linaro account
> (alias of kernel.org). I do see the message being posted to LKML though.

That was an issue on my side.

>
> On 30-10-23, 08:54, Rob Herring wrote:
>
> Isn't it is compulsory to add some details in the commit log ?

Sigh, I missed adding it on this one. It should be:

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.

Will fix and repost.

Rob
diff mbox series

Patch

diff --git a/drivers/opp/ti-opp-supply.c b/drivers/opp/ti-opp-supply.c
index 8f3f13fbbb25..e3b97cd1fbbf 100644
--- a/drivers/opp/ti-opp-supply.c
+++ b/drivers/opp/ti-opp-supply.c
@@ -18,6 +18,7 @@ 
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pm_opp.h>
+#include <linux/property.h>
 #include <linux/regulator/consumer.h>
 #include <linux/slab.h>
 
@@ -373,23 +374,15 @@  static int ti_opp_supply_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct device *cpu_dev = get_cpu_device(0);
-	const struct of_device_id *match;
 	const struct ti_opp_supply_of_data *of_data;
 	int ret = 0;
 
-	match = of_match_device(ti_opp_supply_of_match, dev);
-	if (!match) {
-		/* We do not expect this to happen */
-		dev_err(dev, "%s: Unable to match device\n", __func__);
-		return -ENODEV;
-	}
-	if (!match->data) {
+	of_data = device_get_match_data(dev);
+	if (!of_data) {
 		/* Again, unlikely.. but mistakes do happen */
 		dev_err(dev, "%s: Bad data in match\n", __func__);
 		return -EINVAL;
 	}
-	of_data = match->data;
-
 	dev_set_drvdata(dev, (void *)of_data);
 
 	/* If we need optimized voltage */