All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Macpaul Lin <macpaul.lin@mediatek.com>
Cc: AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	"u.kleine-koenig@pengutronix.de" <u.kleine-koenig@pengutronix.de>,
	"lee.jones@linaro.org" <lee.jones@linaro.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"linux-pwm@vger.kernel.org" <linux-pwm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	 "linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"kernel@collabora.com" <kernel@collabora.com>
Subject: Re: [PATCH v2 3/3] pwm: pwm-mediatek: Beautify error messages text
Date: Thu, 24 Feb 2022 14:56:35 +0100	[thread overview]
Message-ID: <YheOk3emaxePPBdr@orome> (raw)
In-Reply-To: <e3222caa-ec69-2e90-ef81-666b03da656d@mediatek.com>


[-- Attachment #1.1: Type: text/plain, Size: 3570 bytes --]

On Tue, Feb 15, 2022 at 02:47:33PM +0800, Macpaul Lin wrote:
> On 2/14/22 10:03 PM, AngeloGioacchino Del Regno wrote:
> > As a cherry-on-top cleanup, make error messages clearer to read
> > by changing instances of "clock: XXXX failed" to a more readable
> > "Failed to get XXXX clock". Also add "of" to unsupported period
> > error.
> > 
> > This is purely a cosmetic change; no "real" functional changes.
> > 
> > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > ---
> >   drivers/pwm/pwm-mediatek.c | 8 ++++----
> >   1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/pwm/pwm-mediatek.c b/drivers/pwm/pwm-mediatek.c
> > index 6b39f3d69e41..568b13a48717 100644
> > --- a/drivers/pwm/pwm-mediatek.c
> > +++ b/drivers/pwm/pwm-mediatek.c
> > @@ -146,7 +146,7 @@ static int pwm_mediatek_config(struct pwm_chip *chip, struct pwm_device *pwm,
> >   	if (clkdiv > PWM_CLK_DIV_MAX) {
> >   		pwm_mediatek_clk_disable(chip, pwm);
> > -		dev_err(chip->dev, "period %d not supported\n", period_ns);
> > +		dev_err(chip->dev, "period of %d ns not supported\n", period_ns);
> >   		return -EINVAL;
> >   	}
> > @@ -229,12 +229,12 @@ static int pwm_mediatek_probe(struct platform_device *pdev)
> >   	pc->clk_top = devm_clk_get(&pdev->dev, "top");
> >   	if (IS_ERR(pc->clk_top))
> >   		return dev_err_probe(&pdev->dev, PTR_ERR(pc->clk_top),
> > -				     "clock: top failed\n");
> > +				     "Failed to get top clock\n");
> >   	pc->clk_main = devm_clk_get(&pdev->dev, "main");
> >   	if (IS_ERR(pc->clk_main))
> >   		return dev_err_probe(&pdev->dev, PTR_ERR(pc->clk_main),
> > -				     "clock: main failed\n");
> > +				     "Failed to get main clock\n");
> >   	for (i = 0; i < pc->soc->num_pwms; i++) {
> >   		char name[8];
> > @@ -244,7 +244,7 @@ static int pwm_mediatek_probe(struct platform_device *pdev)
> >   		pc->clk_pwms[i] = devm_clk_get(&pdev->dev, name);
> >   		if (IS_ERR(pc->clk_pwms[i]))
> >   			return dev_err_probe(&pdev->dev, PTR_ERR(pc->clk_pwms[i]),
> > -					     "clock: %s failed\n", name);
> > +					     "Failed to get %s clock\n", name);
> >   	}
> >   	pc->chip.dev = &pdev->dev;
> > 
> 
> The format of these debug messages "clock: top" or "clock: main" is meant to
> keep both human and machine's readability at the same time.
> This kind of format is much more easier to parse by scripts, which the
> driver's category and sub nodes are separated by delimiters . If a fail log
> has been provided, the script could indicated where the issue might exists
> probably. Device vender, field application engineer, and driver maintainer
> could be able to write and use the error log parser before debugging.

