Re: [PATCH 2/2] thermal: rcar_gen3_thermal: improve logging during probe

From: Geert Uytterhoeven
Date: Thu Jun 09 2022 - 05:15:43 EST


Hi Wolfram,

On Wed, May 25, 2022 at 7:07 PM Wolfram Sang
<wsa+renesas@xxxxxxxxxxxxxxxxxxxx> wrote:
> When setting up a new board, a plain "Can't register thermal zone"
> didn't help me much because the thermal zones in DT were all fine. I
> just had a sensor entry too much in the parent TSC node. Reword the
> failure/success messages to contain the sensor number to make it easier
> to understand which sensor is affected. Example output now:
>
> rcar_gen3_thermal e6198000.thermal: Sensor 0: Trip points loaded: 1
> rcar_gen3_thermal e6198000.thermal: Sensor 1: Trip points loaded: 1
> rcar_gen3_thermal e6198000.thermal: Sensor 2: Trip points loaded: 1
> rcar_gen3_thermal e6198000.thermal: Sensor 3: Can't register thermal zone
>
> Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>

Thanks for your patch!

> --- a/drivers/thermal/rcar_gen3_thermal.c
> +++ b/drivers/thermal/rcar_gen3_thermal.c
> @@ -511,7 +511,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
> zone = devm_thermal_zone_of_sensor_register(dev, i, tsc,
> &rcar_gen3_tz_of_ops);
> if (IS_ERR(zone)) {
> - dev_err(dev, "Can't register thermal zone\n");
> + dev_err(dev, "Sensor %u: Can't register thermal zone\n", i);

LGTM.

> ret = PTR_ERR(zone);
> goto error_unregister;
> }
> @@ -533,7 +533,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
> if (ret < 0)
> goto error_unregister;
>
> - dev_info(dev, "TSC%u: Loaded %d trip points\n", i, ret);
> + dev_info(dev, "Sensor %u: Trip points loaded: %u\n", i, ret);

I actually prefer the old wording (I'm undecided about "sensor" vs.
"TSC", though, but consistency rules), as it makes it clear "ret"
is the number of trip points, and not a success code.

> }
>
> if (!priv->num_tscs) {

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds