Re: [PATCH] soc: amlogic: socinfo: Avoid soc_device_to_device()

From: Greg Kroah-Hartman
Date: Tue Nov 12 2019 - 00:40:08 EST


On Mon, Nov 11, 2019 at 11:15:21PM +0100, Andreas Färber wrote:
> 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 <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: Martin Blumenstingl <martin.blumenstingl@xxxxxxxxxxxxxx>
> Cc: Neil Armstrong <narmstrong@xxxxxxxxxxxx>
> Signed-off-by: Andreas Färber <afaerber@xxxxxxx>
> ---
> drivers/soc/amlogic/meson-gx-socinfo.c | 4 +---
> drivers/soc/amlogic/meson-mx-socinfo.c | 4 ++--
> 2 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/soc/amlogic/meson-gx-socinfo.c b/drivers/soc/amlogic/meson-gx-socinfo.c
> index 01fc0d20a70d..105b819bbd5f 100644
> --- a/drivers/soc/amlogic/meson-gx-socinfo.c
> +++ b/drivers/soc/amlogic/meson-gx-socinfo.c
> @@ -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",

This should message should just be removed entirely.

> soc_dev_attr->soc_id,
> socinfo_to_major(socinfo),
> socinfo_to_minor(socinfo),
> diff --git a/drivers/soc/amlogic/meson-mx-socinfo.c b/drivers/soc/amlogic/meson-mx-socinfo.c
> index 78f0f1aeca57..7db2c94a7130 100644
> --- a/drivers/soc/amlogic/meson-mx-socinfo.c
> +++ b/drivers/soc/amlogic/meson-mx-socinfo.c
> @@ -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