Does such a script truly exist? Given that most error messages don't
follow this format, I would expect it to be only very marginally useful.
Typically the prefix that the dev_printk() variants add is enough
information to deduct where the error happens, at which point it's back
to good old grep to find the matching string to localize exactly.

> I'm not sure if this kind of format will be better. Like, "Failed to get
> clock: %s".
> 
> If most people like this kind of solution ("Failed to get clock: %s\n"),
> then you can have the reviewed-by tag.
> Thanks!
> 
> Reviewed-by: Macpaul Lin <macpaul.lin@mediatek.com>

I'm going to assume that the scriptability is a theoretical argument, so
I'll take this. Let me know if you do rely on the exact format and I can
drop this again.

Thierry

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Macpaul Lin <macpaul.lin@mediatek.com>
Cc: AngeloGioacchino Del Regno 
	<angelogioacchino.delregno@collabora.com>,
	"u.kleine-koenig@pengutronix.de" <u.kleine-koenig@pengutronix.de>,
	"lee.jones@linaro.org" <lee.jones@linaro.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"linux-pwm@vger.kernel.org" <linux-pwm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-mediatek@lists.infradead.org" 
	<linux-mediatek@lists.infradead.org>,
	"kernel@collabora.com" <kernel@collabora.com>
Subject: Re: [PATCH v2 3/3] pwm: pwm-mediatek: Beautify error messages text
Date: Thu, 24 Feb 2022 14:56:35 +0100	[thread overview]
Message-ID: <YheOk3emaxePPBdr@orome> (raw)
In-Reply-To: <e3222caa-ec69-2e90-ef81-666b03da656d@mediatek.com>

[-- Attachment #1: Type: text/plain, Size: 3570 bytes --]

On Tue, Feb 15, 2022 at 02:47:33PM +0800, Macpaul Lin wrote:
> On 2/14/22 10:03 PM, AngeloGioacchino Del Regno wrote:
> > As a cherry-on-top cleanup, make error messages clearer to read
> > by changing instances of "clock: XXXX failed" to a more readable
> > "Failed to get XXXX clock". Also add "of" to unsupported period
> > error.
> > 
> > This is purely a cosmetic change; no "real" functional changes.
> > 
> > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > ---
> >   drivers/pwm/pwm-mediatek.c | 8 ++++----
> >   1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/pwm/pwm-mediatek.c b/drivers/pwm/pwm-mediatek.c
> > index 6b39f3d69e41..568b13a48717 100644
> > --- a/drivers/pwm/pwm-mediatek.c
> > +++ b/drivers/pwm/pwm-mediatek.c
> > @@ -146,7 +146,7 @@ static int pwm_mediatek_config(struct pwm_chip *chip, struct pwm_device *pwm,
> >   	if (clkdiv > PWM_CLK_DIV_MAX) {
> >   		pwm_mediatek_clk_disable(chip, pwm);
> > -		dev_err(chip->dev, "period %d not supported\n", period_ns);
> > +		dev_err(chip->dev, "period of %d ns not supported\n", period_ns);
> >   		return -EINVAL;
> >   	}
> > @@ -229,12 +229,12 @@ static int pwm_mediatek_probe(struct platform_device *pdev)
> >   	pc->clk_top = devm_clk_get(&pdev->dev, "top");
> >   	if (IS_ERR(pc->clk_top))
> >   		return dev_err_probe(&pdev->dev, PTR_ERR(pc->clk_top),
> > -				     "clock: top failed\n");
> > +				     "Failed to get top clock\n");
> >   	pc->clk_main = devm_clk_get(&pdev->dev, "main");
> >   	if (IS_ERR(pc->clk_main))
> >   		return dev_err_probe(&pdev->dev, PTR_ERR(pc->clk_main),
> > -				     "clock: main failed\n");
> > +				     "Failed to get main clock\n");
> >   	for (i = 0; i < pc->soc->num_pwms; i++) {
> >   		char name[8];
> > @@ -244,7 +244,7 @@ static int pwm_mediatek_probe(struct platform_device *pdev)
> >   		pc->clk_pwms[i] = devm_clk_get(&pdev->dev, name);
> >   		if (IS_ERR(pc->clk_pwms[i]))
> >   			return dev_err_probe(&pdev->dev, PTR_ERR(pc->clk_pwms[i]),
> > -					     "clock: %s failed\n", name);
> > +					     "Failed to get %s clock\n", name);
> >   	}
> >   	pc->chip.dev = &pdev->dev;
> > 
> 
> The format of these debug messages "clock: top" or "clock: main" is meant to
> keep both human and machine's readability at the same time.
> This kind of format is much more easier to parse by scripts, which the
> driver's category and sub nodes are separated by delimiters . If a fail log
> has been provided, the script could indicated where the issue might exists
> probably. Device vender, field application engineer, and driver maintainer
> could be able to write and use the error log parser before debugging.

