LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Anson Huang <anson.huang@nxp.com>
To: Daniel Lezcano <daniel.lezcano@linaro.org>,
	"rui.zhang@intel.com" <rui.zhang@intel.com>,
	"amit.kucheria@verdurent.com" <amit.kucheria@verdurent.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: dl-linux-imx <linux-imx@nxp.com>
Subject: RE: [PATCH 1/2] thermal: qoriq: Use devm_add_action_or_reset() to handle all cleanups
Date: Thu, 12 Mar 2020 11:47:33 +0000	[thread overview]
Message-ID: <DB3PR0402MB3916BF7EF180809EC374CC7CF5FD0@DB3PR0402MB3916.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <c4c2d976-4fe6-bdf3-e110-90d1600566a3@linaro.org>

Hi, Daniel

> Subject: Re: [PATCH 1/2] thermal: qoriq: Use devm_add_action_or_reset() to
> handle all cleanups
> 
> On 11/03/2020 06:07, Anson Huang wrote:
> > Use devm_add_action_or_reset() to handle all cleanups of failure in
> > .probe and .remove, then .remove callback can be dropped.
> 
> Is this change compatible with the tristate?

I think so, any concern need me to double confirm?

Thanks,
Anson

> 
> > Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> > ---
> >  drivers/thermal/qoriq_thermal.c | 35
> > ++++++++++++++---------------------
> >  1 file changed, 14 insertions(+), 21 deletions(-)
> >
> > diff --git a/drivers/thermal/qoriq_thermal.c
> > b/drivers/thermal/qoriq_thermal.c index 874bc46..67a8d84 100644
> > --- a/drivers/thermal/qoriq_thermal.c
> > +++ b/drivers/thermal/qoriq_thermal.c
> > @@ -228,6 +228,14 @@ static const struct regmap_access_table
> qoriq_rd_table = {
> >  	.n_yes_ranges	= ARRAY_SIZE(qoriq_yes_ranges),
> >  };
> >
> > +static void qoriq_tmu_action(void *p) {
> > +	struct qoriq_tmu_data *data = p;
> > +
> > +	regmap_write(data->regmap, REGS_TMR, TMR_DISABLE);
> > +	clk_disable_unprepare(data->clk);
> > +}
> > +
> >  static int qoriq_tmu_probe(struct platform_device *pdev)  {
> >  	int ret;
> > @@ -278,6 +286,10 @@ static int qoriq_tmu_probe(struct platform_device
> *pdev)
> >  		return ret;
> >  	}
> >
> > +	ret = devm_add_action_or_reset(dev, qoriq_tmu_action, data);
> > +	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) {
> > @@ -290,35 +302,17 @@ static int qoriq_tmu_probe(struct
> > platform_device *pdev)
> >
> >  	ret = qoriq_tmu_calibration(dev, data);	/* TMU calibration */
> >  	if (ret < 0)
> > -		goto err;
> > +		return ret;
> >
> >  	ret = qoriq_tmu_register_tmu_zone(dev, data);
> >  	if (ret < 0) {
> >  		dev_err(dev, "Failed to register sensors\n");
> > -		ret = -ENODEV;
> > -		goto err;
> > +		return ret;
> >  	}
> >
> >  	platform_set_drvdata(pdev, data);
> >
> >  	return 0;
> > -
> > -err:
> > -	clk_disable_unprepare(data->clk);
> > -
> > -	return ret;
> > -}
> > -
> > -static int qoriq_tmu_remove(struct platform_device *pdev) -{
> > -	struct qoriq_tmu_data *data = platform_get_drvdata(pdev);
> > -
> > -	/* Disable monitoring */
> > -	regmap_write(data->regmap, REGS_TMR, TMR_DISABLE);
> > -
> > -	clk_disable_unprepare(data->clk);
> > -
> > -	return 0;
> >  }
> >
> >  static int __maybe_unused qoriq_tmu_suspend(struct device *dev) @@
> > -365,7 +359,6 @@ static struct platform_driver qoriq_tmu = {
> >  		.of_match_table	= qoriq_tmu_match,
> >  	},
> >  	.probe	= qoriq_tmu_probe,
> > -	.remove	= qoriq_tmu_remove,
> >  };
> >  module_platform_driver(qoriq_tmu);
> >
> >
> 
> 
> --
> 
> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.
> linaro.org%2F&amp;data=02%7C01%7CAnson.Huang%40nxp.com%7C37ea3
> 145642b47b4df7208d7c677e57d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7
> C0%7C0%7C637196090558448813&amp;sdata=%2FCfH8GPxd57CDlau1pMcq
> LH7GjGIh%2Fu%2Bfq7teGsS8KM%3D&amp;reserved=0> Linaro.org │ Open
> source software for ARM SoCs
> 
> Follow Linaro:
> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.
> facebook.com%2Fpages%2FLinaro&amp;data=02%7C01%7CAnson.Huang%4
> 0nxp.com%7C37ea3145642b47b4df7208d7c677e57d%7C686ea1d3bc2b4c6fa
> 92cd99c5c301635%7C0%7C0%7C637196090558448813&amp;sdata=KBUWpT
> 4quqo08r8YhbMVk%2Fyf2jIT1CKgc5i3jI9gCwo%3D&amp;reserved=0>
> Facebook |
> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Ftwitte
> r.com%2F%23!%2Flinaroorg&amp;data=02%7C01%7CAnson.Huang%40nxp.c
> om%7C37ea3145642b47b4df7208d7c677e57d%7C686ea1d3bc2b4c6fa92cd9
> 9c5c301635%7C0%7C0%7C637196090558448813&amp;sdata=%2FEgeRMWd
> qbbaOMl2Tfb%2BtLmfttqN1WcFbl9%2B5tXtOic%3D&amp;reserved=0>
> Twitter |
> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.
> linaro.org%2Flinaro-
> blog%2F&amp;data=02%7C01%7CAnson.Huang%40nxp.com%7C37ea314564
> 2b47b4df7208d7c677e57d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7
> C0%7C637196090558448813&amp;sdata=SXZow%2F0B%2BIgpfOfAUIG1NsR
> mcHp868ve%2Ffkejg3ZDvE%3D&amp;reserved=0> Blog


  reply	other threads:[~2020-03-12 11:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-11  5:07 Anson Huang
2020-03-11  5:07 ` [PATCH 2/2] thermal: qoriq: Sort includes alphabetically Anson Huang
2020-03-11  8:57   ` Amit Kucheria
2020-03-11  8:59 ` [PATCH 1/2] thermal: qoriq: Use devm_add_action_or_reset() to handle all cleanups Amit Kucheria
2020-03-12 11:24 ` Daniel Lezcano
2020-03-12 11:47   ` Anson Huang [this message]
2020-03-12 11:56     ` Daniel Lezcano
2020-03-12 12:19       ` Anson Huang
2020-03-17  1:14         ` Anson Huang
2020-03-17  9:07           ` Daniel Lezcano

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=DB3PR0402MB3916BF7EF180809EC374CC7CF5FD0@DB3PR0402MB3916.eurprd04.prod.outlook.com \
    --to=anson.huang@nxp.com \
    --cc=amit.kucheria@verdurent.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --subject='RE: [PATCH 1/2] thermal: qoriq: Use devm_add_action_or_reset() to handle all cleanups' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).