From: Peter Ujfalusi <peter.ujfalusi@gmail.com>
To: tony@atomide.com, lee@kernel.org, robh@kernel.org
Cc: wens@csie.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] mfd: twl4030-power: Revert to use of_match_device()
Date: Sun, 29 Oct 2023 13:49:09 +0200 [thread overview]
Message-ID: <20231029114909.15652-1-peter.ujfalusi@gmail.com> (raw)
The core twl chip is probed via i2c and the dev->driver->of_match_table is
NULL, causing the driver to fail to probe.
This partially reverts commit 1e0c866887f4.
Fixes: 1e0c866887f4 ("mfd: Use device_get_match_data() in a bunch of drivers")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
---
drivers/mfd/twl4030-power.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
index 1595e9c76132..e35b0f788c50 100644
--- a/drivers/mfd/twl4030-power.c
+++ b/drivers/mfd/twl4030-power.c
@@ -27,8 +27,8 @@
#include <linux/pm.h>
#include <linux/mfd/twl.h>
#include <linux/platform_device.h>
-#include <linux/property.h>
#include <linux/of.h>
+#include <linux/of_device.h>
#include <asm/mach-types.h>
@@ -883,6 +883,7 @@ static int twl4030_power_probe(struct platform_device *pdev)
{
const struct twl4030_power_data *pdata = dev_get_platdata(&pdev->dev);
struct device_node *node = pdev->dev.of_node;
+ const struct of_device_id *match;
int err = 0;
int err2 = 0;
u8 val;
@@ -903,8 +904,10 @@ static int twl4030_power_probe(struct platform_device *pdev)
return err;
}
- if (node)
- pdata = device_get_match_data(&pdev->dev);
+ match = of_match_device(of_match_ptr(twl4030_power_of_match),
+ &pdev->dev);
+ if (match && match->data)
+ pdata = match->data;
if (pdata) {
err = twl4030_power_configure_scripts(pdata);
--
2.42.0
next reply other threads:[~2023-10-29 11:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-29 11:49 Peter Ujfalusi [this message]
2023-11-23 10:39 ` [PATCH] mfd: twl4030-power: Revert to use of_match_device() Lee Jones
2023-11-23 15:42 ` Péter Ujfalusi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231029114909.15652-1-peter.ujfalusi@gmail.com \
--to=peter.ujfalusi@gmail.com \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=robh@kernel.org \
--cc=tony@atomide.com \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).