mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Davis <afd@ti.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	Johan Hovold <johan@kernel.org>
Cc: <driver-core@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
	"Andrew Davis" <afd@ti.com>
Subject: [PATCH 06/12] soc: mediatek: mtk-socinfo: Use devm_soc_device_register() helper
Date: Wed, 11 Nov 2026 11:57:05 -0600	[thread overview]
Message-ID: <20261111175711.428824-7-afd@ti.com> (raw)
In-Reply-To: <20261111175711.428824-1-afd@ti.com>

Use the device lifecycle managed register function. This helps prevent
mistakes like unregistering out of order in cleanup functions and
forgetting to unregister on error paths.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 drivers/soc/mediatek/mtk-socinfo.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/soc/mediatek/mtk-socinfo.c b/drivers/soc/mediatek/mtk-socinfo.c
index cd14706c2f28a..7bee9c04293ac 100644
--- a/drivers/soc/mediatek/mtk-socinfo.c
+++ b/drivers/soc/mediatek/mtk-socinfo.c
@@ -30,7 +30,6 @@ struct mtk_socinfo {
 	struct device *dev;
 	struct name_data *name_data;
 	struct socinfo_data *socinfo_data;
-	struct soc_device *soc_dev;
 };
 
 struct socinfo_data {
@@ -71,6 +70,7 @@ static int mtk_socinfo_create_socinfo_node(struct mtk_socinfo *mtk_socinfop)
 	struct soc_device_attribute *attrs;
 	struct socinfo_data *data = mtk_socinfop->socinfo_data;
 	static const char *soc_manufacturer = "MediaTek";
+	struct soc_device *soc_dev;
 
 	attrs = devm_kzalloc_obj(mtk_socinfop->dev, *attrs);
 	if (!attrs)
@@ -91,9 +91,9 @@ static int mtk_socinfo_create_socinfo_node(struct mtk_socinfo *mtk_socinfop)
 	 * name from board DTS (if available).
 	 **/
 
-	mtk_socinfop->soc_dev = soc_device_register(attrs);
-	if (IS_ERR(mtk_socinfop->soc_dev))
-		return PTR_ERR(mtk_socinfop->soc_dev);
+	soc_dev = devm_soc_device_register(mtk_socinfop->dev, attrs);
+	if (IS_ERR(soc_dev))
+		return PTR_ERR(soc_dev);
 
 	dev_info(mtk_socinfop->dev, "%s (%s) SoC detected.\n", attrs->family, attrs->soc_id);
 	return 0;
@@ -191,20 +191,11 @@ static int mtk_socinfo_probe(struct platform_device *pdev)
 	if (ret)
 		return dev_err_probe(mtk_socinfop->dev, ret, "Cannot create node\n");
 
-	platform_set_drvdata(pdev, mtk_socinfop);
 	return 0;
 }
 
-static void mtk_socinfo_remove(struct platform_device *pdev)
-{
-	struct mtk_socinfo *mtk_socinfop = platform_get_drvdata(pdev);
-
-	soc_device_unregister(mtk_socinfop->soc_dev);
-}
-
 static struct platform_driver mtk_socinfo = {
 	.probe = mtk_socinfo_probe,
-	.remove = mtk_socinfo_remove,
 	.driver = {
 		.name = "mtk-socinfo",
 	},
-- 
2.43.0


  parent reply	other threads:[~2026-11-11 17:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 17:56 [PATCH 00/12] Add and use DEVM soc_device_register helper Andrew Davis
2026-11-11 17:57 ` [PATCH 01/12] base: soc: Implement devm_soc_device_register() helper function Andrew Davis
2026-11-11 17:57 ` [PATCH 02/12] soc: ep93xx: Use devm_soc_device_register() helper Andrew Davis
2026-11-11 17:57 ` [PATCH 03/12] soc: imx8m: " Andrew Davis
2026-11-11 17:57 ` [PATCH 04/12] soc: imx9: " Andrew Davis
2026-11-11 17:57 ` [PATCH 05/12] soc: loongson: " Andrew Davis
2026-11-11 17:57 ` Andrew Davis [this message]
2026-11-11 17:57 ` [PATCH 07/12] soc: qcom: socinfo: " Andrew Davis
2026-11-11 17:57 ` [PATCH 08/12] soc: renesas: rz-sysc: " Andrew Davis
2026-11-11 17:57 ` [PATCH 09/12] soc: samsung: exynos-chipid: " Andrew Davis
2026-11-11 17:57 ` [PATCH 10/12] soc: ti: k3-socinfo: " Andrew Davis
2026-11-11 17:57 ` [PATCH 11/12] soc: versatile: realview: " Andrew Davis
2026-11-11 17:57 ` [PATCH 12/12] soc: vt8500: " Andrew Davis

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=20261111175711.428824-7-afd@ti.com \
    --to=afd@ti.com \
    --cc=dakr@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@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®