nvmem: nintendo-otp: Use of_device_get_match_data()
PATCH 1/1 nvmem: nintendo-otp: Use of_device_get_match_data()
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 <[email protected]>
--- drivers/nvmem/nintendo-otp.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/nvmem/nintendo-otp.c +4 -5
@@ -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 ; }
Signature · 1 line
2.54.0
Quoted 5 lines · Rosen Penev
Use
of_device_get_match_data()to retrieve the devtype data instead of open-coding the OF match lookup and dereferencingmatch->data.This also replaces the deprecated
of_device.hinclude withof.h.
Applied, thanks!
[1/1] nvmem: nintendo-otp: Use of_device_get_match_data()
commit: f6f37ba5ed4561e94d301fadc16437922aca2766
Best regards,
Signature · 1 line
Srinivas Kandagatla <[email protected]>