From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Frank Li <Frank.Li@nxp.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Zhang Rui <rui.zhang@intel.com>,
Lukasz Luba <lukasz.luba@arm.com>,
"open list:THERMAL" <linux-pm@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] thermal/drivers/qoriq: Use dev_err_probe() simplify the code
Date: Sat, 7 Dec 2024 00:18:52 +0100 [thread overview]
Message-ID: <81e0e916-b14b-4ecf-b70a-2ce334c174cf@wanadoo.fr> (raw)
In-Reply-To: <20241206225624.3744880-1-Frank.Li@nxp.com>
Le 06/12/2024 à 23:56, Frank Li a écrit :
> Use dev_err_probe() and devm_clk_get_optional_enabled() to simplify the
> code.
>
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> ---
> drivers/thermal/qoriq_thermal.c | 33 ++++++++++-----------------------
> 1 file changed, 10 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
> index 52e26be8c53df..baf1b75b97cbe 100644
> --- a/drivers/thermal/qoriq_thermal.c
> +++ b/drivers/thermal/qoriq_thermal.c
> @@ -296,38 +296,27 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
>
> base = devm_platform_ioremap_resource(pdev, 0);
> ret = PTR_ERR_OR_ZERO(base);
> - if (ret) {
> - dev_err(dev, "Failed to get memory region\n");
> - return ret;
> - }
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to get memory region\n");
>
> data->regmap = devm_regmap_init_mmio(dev, base, ®map_config);
> ret = PTR_ERR_OR_ZERO(data->regmap);
> - if (ret) {
> - dev_err(dev, "Failed to init regmap (%d)\n", ret);
> - return ret;
> - }
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to init regmap\n");
>
> - data->clk = devm_clk_get_optional(dev, NULL);
> + data->clk = devm_clk_get_optional_enabled(dev, NULL);
> if (IS_ERR(data->clk))
> return PTR_ERR(data->clk);
>
> - ret = clk_prepare_enable(data->clk);
> - if (ret) {
> - dev_err(dev, "Failed to enable clock\n");
> - return ret;
> - }
> -
> ret = devm_add_action_or_reset(dev, qoriq_tmu_action, data);
clk_disable_unprepare() in qoriq_tmu_action() should be removed as-well.
> if (ret)
> return ret;
>
> /* version register offset at: 0xbf8 on both v1 and v2 */
> ret = regmap_read(data->regmap, REGS_IPBRR(0), &ver);
> - if (ret) {
> - dev_err(&pdev->dev, "Failed to read IP block version\n");
> - return ret;
> - }
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to read IP block version\n");
> +
> data->ver = (ver >> 8) & 0xff;
>
> qoriq_tmu_init_device(data); /* TMU initialization */
> @@ -337,10 +326,8 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
> return ret;
>
> ret = qoriq_tmu_register_tmu_zone(dev, data);
> - if (ret < 0) {
> - dev_err(dev, "Failed to register sensors\n");
> - return ret;
> - }
> + if (ret < 0)
> + return dev_err_probe(dev, ret, "Failed to register sensors\n");
>
> platform_set_drvdata(pdev, data);
>
prev parent reply other threads:[~2024-12-06 23:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-06 22:56 Frank Li
2024-12-06 22:56 ` [PATCH 2/2] thermal/drivers/qoriq: Power down TMU on system suspend Frank Li
2024-12-06 22:56 ` [PATCH v6 1/2] iio: adc: vf610_adc: use devm_* and dev_err_probe() to simple code Frank Li
2024-12-06 22:59 ` Frank Li
2024-12-06 22:56 ` [PATCH v6 2/2] iio: adc: vf610_adc: limit i.MX6SX's channel number to 4 Frank Li
2024-12-06 23:00 ` Frank Li
2024-12-06 23:18 ` Christophe JAILLET [this message]
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=81e0e916-b14b-4ecf-b70a-2ce334c174cf@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=Frank.Li@nxp.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®