linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] soc: samsung: exynos-chipid: trivial updates to simplify code
@ 2025-11-12  8:48 Tudor Ambarus
  2025-11-12  8:48 ` [PATCH 1/4] soc: samsung: exynos-chipid: prepend exynos_ to a method's name Tudor Ambarus
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Tudor Ambarus @ 2025-11-12  8:48 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Alim Akhtar
  Cc: linux-arm-kernel, linux-samsung-soc, linux-kernel, peter.griffin,
	andre.draszik, willmcvicker, kernel-team, Tudor Ambarus

Trivial patches to simplify code done while handling the GS101 chipid
support. Compile tested only.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
Tudor Ambarus (4):
      soc: samsung: exynos-chipid: prepend exynos_ to a method's name
      soc: samsung: exynos-chipid: downgrade dev_info to dev_dbg for soc info
      soc: samsung: exynos-chipid: simplify with dev_err_probe
      soc: samsung: exynos-chipid: use devm action to unregister soc device

 drivers/soc/samsung/exynos-chipid.c | 43 ++++++++++++++++---------------------
 1 file changed, 19 insertions(+), 24 deletions(-)
---
base-commit: 4b67e4c65c1e0740ac12bd0d790eb5a9d0091aaa
change-id: 20251111-chipid-trivial-6a7ceb9d1852

Best regards,
-- 
Tudor Ambarus <tudor.ambarus@linaro.org>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/4] soc: samsung: exynos-chipid: prepend exynos_ to a method's name
  2025-11-12  8:48 [PATCH 0/4] soc: samsung: exynos-chipid: trivial updates to simplify code Tudor Ambarus
@ 2025-11-12  8:48 ` Tudor Ambarus
  2025-11-12  8:48 ` [PATCH 2/4] soc: samsung: exynos-chipid: downgrade dev_info to dev_dbg for soc info Tudor Ambarus
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Tudor Ambarus @ 2025-11-12  8:48 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Alim Akhtar
  Cc: linux-arm-kernel, linux-samsung-soc, linux-kernel, peter.griffin,
	andre.draszik, willmcvicker, kernel-team, Tudor Ambarus

Avoid name space pollution and prepend exynos_ to
product_id_to_soc_id(). Add a blank line to make things readable.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
 drivers/soc/samsung/exynos-chipid.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
index d3b4b5508e0c808ee9f7b0039073ef57915d60fc..cdab1d4326b9de5df477a0545839b7b8b402d55d 100644
--- a/drivers/soc/samsung/exynos-chipid.c
+++ b/drivers/soc/samsung/exynos-chipid.c
@@ -70,7 +70,7 @@ static const struct exynos_soc_id {
 	{ "EXYNOSAUTOV920", 0x0A920000 },
 };
 
-static const char *product_id_to_soc_id(unsigned int product_id)
+static const char *exynos_product_id_to_soc_id(unsigned int product_id)
 {
 	int i;
 
@@ -141,7 +141,8 @@ static int exynos_chipid_probe(struct platform_device *pdev)
 						soc_info.revision);
 	if (!soc_dev_attr->revision)
 		return -ENOMEM;
-	soc_dev_attr->soc_id = product_id_to_soc_id(soc_info.product_id);
+
+	soc_dev_attr->soc_id = exynos_product_id_to_soc_id(soc_info.product_id);
 	if (!soc_dev_attr->soc_id) {
 		pr_err("Unknown SoC\n");
 		return -ENODEV;

-- 
2.51.2.1041.gc1ab5b90ca-goog



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/4] soc: samsung: exynos-chipid: downgrade dev_info to dev_dbg for soc info
  2025-11-12  8:48 [PATCH 0/4] soc: samsung: exynos-chipid: trivial updates to simplify code Tudor Ambarus
  2025-11-12  8:48 ` [PATCH 1/4] soc: samsung: exynos-chipid: prepend exynos_ to a method's name Tudor Ambarus
@ 2025-11-12  8:48 ` Tudor Ambarus
  2025-11-12  8:48 ` [PATCH 3/4] soc: samsung: exynos-chipid: simplify with dev_err_probe Tudor Ambarus
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Tudor Ambarus @ 2025-11-12  8:48 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Alim Akhtar
  Cc: linux-arm-kernel, linux-samsung-soc, linux-kernel, peter.griffin,
	andre.draszik, willmcvicker, kernel-team, Tudor Ambarus

The SoC information is exposed to userspace using the standard soc
interface. Downgrade to dev_dbg to stop polluting the console log.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
 drivers/soc/samsung/exynos-chipid.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
index cdab1d4326b9de5df477a0545839b7b8b402d55d..3671ed718b933a2dbb9e154202bd3235e3efd758 100644
--- a/drivers/soc/samsung/exynos-chipid.c
+++ b/drivers/soc/samsung/exynos-chipid.c
@@ -159,8 +159,8 @@ static int exynos_chipid_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, soc_dev);
 