Does such a script truly exist? Given that most error messages don't
follow this format, I would expect it to be only very marginally useful.
Typically the prefix that the dev_printk() variants add is enough
information to deduct where the error happens, at which point it's back
to good old grep to find the matching string to localize exactly.

> I'm not sure if this kind of format will be better. Like, "Failed to get
> clock: %s".
> 
> If most people like this kind of solution ("Failed to get clock: %s\n"),
> then you can have the reviewed-by tag.
> Thanks!
> 
> Reviewed-by: Macpaul Lin <macpaul.lin@mediatek.com>

I'm going to assume that the scriptability is a theoretical argument, so
I'll take this. Let me know if you do rely on the exact format and I can
drop this again.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Macpaul Lin <macpaul.lin@mediatek.com>
Cc: AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	"u.kleine-koenig@pengutronix.de" <u.kleine-koenig@pengutronix.de>,
	"lee.jones@linaro.org" <lee.jones@linaro.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"linux-pwm@vger.kernel.org" <linux-pwm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	 "linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"kernel@collabora.com" <kernel@collabora.com>
Subject: Re: [PATCH v2 3/3] pwm: pwm-mediatek: Beautify error messages text
Date: Thu, 24 Feb 2022 14:56:35 +0100	[thread overview]
Message-ID: <YheOk3emaxePPBdr@orome> (raw)
In-Reply-To: <e3222caa-ec69-2e90-ef81-666b03da656d@mediatek.com>


[-- Attachment #1.1: Type: text/plain, Size: 3570 bytes --]

On Tue, Feb 15, 2022 at 02:47:33PM +0800, Macpaul Lin wrote:
> On 2/14/22 10:03 PM, AngeloGioacchino Del Regno wrote:
> > As a cherry-on-top cleanup, make error messages clearer to read
> > by changing instances of "clock: XXXX failed" to a more readable
> > "Failed to get XXXX clock". Also add "of" to unsupported period
> > error.
> > 
> > This is purely a cosmetic change; no "real" functional changes.
> > 
> > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > ---
> >   drivers/pwm/pwm-mediatek.c | 8 ++++----
> >   1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/pwm/pwm-mediatek.c b/drivers/pwm/pwm-mediatek.c
> > index 6b39f3d69e41..568b13a48717 100644
> > --- a/drivers/pwm/pwm-mediatek.c
> > +++ b/drivers/pwm/pwm-mediatek.c
> > @@ -146,7 +146,7 @@ static int pwm_mediatek_config(struct pwm_chip *chip, struct pwm_device *pwm,
> >   	if (clkdiv > PWM_CLK_DIV_MAX) {
> >   		pwm_mediatek_clk_disable(chip, pwm);
> > -		dev_err(chip->dev, "period %d not supported\n", period_ns);
> > +		dev_err(chip->dev, "period of %d ns not supported\n", period_ns);
> >   		return -EINVAL;
> >   	}
> > @@ -229,12 +229,12 @@ static int pwm_mediatek_probe(struct platform_device *pdev)
> >   	pc->clk_top = devm_clk_get(&pdev->dev, "top");
> >   	if (IS_ERR(pc->clk_top))
> >   		return dev_err_probe(&pdev->dev, PTR_ERR(pc->clk_top),
> > -				     "clock: top failed\n");
> > +				     "Failed to get top clock\n");
> >   	pc->clk_main = devm_clk_get(&pdev->dev, "main");
> >   	if (IS_ERR(pc->clk_main))
> >   		return dev_err_probe(&pdev->dev, PTR_ERR(pc->clk_main),
> > -				     "clock: main failed\n");
> > +				     "Failed to get main clock\n");
> >   	for (i = 0; i < pc->soc->num_pwms; i++) {
> >   		char name[8];
> > @@ -244,7 +244,7 @@ static int pwm_mediatek_probe(struct platform_device *pdev)
> >   		pc->clk_pwms[i] = devm_clk_get(&pdev->dev, name);
> >   		if (IS_ERR(pc->clk_pwms[i]))
> >   			return dev_err_probe(&pdev->dev, PTR_ERR(pc->clk_pwms[i]),
> > -					     "clock: %s failed\n", name);
> > +					     "Failed to get %s clock\n", name);
> >   	}
> >   	pc->chip.dev = &pdev->dev;
> > 
> 
> The format of these debug messages "clock: top" or "clock: main" is meant to
> keep both human and machine's readability at the same time.
> This kind of format is much more easier to parse by scripts, which the
> driver's category and sub nodes are separated by delimiters . If a fail log
> has been provided, the script could indicated where the issue might exists
> probably. Device vender, field application engineer, and driver maintainer
> could be able to write and use the error log parser before debugging.

