All of lore.kernel.org
 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, shawnguo@kernel.org,
	s.hauer@pengutronix.de, kernel@pengutronix.de,
	festevam@gmail.com, mturquette@baylibre.com, sboyd@kernel.org,
	l.stach@pengutronix.de, abel.vesa@nxp.com,
	andrew.smirnov@gmail.com, angus@akkea.ca, ccaione@baylibre.com,
	agx@sigxcpu.org, leonard.crestez@nxp.com,
	linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org
Cc: Linux-imx@nxp.com
Subject: [PATCH 1/6] thermal: qoriq: Use devm_platform_ioremap_resource() instead of of_iomap()
Date: Fri,  5 Jul 2019 12:56:07 +0800	[thread overview]
Message-ID: <20190705045612.27665-1-Anson.Huang@nxp.com> (raw)

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>
---
 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 7b36493..c7c7de2 100644
--- a/drivers/thermal/qoriq_thermal.c
+++ b/drivers/thermal/qoriq_thermal.c
@@ -202,32 +202,27 @@ 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);
 	}
 
 	qoriq_tmu_init_device(data);	/* TMU initialization */
 
 	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_iomap;
+		goto err;
 	}
 
 	return 0;
 
-err_tmu:
-	iounmap(data->regs);
-
-err_iomap:
+err:
 	platform_set_drvdata(pdev, NULL);
 
 	return ret;
@@ -240,7 +235,6 @@ static int qoriq_tmu_remove(struct platform_device *pdev)
 	/* Disable monitoring */
 	tmu_write(data, TMR_DISABLE, &data->regs->tmr);
 
-	iounmap(data->regs);
 	platform_set_drvdata(pdev, NULL);
 
 	return 0;
-- 
2.7.4


WARNING: multiple messages have this Message-ID (diff)
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, shawnguo@kernel.org,
	s.hauer@pengutronix.de, kernel@pengutronix.de,
	festevam@gmail.com, mturquette@baylibre.com, sboyd@kernel.org,
	l.stach@pengutronix.de, abel.vesa@nxp.com,
	andrew.smirnov@gmail.com, angus@akkea.ca, ccaione@baylibre.com,
	agx@sigxcpu.org, leonard.crestez@nxp.com,
	linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org
Cc: Linux-imx@nxp.com
Subject: [PATCH 1/6] thermal: qoriq: Use devm_platform_ioremap_resource() instead of of_iomap()
Date: Fri,  5 Jul 2019 12:56:07 +0800	[thread overview]
Message-ID: <20190705045612.27665-1-Anson.Huang@nxp.com> (raw)

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>
---
 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 7b36493..c7c7de2 100644
--- a/drivers/thermal/qoriq_thermal.c
+++ b/drivers/thermal/qoriq_thermal.c
@@ -202,32 +202,27 @@ 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);
 	}
 
 	qoriq_tmu_init_device(data);	/* TMU initialization */
 
 	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_iomap;
+		goto err;
 	}
 
 	return 0;
 
-err_tmu:
-	iounmap(data->regs);
-
-err_iomap:
+err:
 	platform_set_drvdata(pdev, NULL);
 
 	return ret;
@@ -240,7 +235,6 @@ static int qoriq_tmu_remove(struct platform_device *pdev)
 	/* Disable monitoring */
 	tmu_write(data, TMR_DISABLE, &data->regs->tmr);
 
-	iounmap(data->regs);
 	platform_set_drvdata(pdev, NULL);
 
 	return 0;