-	dev_info(dev, "Exynos: CPU[%s] PRO_ID[0x%x] REV[0x%x] Detected\n",
-		 soc_dev_attr->soc_id, soc_info.product_id, soc_info.revision);
+	dev_dbg(dev, "Exynos: CPU[%s] PRO_ID[0x%x] REV[0x%x] Detected\n",
+		soc_dev_attr->soc_id, soc_info.product_id, soc_info.revision);
 
 	return 0;
 

-- 
2.51.2.1041.gc1ab5b90ca-goog



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/4] soc: samsung: exynos-chipid: simplify with dev_err_probe
  2025-11-12  8:48 [PATCH 0/4] soc: samsung: exynos-chipid: trivial updates to simplify code Tudor Ambarus
  2025-11-12  8:48 ` [PATCH 1/4] soc: samsung: exynos-chipid: prepend exynos_ to a method's name Tudor Ambarus
  2025-11-12  8:48 ` [PATCH 2/4] soc: samsung: exynos-chipid: downgrade dev_info to dev_dbg for soc info Tudor Ambarus
@ 2025-11-12  8:48 ` Tudor Ambarus
  2025-11-12  8:48 ` [PATCH 4/4] soc: samsung: exynos-chipid: use devm action to unregister soc device Tudor Ambarus
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Tudor Ambarus @ 2025-11-12  8:48 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Alim Akhtar
  Cc: linux-arm-kernel, linux-samsung-soc, linux-kernel, peter.griffin,
	andre.draszik, willmcvicker, kernel-team, Tudor Ambarus

Use dev_err_probe() to make error code handling simpler and to get
the standardized format of the error code ("ENODEV" instead of -19).

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
 drivers/soc/samsung/exynos-chipid.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
index 3671ed718b933a2dbb9e154202bd3235e3efd758..b5866a324d8ae911a5c99d0290328efdcc072dfd 100644
--- a/drivers/soc/samsung/exynos-chipid.c
+++ b/drivers/soc/samsung/exynos-chipid.c
@@ -143,10 +143,8 @@ static int exynos_chipid_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	soc_dev_attr->soc_id = exynos_product_id_to_soc_id(soc_info.product_id);
-	if (!soc_dev_attr->soc_id) {
-		pr_err("Unknown SoC\n");
-		return -ENODEV;
-	}
+	if (!soc_dev_attr->soc_id)
+		return dev_err_probe(dev, -ENODEV, "Unknown SoC\n");
 
 	/* please note that the actual registration will be deferred */
 	soc_dev = soc_device_register(soc_dev_attr);

-- 
2.51.2.1041.gc1ab5b90ca-goog



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/4] soc: samsung: exynos-chipid: use devm action to unregister soc device
  2025-11-12  8:48 [PATCH 0/4] soc: samsung: exynos-chipid: trivial updates to simplify code Tudor Ambarus
                   ` (2 preceding siblings ...)
  2025-11-12  8:48 ` [PATCH 3/4] soc: samsung: exynos-chipid: simplify with dev_err_probe Tudor Ambarus
