Skip to contentSkip to conversation

soc: amlogic: socinfo: Avoid soc_device_to_device()

PATCH In review Andreas Färber 3 participants 4 messages Nov 11, 2019 – Nov 12, 2019 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soc: amlogic: socinfo: Avoid soc_device_to_device()

The helper soc_device_to_device() is considered deprecated. For a driver __init function the predictable prefix text "soc soc0:" from dev_info() does not add real value, so use pr_info() to emit the info text without such prefix.

While at it, normalize the casing of "detected" for GX.

Cc Greg Kroah-Hartman <[email protected]>
Cc Martin Blumenstingl <[email protected]>
Cc Neil Armstrong <[email protected]>
---
 drivers/soc/amlogic/meson-gx-socinfo.c | 4 +---
 drivers/soc/amlogic/meson-mx-socinfo.c | 4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/soc/amlogic/meson-gx-socinfo.c +1 -3
index 01fc0d20a70d..105b819bbd5f 100644
@@ -129,7 +129,6 @@ static int __init meson_gx_socinfo_init(void)
 	struct device_node *np;
 	struct regmap *regmap;
 	unsigned int socinfo;
-	struct device *dev;
 	int ret;
 
 	/* look up for chipid node */
@@ -192,9 +191,8 @@ static int __init meson_gx_socinfo_init(void)
 		kfree(soc_dev_attr);
 		return PTR_ERR(soc_dev);
 	}
-	dev = soc_device_to_device(soc_dev);
 
-	dev_info(dev, "Amlogic Meson %s Revision %x:%x (%x:%x) Detected\n",
+	pr_info("Amlogic Meson %s Revision %x:%x (%x:%x) detected\n",
 			soc_dev_attr->soc_id,
 			socinfo_to_major(socinfo),
 			socinfo_to_minor(socinfo),
drivers/soc/amlogic/meson-mx-socinfo.c +2 -2
index 78f0f1aeca57..7db2c94a7130 100644
@@ -167,8 +167,8 @@ static int __init meson_mx_socinfo_init(void)
 		return PTR_ERR(soc_dev);
 	}
 
-	dev_info(soc_device_to_device(soc_dev), "Amlogic %s %s detected\n",
-		 soc_dev_attr->soc_id, soc_dev_attr->revision);
+	pr_info("Amlogic %s %s detected\n",
+		soc_dev_attr->soc_id, soc_dev_attr->revision);
 
 	return 0;
 }
Signature · 1 line
2.16.4
#1 lore raw
Quoted 29 lines · Andreas Färber

The helper soc_device_to_device() is considered deprecated. For a driver __init function the predictable prefix text "soc soc0:" from dev_info() does not add real value, so use pr_info() to emit the info text without such prefix.

While at it, normalize the casing of "detected" for GX.

Cc Greg Kroah-Hartman <[email protected]>
Cc Martin Blumenstingl <[email protected]>
Cc Neil Armstrong <[email protected]>
---
 drivers/soc/amlogic/meson-gx-socinfo.c | 4 +---
 drivers/soc/amlogic/meson-mx-socinfo.c | 4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/soc/amlogic/meson-gx-socinfo.c +0 -1
index 01fc0d20a70d..105b819bbd5f 100644
@@ -129,7 +129,6 @@ static int __init meson_gx_socinfo_init(void)
 	struct device_node *np;
 	struct regmap *regmap;
 	unsigned int socinfo;
-	struct device *dev;
 	int ret;
 
 	/* look up for chipid node */

drivers/soc/amlogic/meson-gx-socinfo.c static int __init meson_gx_socinfo_init(void) · line 195

Quoted 7 lines
drivers/soc/amlogic/meson-gx-socinfo.c +1 -2
@@ -192,9 +191,8 @@ static int __init meson_gx_socinfo_init(void)
 		kfree(soc_dev_attr);
 		return PTR_ERR(soc_dev);
 	}
-	dev = soc_device_to_device(soc_dev);
 
