From: Macpaul Lin <macpaul.lin@mediatek.com>
To: AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
"thierry.reding@gmail.com" <thierry.reding@gmail.com>
Cc: "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: Tue, 15 Feb 2022 14:47:33 +0800 [thread overview]
Message-ID: <e3222caa-ec69-2e90-ef81-666b03da656d@mediatek.com> (raw)
In-Reply-To: <20220214140339.112500-3-angelogioacchino.delregno@collabora.com>
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.
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>
Regards, :)
Macpaul Lin
next prev parent reply other threads:[~2022-02-15 6:47 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 [this message]
2022-02-24 13:56 ` Thierry Reding
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=e3222caa-ec69-2e90-ef81-666b03da656d@mediatek.com \
--to=macpaul.lin@mediatek.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=matthias.bgg@gmail.com \
--cc=thierry.reding@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.