Does such a script truly exist? Given that most error messages don't
follow this format, I would expect it to be only very marginally useful.
Typically the prefix that the dev_printk() variants add is enough
information to deduct where the error happens, at which point it's back
to good old grep to find the matching string to localize exactly.

> I'm not sure if this kind of format will be better. Like, "Failed to get
> clock: %s".
> 
> If most people like this kind of solution ("Failed to get clock: %s\n"),
> then you can have the reviewed-by tag.
> Thanks!
> 
> Reviewed-by: Macpaul Lin <macpaul.lin@mediatek.com>

I'm going to assume that the scriptability is a theoretical argument, so
I'll take this. Let me know if you do rely on the exact format and I can
drop this again.

Thierry

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-02-24 13:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-14 14:03 [PATCH v2 1/3] pwm: pwm-mediatek: Simplify error handling with dev_err_probe() AngeloGioacchino Del Regno
2022-02-14 14:03 ` AngeloGioacchino Del Regno
2022-02-14 14:03 ` AngeloGioacchino Del Regno
2022-02-14 14:03 ` [PATCH v2 2/3] pwm: pwm-mediatek: Allocate clk_pwms with devm_kmalloc_array AngeloGioacchino Del Regno
2022-02-14 14:03   ` AngeloGioacchino Del Regno
2022-02-14 14:03   ` AngeloGioacchino Del Regno
2022-02-24 13:53   ` Thierry Reding
2022-02-24 13:53     ` Thierry Reding
2022-02-24 13:53     ` Thierry Reding
2022-02-14 14:03 ` [PATCH v2 3/3] pwm: pwm-mediatek: Beautify error messages text AngeloGioacchino Del Regno
2022-02-14 14:03   ` AngeloGioacchino Del Regno
2022-02-14 14:03   ` AngeloGioacchino Del Regno
2022-02-15  6:47   ` Macpaul Lin
2022-02-24 13:56     ` Thierry Reding [this message]
2022-02-24 13:56       ` Thierry Reding
2022-02-24 13:56       ` Thierry Reding
2022-02-24 13:53 ` [PATCH v2 1/3] pwm: pwm-mediatek: Simplify error handling with dev_err_probe() Thierry Reding
2022-02-24 13:53   ` Thierry Reding
2022-02-24 13:53   ` Thierry Reding

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=YheOk3emaxePPBdr@orome \
    --to=thierry.reding@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=kernel@collabora.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=macpaul.lin@mediatek.com \
    --cc=matthias.bgg@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.