-	dev_info(dev, "Amlogic Meson %s Revision %x:%x (%x:%x) Detected\n",
+	pr_info("Amlogic Meson %s Revision %x:%x (%x:%x) detected\n",

This should message should just be removed entirely.

Quoted 8 lines
drivers/soc/amlogic/meson-gx-socinfo.c +0 -0
 			soc_dev_attr->soc_id,
 			socinfo_to_major(socinfo),
 			socinfo_to_minor(socinfo),
drivers/soc/amlogic/meson-mx-socinfo.c +0 -0
index 78f0f1aeca57..7db2c94a7130 100644

drivers/soc/amlogic/meson-mx-socinfo.c static int __init meson_mx_socinfo_init(void) · line 171

Quoted 7 lines
drivers/soc/amlogic/meson-mx-socinfo.c +2 -2
@@ -167,8 +167,8 @@ static int __init meson_mx_socinfo_init(void)
 		return PTR_ERR(soc_dev);
 	}
 
-	dev_info(soc_device_to_device(soc_dev), "Amlogic %s %s detected\n",
-		 soc_dev_attr->soc_id, soc_dev_attr->revision);
+	pr_info("Amlogic %s %s detected\n",
+		soc_dev_attr->soc_id, soc_dev_attr->revision);

Same here, no need to polute the kernel log for when all is going just fine.

That's why we created "common" driver init helpers, to prevent the ability for this type of noise from even being able to be created at all.

thanks,

greg k-h

#2 lore raw

Am 12.11.19 um 06:40 schrieb Greg Kroah-Hartman:

Quoted 59 lines · Andreas Färber
Quoted 29 lines

The helper soc_device_to_device() is considered deprecated. For a driver __init function the predictable prefix text "soc soc0:" from dev_info() does not add real value, so use pr_info() to emit the info text without such prefix.

While at it, normalize the casing of "detected" for GX.

Cc Greg Kroah-Hartman <[email protected]>
Cc Martin Blumenstingl <[email protected]>
Cc Neil Armstrong <[email protected]>
---
 drivers/soc/amlogic/meson-gx-socinfo.c | 4 +---
 drivers/soc/amlogic/meson-mx-socinfo.c | 4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/soc/amlogic/meson-gx-socinfo.c +0 -1
index 01fc0d20a70d..105b819bbd5f 100644
@@ -129,7 +129,6 @@ static int __init meson_gx_socinfo_init(void)
 	struct device_node *np;
 	struct regmap *regmap;
 	unsigned int socinfo;
-	struct device *dev;
 	int ret;
 
 	/* look up for chipid node */

drivers/soc/amlogic/meson-gx-socinfo.c static int __init meson_gx_socinfo_init(void) · line 195

Quoted 7 lines
drivers/soc/amlogic/meson-gx-socinfo.c +1 -2
@@ -192,9 +191,8 @@ static int __init meson_gx_socinfo_init(void)
 		kfree(soc_dev_attr);
 		return PTR_ERR(soc_dev);
 	}
-	dev = soc_device_to_device(soc_dev);
 
-	dev_info(dev, "Amlogic Meson %s Revision %x:%x (%x:%x) Detected\n",
+	pr_info("Amlogic Meson %s Revision %x:%x (%x:%x) detected\n",

This should message should just be removed entirely.

Quoted 8 lines
drivers/soc/amlogic/meson-gx-socinfo.c +0 -0
 			soc_dev_attr->soc_id,
 			socinfo_to_major(socinfo),
 			socinfo_to_minor(socinfo),
drivers/soc/amlogic/meson-mx-socinfo.c +0 -0
index 78f0f1aeca57..7db2c94a7130 100644

drivers/soc/amlogic/meson-mx-socinfo.c static int __init meson_mx_socinfo_init(void) · line 171

Quoted 7 lines
drivers/soc/amlogic/meson-mx-socinfo.c +2 -2
@@ -167,8 +167,8 @@ static int __init meson_mx_socinfo_init(void)
 		return PTR_ERR(soc_dev);
 	}
 
-	dev_info(soc_device_to_device(soc_dev), "Amlogic %s %s detected\n",
-		 soc_dev_attr->soc_id, soc_dev_attr->revision);
+	pr_info("Amlogic %s %s detected\n",
+		soc_dev_attr->soc_id, soc_dev_attr->revision);

Same here, no need to polute the kernel log for when all is going just fine.

Quoted 3 lines

That's why we created "common" driver init helpers, to prevent the ability for this type of noise from even being able to be created at all.

Let's have that discussion in the central thread please.

Fact here is that Amlogic GX's kernel output (and this code getting mirrored into U-Boot) made me aware of this driver in the first place.

Regards,
Andreas

Signature · 4 lines
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer
HRB 36809 (AG Nürnberg)
#3 lore raw
Quoted 60 lines · Andreas Färber

Am 12.11.19 um 06:40 schrieb Greg Kroah-Hartman:

Quoted 59 lines · Andreas Färber
Quoted 29 lines

The helper soc_device_to_device() is considered deprecated. For a driver __init function the predictable prefix text "soc soc0:" from dev_info() does not add real value, so use pr_info() to emit the info text without such prefix.

While at it, normalize the casing of "detected" for GX.

Cc Greg Kroah-Hartman <[email protected]>
Cc Martin Blumenstingl <[email protected]>
Cc Neil Armstrong <[email protected]>
---
 drivers/soc/amlogic/meson-gx-socinfo.c | 4 +---
 drivers/soc/amlogic/meson-mx-socinfo.c | 4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/soc/amlogic/meson-gx-socinfo.c +0 -1
index 01fc0d20a70d..105b819bbd5f 100644
@@ -129,7 +129,6 @@ static int __init meson_gx_socinfo_init(void)
 	struct device_node *np;
 	struct regmap *regmap;
 	unsigned int socinfo;
-	struct device *dev;
 	int ret;
 
 	/* look up for chipid node */

drivers/soc/amlogic/meson-gx-socinfo.c static int __init meson_gx_socinfo_init(void) · line 195

Quoted 7 lines
drivers/soc/amlogic/meson-gx-socinfo.c +1 -2
@@ -192,9 +191,8 @@ static int __init meson_gx_socinfo_init(void)
 		kfree(soc_dev_attr);
 		return PTR_ERR(soc_dev);
 	}
-	dev = soc_device_to_device(soc_dev);
 
-	dev_info(dev, "Amlogic Meson %s Revision %x:%x (%x:%x) Detected\n",
+	pr_info("Amlogic Meson %s Revision %x:%x (%x:%x) detected\n",

This should message should just be removed entirely.

Quoted 8 lines
drivers/soc/amlogic/meson-gx-socinfo.c +0 -0
 			soc_dev_attr->soc_id,
 			socinfo_to_major(socinfo),
 			socinfo_to_minor(socinfo),
drivers/soc/amlogic/meson-mx-socinfo.c +0 -0
index 78f0f1aeca57..7db2c94a7130 100644

drivers/soc/amlogic/meson-mx-socinfo.c static int __init meson_mx_socinfo_init(void) · line 171

Quoted 7 lines
drivers/soc/amlogic/meson-mx-socinfo.c +2 -2
@@ -167,8 +167,8 @@ static int __init meson_mx_socinfo_init(void)
 		return PTR_ERR(soc_dev);
 	}
 
-	dev_info(soc_device_to_device(soc_dev), "Amlogic %s %s detected\n",
-		 soc_dev_attr->soc_id, soc_dev_attr->revision);
+	pr_info("Amlogic %s %s detected\n",
+		soc_dev_attr->soc_id, soc_dev_attr->revision);

Same here, no need to polute the kernel log for when all is going just fine.

Quoted 8 lines
Quoted 3 lines

That's why we created "common" driver init helpers, to prevent the ability for this type of noise from even being able to be created at all.

Let's have that discussion in the central thread please.

Fact here is that Amlogic GX's kernel output (and this code getting mirrored into U-Boot) made me aware of this driver in the first place.

As Uwe said in the common thread, this print doesn't polute the kernel log at all, it's pretty useful for CI, like kernelCI, to check the test coverage on SoCs revisions.

Yes it's duplicated in U-boot, but a little fraction of the boards in kCi uses this U-Boot version, they often use the vendor bootloader.

And BTW, by moving dev_info to pr_info actually changes the output format.

Can you be more precise about why "soc_device_to_device()" is now suddently deprecated ?

Neil

Quoted 4 lines

Regards,
Andreas