From: Rosen Penev <rosenp@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Srinivas Kandagatla <srini@kernel.org>
Subject: [PATCH] nvmem: nintendo-otp: Use of_device_get_match_data()
Date: Sun, 17 May 2026 21:19:27 -0700 [thread overview]
Message-ID: <20260518041927.956270-1-rosenp@gmail.com> (raw)
Use of_device_get_match_data() to retrieve the devtype data instead of open-coding the OF match lookup and dereferencing match->data.
This also replaces the deprecated of_device.h include with of.h.
Assisted-by: Codex:GPT-5.5
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/nvmem/nintendo-otp.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/nvmem/nintendo-otp.c b/drivers/nvmem/nintendo-otp.c
index 355e7f1fc6d5..e45a8a3a9774 100644
--- a/drivers/nvmem/nintendo-otp.c
+++ b/drivers/nvmem/nintendo-otp.c
@@ -17,7 +17,7 @@
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/nvmem-provider.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#define HW_OTPCMD 0
@@ -74,8 +74,7 @@ MODULE_DEVICE_TABLE(of, nintendo_otp_of_table);
static int nintendo_otp_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
- const struct of_device_id *of_id =
- of_match_device(nintendo_otp_of_table, dev);
+ const struct nintendo_otp_devtype_data *data;
struct nvmem_device *nvmem;
struct nintendo_otp_priv *priv;
@@ -95,8 +94,8 @@ static int nintendo_otp_probe(struct platform_device *pdev)
if (IS_ERR(priv->regs))
return PTR_ERR(priv->regs);
- if (of_id->data) {
- const struct nintendo_otp_devtype_data *data = of_id->data;
+ data = of_device_get_match_data(dev);
+ if (data) {
config.name = data->name;
config.size = data->num_banks * BANK_SIZE;
}
--
2.54.0
next reply other threads:[~2026-05-18 4:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 4:19 Rosen Penev [this message]
2026-05-19 14:42 ` Srinivas Kandagatla
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=20260518041927.956270-1-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=srini@kernel.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
all inboxes | Powered by JetHome®