@ 2025-11-12  8:48 ` Tudor Ambarus
  2025-11-18 14:01 ` [PATCH 0/4] soc: samsung: exynos-chipid: trivial updates to simplify code Tudor Ambarus
  2025-11-19 12:12 ` Krzysztof Kozlowski
  5 siblings, 0 replies; 7+ messages in thread
From: Tudor Ambarus @ 2025-11-12  8:48 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Alim Akhtar
  Cc: linux-arm-kernel, linux-samsung-soc, linux-kernel, peter.griffin,
	andre.draszik, willmcvicker, kernel-team, Tudor Ambarus

Simplify the unwinding of the soc device by using a devm action.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
 drivers/soc/samsung/exynos-chipid.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
index b5866a324d8ae911a5c99d0290328efdcc072dfd..d5b4d4f8d43da4c50d0e856e914550a9322725a1 100644
--- a/drivers/soc/samsung/exynos-chipid.c
+++ b/drivers/soc/samsung/exynos-chipid.c
@@ -14,6 +14,7 @@
 
 #include <linux/array_size.h>
 #include <linux/device.h>
+#include <linux/device/devres.h>
 #include <linux/errno.h>
 #include <linux/mfd/syscon.h>
 #include <linux/module.h>
@@ -104,6 +105,11 @@ static int exynos_chipid_get_chipid_info(struct regmap *regmap,
 	return 0;
 }
 
+static void exynos_chipid_unregister_soc(void *data)
+{
+	soc_device_unregister(data);
+}
+
 static int exynos_chipid_probe(struct platform_device *pdev)
 {
 	const struct exynos_chipid_variant *drv_data;
@@ -151,28 +157,19 @@ static int exynos_chipid_probe(struct platform_device *pdev)
 	if (IS_ERR(soc_dev))
 		return PTR_ERR(soc_dev);
 
-	ret = exynos_asv_init(dev, regmap);
+	ret = devm_add_action_or_reset(dev, exynos_chipid_unregister_soc,
+				       soc_dev);
 	if (ret)
-		goto err;
+		return dev_err_probe(dev, ret, "failed to add devm action\n");
 
-	platform_set_drvdata(pdev, soc_dev);
+	ret = exynos_asv_init(dev, regmap);
+	if (ret)
+		return ret;
 
 	dev_dbg(dev, "Exynos: CPU[%s] PRO_ID[0x%x] REV[0x%x] Detected\n",
 		soc_dev_attr->soc_id, soc_info.product_id, soc_info.revision);
 
 	return 0;
-
-err:
-	soc_device_unregister(soc_dev);
-
-	return ret;
-}
-
-static void exynos_chipid_remove(struct platform_device *pdev)
-{
-	struct soc_device *soc_dev = platform_get_drvdata(pdev);
-
-	soc_device_unregister(soc_dev);
 }
 
 static const struct exynos_chipid_variant exynos4210_chipid_drv_data = {
@@ -205,7 +202,6 @@ static struct platform_driver exynos_chipid_driver = {
 		.of_match_table = exynos_chipid_of_device_ids,
 	},
 	.probe = exynos_chipid_probe,
-	.remove = exynos_chipid_remove,
 };
 module_platform_driver(exynos_chipid_driver);
 

-- 
2.51.2.1041.gc1ab5b90ca-goog



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] soc: samsung: exynos-chipid: trivial updates to simplify code
  2025-11-12  8:48 [PATCH 0/4] soc: samsung: exynos-chipid: trivial updates to simplify code Tudor Ambarus
                   ` (3 preceding siblings ...)
  2025-11-12  8:48 ` [PATCH 4/4] soc: samsung: exynos-chipid: use devm action to unregister soc device Tudor Ambarus
@ 2025-11-18 14:01 ` Tudor Ambarus
  2025-11-19 12:12 ` Krzysztof Kozlowski
  5 siblings, 0 replies; 7+ messages in thread
From: Tudor Ambarus @ 2025-11-18 14:01 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Alim Akhtar
  Cc: linux-arm-kernel, linux-samsung-soc, linux-kernel, peter.griffin,
	andre.draszik, willmcvicker, kernel-team



On 11/12/25 10:48 AM, Tudor Ambarus wrote:
> Trivial patches to simplify code done while handling the GS101 chipid
> support. Compile tested only.
> 

These trivial patches are superseded by the following patch set:
https://lore.kernel.org/linux-samsung-soc/20251118-gs101-chipid-v2-0-e9f1e7460e35@linaro.org/T/#t

Please consider reviewing the replacement set instead. Thanks!
ta


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] soc: samsung: exynos-chipid: trivial updates to simplify code
  2025-11-12  8:48 [PATCH 0/4] soc: samsung: exynos-chipid: trivial updates to simplify code Tudor Ambarus
                   ` (4 preceding siblings ...)
  2025-11-18 14:01 ` [PATCH 0/4] soc: samsung: exynos-chipid: trivial updates to simplify code Tudor Ambarus
@ 2025-11-19 12:12 ` Krzysztof Kozlowski
  5 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-19 12:12 UTC (permalink / raw)
  To: Tudor Ambarus, Alim Akhtar
  Cc: linux-arm-kernel, linux-samsung-soc, linux-kernel, peter.griffin,
	andre.draszik, willmcvicker, kernel-team

On 12/11/2025 09:48, Tudor Ambarus wrote:
> Trivial patches to simplify code done while handling the GS101 chipid
> support. Compile tested only.
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
> ---
> Tudor Ambarus (4):
>       soc: samsung: exynos-chipid: prepend exynos_ to a method's name
>       soc: samsung: exynos-chipid: downgrade dev_info to dev_dbg for soc info
>       soc: samsung: exynos-chipid: simplify with dev_err_probe
>       soc: samsung: exynos-chipid: use devm action to unregister soc device
> 

AFAIU, this patchset is superseded with v2 using OTP bindings, so I am
dropping it.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-11-19 12:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-12  8:48 [PATCH 0/4] soc: samsung: exynos-chipid: trivial updates to simplify code Tudor Ambarus
2025-11-12  8:48 ` [PATCH 1/4] soc: samsung: exynos-chipid: prepend exynos_ to a method's name Tudor Ambarus
2025-11-12  8:48 ` [PATCH 2/4] soc: samsung: exynos-chipid: downgrade dev_info to dev_dbg for soc info Tudor Ambarus
2025-11-12  8:48 ` [PATCH 3/4] soc: samsung: exynos-chipid: simplify with dev_err_probe Tudor Ambarus
2025-11-12  8:48 ` [PATCH 4/4] soc: samsung: exynos-chipid: use devm action to unregister soc device Tudor Ambarus
2025-11-18 14:01 ` [PATCH 0/4] soc: samsung: exynos-chipid: trivial updates to simplify code Tudor Ambarus
2025-11-19 12:12 ` Krzysztof Kozlowski

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 NNTP newsgroup(s).