linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anson.Huang@nxp.com
To: rui.zhang@intel.com, edubezval@gmail.com,
	daniel.lezcano@linaro.org, robh+dt@kernel.org,
	mark.rutland@arm.com, linux-pm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Linux-imx@nxp.com
Subject: [PATCH V3 3/5] thermal: qoriq: Use devm_platform_ioremap_resource() instead of of_iomap()
Date: Tue, 30 Jul 2019 10:21:24 +0800	[thread overview]
Message-ID: <20190730022126.17883-3-Anson.Huang@nxp.com> (raw)
In-Reply-To: <20190730022126.17883-1-Anson.Huang@nxp.com>

From: Anson Huang <Anson.Huang@nxp.com>

Use devm_platform_ioremap_resource() instead of of_iomap() to
save the iounmap() call in error handle path;

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
No change, just adjust the patch sequence and handle the conflicts.
---
 drivers/thermal/qoriq_thermal.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
index 5755a11..8d19601 100644
--- a/drivers/thermal/qoriq_thermal.c
+++ b/drivers/thermal/qoriq_thermal.c
@@ -204,11 +204,10 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
 
 	data->little_endian = of_property_read_bool(np, "little-endian");
 
-	data->regs = of_iomap(np, 0);
-	if (!data->regs) {
+	data->regs = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(data->regs)) {
 		dev_err(&pdev->dev, "Failed to get memory region\n");
-		ret = -ENODEV;
-		goto err_iomap;
+		return PTR_ERR(data->regs);
 	}
 
 	data->clk = devm_clk_get_optional(&pdev->dev, NULL);
@@ -225,22 +224,19 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
 
 	ret = qoriq_tmu_calibration(pdev);	/* TMU calibration */
 	if (ret < 0)
-		goto err_tmu;
+		goto err;
 
 	ret = qoriq_tmu_register_tmu_zone(pdev);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "Failed to register sensors\n");
 		ret = -ENODEV;
-		goto err_tmu;
+		goto err;
 	}
 
 	return 0;
 
-err_tmu:
+err:
 	clk_disable_unprepare(data->clk);
-	iounmap(data->regs);
-
-err_iomap:
 	platform_set_drvdata(pdev, NULL);
 
 	return ret;
@@ -253,8 +249,6 @@ static int qoriq_tmu_remove(struct platform_device *pdev)
 	/* Disable monitoring */
 	tmu_write(data, TMR_DISABLE, &data->regs->tmr);
 
-	iounmap(data->regs);
-
 	clk_disable_unprepare(data->clk);
 
 	platform_set_drvdata(pdev, NULL);
-- 
2.7.4


  parent reply	other threads:[~2019-07-30  2:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-30  2:21 [PATCH V3 1/5] thermal: qoriq: Add clock operations Anson.Huang
2019-07-30  2:21 ` [PATCH V3 2/5] thermal: qoriq: Fix error path of calling qoriq_tmu_register_tmu_zone fail Anson.Huang
2019-08-05  7:01   ` Aisheng Dong
2019-07-30  2:21 ` Anson.Huang [this message]
2019-08-05  7:01   ` [PATCH V3 3/5] thermal: qoriq: Use devm_platform_ioremap_resource() instead of of_iomap() Aisheng Dong
2019-07-30  2:21 ` [PATCH V3 4/5] thermal: qoriq: Use __maybe_unused instead of #if CONFIG_PM_SLEEP Anson.Huang
2019-08-05  7:02   ` Aisheng Dong
2019-07-30  2:21 ` [PATCH V3 5/5] dt-bindings: thermal: qoriq: Add optional clocks property Anson.Huang
2019-08-05  7:02   ` Aisheng Dong
2019-08-05  7:00 ` [PATCH V3 1/5] thermal: qoriq: Add clock operations Aisheng Dong
2019-08-26 14:45 ` Leonard Crestez
2019-08-27  1:51   ` Anson Huang
2019-08-27  3:09     ` Zhang Rui
2019-08-27  3:24       ` Anson Huang
2019-08-27 12:41     ` Leonard Crestez
2019-08-28  8:32       ` Zhang Rui
2019-08-28  8:35         ` Zhang Rui
2019-08-28  8:49           ` Anson Huang
2019-08-28  9:01             ` Zhang Rui
2019-08-28  9:12               ` Anson Huang
2019-08-28  8:51         ` Anson Huang
2019-08-28  9:03           ` Zhang Rui
2019-08-28  9:10             ` Anson Huang
2019-08-29  2:49               ` Anson Huang
2019-08-29  3:01                 ` Zhang Rui

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=20190730022126.17883-3-Anson.Huang@nxp.com \
    --to=anson.huang@nxp.com \
    --cc=Linux-imx@nxp.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=edubezval@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).