-- 
2.7.4


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

             reply	other threads:[~2019-07-05  5:05 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-05  4:56 Anson.Huang [this message]
2019-07-05  4:56 ` [PATCH 1/6] thermal: qoriq: Use devm_platform_ioremap_resource() instead of of_iomap() Anson.Huang
2019-07-05  4:56 ` [PATCH 2/6] thermal: qoriq: Use __maybe_unused instead of #if CONFIG_PM_SLEEP Anson.Huang
2019-07-05  4:56   ` Anson.Huang
2019-07-05  4:56 ` [PATCH 3/6] dt-bindings: thermal: qoriq: Add optional clocks property Anson.Huang
2019-07-05  4:56   ` Anson.Huang
2019-07-22 23:55   ` Rob Herring
2019-07-22 23:55     ` Rob Herring
2019-07-05  4:56 ` [PATCH 4/6] thermal: qoriq: Add clock operations Anson.Huang
2019-07-05  4:56   ` Anson.Huang
2019-07-29  8:12   ` Guido Günther
2019-07-29  8:12     ` Guido Günther
2019-07-29  8:40     ` Anson Huang
2019-07-29  8:40       ` Anson Huang
2019-07-29  8:40       ` Anson Huang
2019-07-05  4:56 ` [PATCH 5/6] clk: imx8mq: Remove CLK_IS_CRITICAL flag for IMX8MQ_CLK_TMU_ROOT Anson.Huang
2019-07-05  4:56   ` Anson.Huang
2019-07-05  7:01   ` Abel Vesa
2019-07-05  7:01     ` Abel Vesa
2019-07-05  7:01     ` Abel Vesa
2019-07-22 21:31   ` Stephen Boyd
2019-07-22 21:31     ` Stephen Boyd
2019-07-23  2:50   ` Shawn Guo
2019-07-23  2:50     ` Shawn Guo
2019-07-26 22:26   ` Daniel Baluta
2019-07-26 22:26     ` Daniel Baluta
2019-07-26 22:26     ` Daniel Baluta
2019-07-27  6:19     ` Anson Huang
2019-07-27  6:19       ` Anson Huang
2019-07-27  6:19       ` Anson Huang
2019-07-27  6:33       ` Daniel Baluta
2019-07-27  6:33         ` Daniel Baluta
2019-07-27 16:17         ` Abel Vesa
2019-07-27 16:17           ` Abel Vesa
2019-07-27 16:17           ` Abel Vesa
2019-07-29  1:29           ` Anson Huang
2019-07-29  1:29             ` Anson Huang
2019-07-29  1:29             ` Anson Huang
2019-07-29  6:51             ` Daniel Baluta
2019-07-29  6:51               ` Daniel Baluta
2019-07-29  6:51               ` Daniel Baluta
2019-07-29  7:14               ` Anson Huang
2019-07-29  7:14                 ` Anson Huang
2019-07-29  7:14                 ` Anson Huang
2019-07-29  7:20                 ` Daniel Baluta
2019-07-29  7:20                   ` Daniel Baluta
2019-07-29  7:20                   ` Daniel Baluta
2019-07-29  7:21                   ` Daniel Baluta
2019-07-29  7:21                     ` Daniel Baluta
2019-07-29  7:21                     ` Daniel Baluta
2019-07-29  7:49                     ` Anson Huang
2019-07-29  7:49                       ` Anson Huang
2019-07-29  7:49                       ` Anson Huang
2019-07-29  8:13                       ` Daniel Baluta
2019-07-29  8:13                         ` Daniel Baluta
2019-07-29  8:13                         ` Daniel Baluta
2019-07-27 18:26     ` Guido Günther
2019-07-27 18:26       ` Guido Günther
2019-07-27 18:26       ` Guido Günther
2019-07-27 20:17       ` Fabio Estevam
2019-07-27 20:17         ` Fabio Estevam
2019-07-27 20:17         ` Fabio Estevam
2019-07-28  7:58         ` Guido Günther
2019-07-28  7:58           ` Guido Günther
2019-07-28  7:58           ` Guido Günther
2019-07-28 15:24           ` Fabio Estevam
2019-07-28 15:24             ` Fabio Estevam
2019-07-28 15:24             ` Fabio Estevam
2019-07-05  4:56 ` [PATCH 6/6] arm64: dts: imx8mq: Add clock for TMU node Anson.Huang
2019-07-05  4:56   ` Anson.Huang
2019-07-23  2:51   ` Shawn Guo
2019-07-23  2:51     ` Shawn Guo

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=20190705045612.27665-1-Anson.Huang@nxp.com \
    --to=anson.huang@nxp.com \
    --cc=Linux-imx@nxp.com \
    --cc=abel.vesa@nxp.com \
    --cc=agx@sigxcpu.org \
    --cc=andrew.smirnov@gmail.com \
    --cc=angus@akkea.ca \
    --cc=ccaione@baylibre.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=edubezval@gmail.com \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=l.stach@pengutronix.de \
    --cc=leonard.crestez@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=s.hauer@pengutronix.de \
    --cc=sboyd@kernel.org \
    --cc=shawnguo@kernel.org \
    /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.