2019-09-04 12:35:38

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 00/15] use devm_platform_ioremap_resource() to simplify code

devm_platform_ioremap_resource() internally have platform_get_resource()
and devm_ioremap_resource() in it. So instead of calling them separately
use devm_platform_ioremap_resource() directly.

YueHaibing (15):
thermal: armada: use devm_platform_ioremap_resource() to simplify code
thermal: bcm2835: use devm_platform_ioremap_resource() to simplify
code
thermal: brcmstb: use devm_platform_ioremap_resource() to simplify
code
thermal: hisilicon: use devm_platform_ioremap_resource() to simplify
code
thermal: dove: use devm_platform_ioremap_resource() to simplify code
thermal: mtk: use devm_platform_ioremap_resource() to simplify code
thermal: kirkwood: use devm_platform_ioremap_resource() to simplify
code
thermal: tsens: use devm_platform_ioremap_resource() to simplify code
thermal: rockchip: use devm_platform_ioremap_resource() to simplify
code
thermal: spear: use devm_platform_ioremap_resource() to simplify code
thermal: stm32: use devm_platform_ioremap_resource() to simplify code
thermal: tango: use devm_platform_ioremap_resource() to simplify code
thermal: thermal_mmio: use devm_platform_ioremap_resource() to
simplify code
thermal: zx2967: use devm_platform_ioremap_resource() to simplify code
thermal: rcar: use devm_platform_ioremap_resource() to simplify code

drivers/thermal/armada_thermal.c | 4 +---
drivers/thermal/broadcom/bcm2835_thermal.c | 4 +---
drivers/thermal/broadcom/brcmstb_thermal.c | 4 +---
drivers/thermal/dove_thermal.c | 7 ++-----
drivers/thermal/hisi_thermal.c | 4 +---
drivers/thermal/kirkwood_thermal.c | 4 +---
drivers/thermal/mtk_thermal.c | 4 +---
drivers/thermal/qcom/tsens-common.c | 7 ++-----
drivers/thermal/rcar_thermal.c | 5 ++---
drivers/thermal/rockchip_thermal.c | 4 +---
drivers/thermal/spear_thermal.c | 4 +---
drivers/thermal/st/stm_thermal.c | 4 +---
drivers/thermal/tango_thermal.c | 4 +---
drivers/thermal/thermal_mmio.c | 4 +---
drivers/thermal/zx2967_thermal.c | 4 +---
15 files changed, 18 insertions(+), 49 deletions(-)

--
2.7.4



2019-09-04 12:35:46

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 01/15] thermal: armada: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/thermal/armada_thermal.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
index 709a22f..70fe9c6 100644
--- a/drivers/thermal/armada_thermal.c
+++ b/drivers/thermal/armada_thermal.c
@@ -708,12 +708,10 @@ static int armada_thermal_probe_legacy(struct platform_device *pdev,
struct armada_thermal_priv *priv)
{
struct armada_thermal_data *data = priv->data;
- struct resource *res;
void __iomem *base;

/* First memory region points towards the status register */
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- base = devm_ioremap_resource(&pdev->dev, res);
+ base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))
return PTR_ERR(base);

--
2.7.4


2019-09-04 12:36:02

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 04/15] thermal: hisilicon: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/thermal/hisi_thermal.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c
index 2d26ae8..8c0e002 100644
--- a/drivers/thermal/hisi_thermal.c
+++ b/drivers/thermal/hisi_thermal.c
@@ -557,7 +557,6 @@ static int hisi_thermal_probe(struct platform_device *pdev)
{
struct hisi_thermal_data *data;
struct device *dev = &pdev->dev;
- struct resource *res;
int i, ret;

data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
@@ -568,8 +567,7 @@ static int hisi_thermal_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, data);
data->ops = of_device_get_match_data(dev);

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- data->regs = devm_ioremap_resource(dev, res);
+ data->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(data->regs)) {
dev_err(dev, "failed to get io address\n");
return PTR_ERR(data->regs);
--
2.7.4


2019-09-04 12:36:03

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 05/15] thermal: dove: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/thermal/dove_thermal.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c
index 75901ce..e53ac71 100644
--- a/drivers/thermal/dove_thermal.c
+++ b/drivers/thermal/dove_thermal.c
@@ -122,20 +122,17 @@ static int dove_thermal_probe(struct platform_device *pdev)
{
struct thermal_zone_device *thermal = NULL;
struct dove_thermal_priv *priv;
- struct resource *res;
int ret;

priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- priv->sensor = devm_ioremap_resource(&pdev->dev, res);
+ priv->sensor = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(priv->sensor))
return PTR_ERR(priv->sensor);

- res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- priv->control = devm_ioremap_resource(&pdev->dev, res);
+ priv->control = devm_platform_ioremap_resource(pdev, 1);
if (IS_ERR(priv->control))
return PTR_ERR(priv->control);

--
2.7.4


2019-09-04 12:36:07

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 06/15] thermal: mtk: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/thermal/mtk_thermal.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
index acf4854..da36271 100644
--- a/drivers/thermal/mtk_thermal.c
+++ b/drivers/thermal/mtk_thermal.c
@@ -867,7 +867,6 @@ static int mtk_thermal_probe(struct platform_device *pdev)
int ret, i, ctrl_id;
struct device_node *auxadc, *apmixedsys, *np = pdev->dev.of_node;
struct mtk_thermal *mt;
- struct resource *res;
u64 auxadc_phys_base, apmixed_phys_base;
struct thermal_zone_device *tzdev;

@@ -885,8 +884,7 @@ static int mtk_thermal_probe(struct platform_device *pdev)
if (IS_ERR(mt->clk_auxadc))
return PTR_ERR(mt->clk_auxadc);

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- mt->thermal_base = devm_ioremap_resource(&pdev->dev, res);
+ mt->thermal_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(mt->thermal_base))
return PTR_ERR(mt->thermal_base);

--
2.7.4


2019-09-04 12:36:10

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 07/15] thermal: kirkwood: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/thermal/kirkwood_thermal.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c
index 189b675..762ef12 100644
--- a/drivers/thermal/kirkwood_thermal.c
+++ b/drivers/thermal/kirkwood_thermal.c
@@ -64,14 +64,12 @@ static int kirkwood_thermal_probe(struct platform_device *pdev)
{
struct thermal_zone_device *thermal = NULL;
struct kirkwood_thermal_priv *priv;
- struct resource *res;

priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- priv->sensor = devm_ioremap_resource(&pdev->dev, res);
+ priv->sensor = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(priv->sensor))
return PTR_ERR(priv->sensor);

--
2.7.4


2019-09-04 12:36:15

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 10/15] thermal: spear: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/thermal/spear_thermal.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c
index f68f581..19c690f 100644
--- a/drivers/thermal/spear_thermal.c
+++ b/drivers/thermal/spear_thermal.c
@@ -91,7 +91,6 @@ static int spear_thermal_probe(struct platform_device *pdev)
struct thermal_zone_device *spear_thermal = NULL;
struct spear_thermal_dev *stdev;
struct device_node *np = pdev->dev.of_node;
- struct resource *res;
int ret = 0, val;

if (!np || !of_property_read_u32(np, "st,thermal-flags", &val)) {
@@ -104,8 +103,7 @@ static int spear_thermal_probe(struct platform_device *pdev)
return -ENOMEM;

/* Enable thermal sensor */
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- stdev->thermal_base = devm_ioremap_resource(&pdev->dev, res);
+ stdev->thermal_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(stdev->thermal_base))
return PTR_ERR(stdev->thermal_base);

--
2.7.4


2019-09-04 12:36:24

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 12/15] thermal: tango: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/thermal/tango_thermal.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/thermal/tango_thermal.c b/drivers/thermal/tango_thermal.c
index 304b461..f44441b 100644
--- a/drivers/thermal/tango_thermal.c
+++ b/drivers/thermal/tango_thermal.c
@@ -73,7 +73,6 @@ static void tango_thermal_init(struct tango_thermal_priv *priv)

static int tango_thermal_probe(struct platform_device *pdev)
{
- struct resource *res;
struct tango_thermal_priv *priv;
struct thermal_zone_device *tzdev;

@@ -81,8 +80,7 @@ static int tango_thermal_probe(struct platform_device *pdev)
if (!priv)
return -ENOMEM;

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- priv->base = devm_ioremap_resource(&pdev->dev, res);
+ priv->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);

--
2.7.4


2019-09-04 12:36:28

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 11/15] thermal: stm32: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/thermal/st/stm_thermal.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c
index cf9ddc5..a5d85f5 100644
--- a/drivers/thermal/st/stm_thermal.c
+++ b/drivers/thermal/st/stm_thermal.c
@@ -611,7 +611,6 @@ MODULE_DEVICE_TABLE(of, stm_thermal_of_match);
static int stm_thermal_probe(struct platform_device *pdev)
{
struct stm_thermal_sensor *sensor;
- struct resource *res;
const struct thermal_trip *trip;
void __iomem *base;
int ret, i;
@@ -630,8 +629,7 @@ static int stm_thermal_probe(struct platform_device *pdev)

sensor->dev = &pdev->dev;

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- base = devm_ioremap_resource(&pdev->dev, res);
+ base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))
return PTR_ERR(base);

--
2.7.4


2019-09-04 12:36:35

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 15/15] thermal: rcar: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/thermal/rcar_thermal.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index d0873de..d7f6aab 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -523,9 +523,8 @@ static int rcar_thermal_probe(struct platform_device *pdev)
* Then, driver uses common registers
* rcar_has_irq_support() will be enabled
*/
- res = platform_get_resource(pdev, IORESOURCE_MEM,
- mres++);
- common->base = devm_ioremap_resource(dev, res);
+ common->base = devm_platform_ioremap_resource(pdev,
+ mres++);
if (IS_ERR(common->base))
return PTR_ERR(common->base);

--
2.7.4


2019-09-04 12:37:07

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 03/15] thermal: brcmstb: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/thermal/broadcom/brcmstb_thermal.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c
index 5825ac5..de43c3e 100644
--- a/drivers/thermal/broadcom/brcmstb_thermal.c
+++ b/drivers/thermal/broadcom/brcmstb_thermal.c
@@ -305,15 +305,13 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
{
struct thermal_zone_device *thermal;
struct brcmstb_thermal_priv *priv;
- struct resource *res;
int irq, ret;

priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- priv->tmon_base = devm_ioremap_resource(&pdev->dev, res);
+ priv->tmon_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(priv->tmon_base))
return PTR_ERR(priv->tmon_base);

--
2.7.4


2019-09-04 12:37:28

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 09/15] thermal: rockchip: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/thermal/rockchip_thermal.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index 343c2f5..044e6eb 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -1219,7 +1219,6 @@ static int rockchip_thermal_probe(struct platform_device *pdev)
struct device_node *np = pdev->dev.of_node;
struct rockchip_thermal_data *thermal;
const struct of_device_id *match;
- struct resource *res;
int irq;
int i;
int error;
@@ -1245,8 +1244,7 @@ static int rockchip_thermal_probe(struct platform_device *pdev)
if (!thermal->chip)
return -EINVAL;

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- thermal->regs = devm_ioremap_resource(&pdev->dev, res);
+ thermal->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(thermal->regs))
return PTR_ERR(thermal->regs);

--
2.7.4


2019-09-04 12:37:43

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 13/15] thermal: thermal_mmio: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/thermal/thermal_mmio.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/thermal/thermal_mmio.c b/drivers/thermal/thermal_mmio.c
index 40524fa..1663152 100644
--- a/drivers/thermal/thermal_mmio.c
+++ b/drivers/thermal/thermal_mmio.c
@@ -40,7 +40,6 @@ static struct thermal_zone_of_device_ops thermal_mmio_ops = {

static int thermal_mmio_probe(struct platform_device *pdev)
{
- struct resource *resource;
struct thermal_mmio *sensor;
int (*sensor_init_func)(struct platform_device *pdev,
struct thermal_mmio *sensor);
@@ -52,8 +51,7 @@ static int thermal_mmio_probe(struct platform_device *pdev)
if (!sensor)
return -ENOMEM;

- resource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- sensor->mmio_base = devm_ioremap_resource(&pdev->dev, resource);
+ sensor->mmio_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(sensor->mmio_base)) {
dev_err(&pdev->dev, "failed to ioremap memory (%ld)\n",
PTR_ERR(sensor->mmio_base));
--
2.7.4


2019-09-04 12:37:46

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 02/15] thermal: bcm2835: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/thermal/broadcom/bcm2835_thermal.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c
index 3199977..01eec8e 100644
--- a/drivers/thermal/broadcom/bcm2835_thermal.c
+++ b/drivers/thermal/broadcom/bcm2835_thermal.c
@@ -166,7 +166,6 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
const struct of_device_id *match;
struct thermal_zone_device *tz;
struct bcm2835_thermal_data *data;
- struct resource *res;
int err = 0;
u32 val;
unsigned long rate;
@@ -180,8 +179,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
if (!match)
return -EINVAL;

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- data->regs = devm_ioremap_resource(&pdev->dev, res);
+ data->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(data->regs)) {
err = PTR_ERR(data->regs);
dev_err(&pdev->dev, "Could not get registers: %d\n", err);
--
2.7.4


2019-09-04 12:38:06

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 14/15] thermal: zx2967: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/thermal/zx2967_thermal.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/thermal/zx2967_thermal.c b/drivers/thermal/zx2967_thermal.c
index 7c8a82c..b67e776 100644
--- a/drivers/thermal/zx2967_thermal.c
+++ b/drivers/thermal/zx2967_thermal.c
@@ -117,15 +117,13 @@ static const struct thermal_zone_of_device_ops zx2967_of_thermal_ops = {
static int zx2967_thermal_probe(struct platform_device *pdev)
{
struct zx2967_thermal_priv *priv;
- struct resource *res;
int ret;

priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- priv->regs = devm_ioremap_resource(&pdev->dev, res);
+ priv->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(priv->regs))
return PTR_ERR(priv->regs);

--
2.7.4


2019-09-04 12:38:13

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next 08/15] thermal: tsens: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
drivers/thermal/qcom/tsens-common.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c
index 528df88..43ce4fb 100644
--- a/drivers/thermal/qcom/tsens-common.c
+++ b/drivers/thermal/qcom/tsens-common.c
@@ -155,7 +155,6 @@ int __init init_common(struct tsens_priv *priv)
{
void __iomem *tm_base, *srot_base;
struct device *dev = priv->dev;
- struct resource *res;
u32 enabled;
int ret, i, j;
struct platform_device *op = of_find_device_by_node(priv->dev->of_node);
@@ -166,8 +165,7 @@ int __init init_common(struct tsens_priv *priv)
if (op->num_resources > 1) {
/* DT with separate SROT and TM address space */
priv->tm_offset = 0;
- res = platform_get_resource(op, IORESOURCE_MEM, 1);
- srot_base = devm_ioremap_resource(&op->dev, res);
+ srot_base = devm_platform_ioremap_resource(op, 1);
if (IS_ERR(srot_base)) {
ret = PTR_ERR(srot_base);
goto err_put_device;
@@ -184,8 +182,7 @@ int __init init_common(struct tsens_priv *priv)
priv->tm_offset = 0x1000;
}

- res = platform_get_resource(op, IORESOURCE_MEM, 0);
- tm_base = devm_ioremap_resource(&op->dev, res);
+ tm_base = devm_platform_ioremap_resource(op, 0);
if (IS_ERR(tm_base)) {
ret = PTR_ERR(tm_base);
goto err_put_device;
--
2.7.4


2019-09-04 12:44:51

by Miquel Raynal

[permalink] [raw]
Subject: Re: [PATCH -next 01/15] thermal: armada: use devm_platform_ioremap_resource() to simplify code

Hi Yue,

YueHaibing <[email protected]> wrote on Wed, 4 Sep 2019 20:29:25
+0800:

> Use devm_platform_ioremap_resource() to simplify the code a bit.
> This is detected by coccinelle.
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: YueHaibing <[email protected]>
> ---
> drivers/thermal/armada_thermal.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
> index 709a22f..70fe9c6 100644
> --- a/drivers/thermal/armada_thermal.c
> +++ b/drivers/thermal/armada_thermal.c
> @@ -708,12 +708,10 @@ static int armada_thermal_probe_legacy(struct platform_device *pdev,
> struct armada_thermal_priv *priv)
> {
> struct armada_thermal_data *data = priv->data;
> - struct resource *res;
> void __iomem *base;
>
> /* First memory region points towards the status register */
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - base = devm_ioremap_resource(&pdev->dev, res);
> + base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(base))
> return PTR_ERR(base);
>

Reviewed-by: Miquel Raynal <[email protected]>

Thanks,
Miquèl

2019-09-04 13:18:57

by Shenhar, Talel

[permalink] [raw]
Subject: Re: [PATCH -next 13/15] thermal: thermal_mmio: use devm_platform_ioremap_resource() to simplify code

Thanks.

Talel.

On 9/4/19 2:29 PM, YueHaibing wrote:
> Use devm_platform_ioremap_resource() to simplify the code a bit.
> This is detected by coccinelle.
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: YueHaibing <[email protected]>
Reviewed-By: Talel Shenhar <[email protected]>
> ---
> drivers/thermal/thermal_mmio.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)

2019-09-04 17:02:16

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH -next 03/15] thermal: brcmstb: use devm_platform_ioremap_resource() to simplify code

On 9/4/19 5:29 AM, YueHaibing wrote:
> Use devm_platform_ioremap_resource() to simplify the code a bit.
> This is detected by coccinelle.
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: YueHaibing <[email protected]>

Acked-by: Florian Fainelli <[email protected]>
--
Florian

2019-09-04 17:26:31

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH -next 15/15] thermal: rcar: use devm_platform_ioremap_resource() to simplify code

On Wed, Sep 04, 2019 at 08:29:39PM +0800, YueHaibing wrote:
> Use devm_platform_ioremap_resource() to simplify the code a bit.
> This is detected by coccinelle.
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: YueHaibing <[email protected]>

I think for such straightforward (and manifold) conversions, one patch
per subsystem is better than one patch per driver. But this is not my
subsystem, so I'll leave it to the thermal maintainers.


Attachments:
(No filename) (472.00 B)
signature.asc (849.00 B)
Download all attachments

2019-09-04 21:53:11

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH -next 08/15] thermal: tsens: use devm_platform_ioremap_resource() to simplify code

On Wed 04 Sep 05:29 PDT 2019, YueHaibing wrote:

> Use devm_platform_ioremap_resource() to simplify the code a bit.
> This is detected by coccinelle.
>

Reviewed-by: Bjorn Andersson <[email protected]>

> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: YueHaibing <[email protected]>
> ---
> drivers/thermal/qcom/tsens-common.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c
> index 528df88..43ce4fb 100644
> --- a/drivers/thermal/qcom/tsens-common.c
> +++ b/drivers/thermal/qcom/tsens-common.c
> @@ -155,7 +155,6 @@ int __init init_common(struct tsens_priv *priv)
> {
> void __iomem *tm_base, *srot_base;
> struct device *dev = priv->dev;
> - struct resource *res;
> u32 enabled;
> int ret, i, j;
> struct platform_device *op = of_find_device_by_node(priv->dev->of_node);
> @@ -166,8 +165,7 @@ int __init init_common(struct tsens_priv *priv)
> if (op->num_resources > 1) {
> /* DT with separate SROT and TM address space */
> priv->tm_offset = 0;
> - res = platform_get_resource(op, IORESOURCE_MEM, 1);
> - srot_base = devm_ioremap_resource(&op->dev, res);
> + srot_base = devm_platform_ioremap_resource(op, 1);
> if (IS_ERR(srot_base)) {
> ret = PTR_ERR(srot_base);
> goto err_put_device;
> @@ -184,8 +182,7 @@ int __init init_common(struct tsens_priv *priv)
> priv->tm_offset = 0x1000;
> }
>
> - res = platform_get_resource(op, IORESOURCE_MEM, 0);
> - tm_base = devm_ioremap_resource(&op->dev, res);
> + tm_base = devm_platform_ioremap_resource(op, 0);
> if (IS_ERR(tm_base)) {
> ret = PTR_ERR(tm_base);
> goto err_put_device;
> --
> 2.7.4
>
>

2019-09-05 06:47:06

by Amit Kucheria

[permalink] [raw]
Subject: Re: [PATCH -next 08/15] thermal: tsens: use devm_platform_ioremap_resource() to simplify code

On Wed, Sep 4, 2019 at 6:05 PM YueHaibing <[email protected]> wrote:
>
> Use devm_platform_ioremap_resource() to simplify the code a bit.
> This is detected by coccinelle.
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: YueHaibing <[email protected]>

Acked-by: Amit Kucheria <[email protected]>

> ---
> drivers/thermal/qcom/tsens-common.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c
> index 528df88..43ce4fb 100644
> --- a/drivers/thermal/qcom/tsens-common.c
> +++ b/drivers/thermal/qcom/tsens-common.c
> @@ -155,7 +155,6 @@ int __init init_common(struct tsens_priv *priv)
> {
> void __iomem *tm_base, *srot_base;
> struct device *dev = priv->dev;
> - struct resource *res;
> u32 enabled;
> int ret, i, j;
> struct platform_device *op = of_find_device_by_node(priv->dev->of_node);
> @@ -166,8 +165,7 @@ int __init init_common(struct tsens_priv *priv)
> if (op->num_resources > 1) {
> /* DT with separate SROT and TM address space */
> priv->tm_offset = 0;
> - res = platform_get_resource(op, IORESOURCE_MEM, 1);
> - srot_base = devm_ioremap_resource(&op->dev, res);
> + srot_base = devm_platform_ioremap_resource(op, 1);
> if (IS_ERR(srot_base)) {
> ret = PTR_ERR(srot_base);
> goto err_put_device;
> @@ -184,8 +182,7 @@ int __init init_common(struct tsens_priv *priv)
> priv->tm_offset = 0x1000;
> }
>
> - res = platform_get_resource(op, IORESOURCE_MEM, 0);
> - tm_base = devm_ioremap_resource(&op->dev, res);
> + tm_base = devm_platform_ioremap_resource(op, 0);
> if (IS_ERR(tm_base)) {
> ret = PTR_ERR(tm_base);
> goto err_put_device;
> --
> 2.7.4
>
>

2019-09-05 13:02:12

by Måns Rullgård

[permalink] [raw]
Subject: Re: [PATCH -next 12/15] thermal: tango: use devm_platform_ioremap_resource() to simplify code

YueHaibing <[email protected]> writes:

> Use devm_platform_ioremap_resource() to simplify the code a bit.
> This is detected by coccinelle.
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: YueHaibing <[email protected]>

Acked-by: Mans Rullgard <[email protected]>

> ---
> drivers/thermal/tango_thermal.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/thermal/tango_thermal.c b/drivers/thermal/tango_thermal.c
> index 304b461..f44441b 100644
> --- a/drivers/thermal/tango_thermal.c
> +++ b/drivers/thermal/tango_thermal.c
> @@ -73,7 +73,6 @@ static void tango_thermal_init(struct tango_thermal_priv *priv)
>
> static int tango_thermal_probe(struct platform_device *pdev)
> {
> - struct resource *res;
> struct tango_thermal_priv *priv;
> struct thermal_zone_device *tzdev;
>
> @@ -81,8 +80,7 @@ static int tango_thermal_probe(struct platform_device *pdev)
> if (!priv)
> return -ENOMEM;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - priv->base = devm_ioremap_resource(&pdev->dev, res);
> + priv->base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(priv->base))
> return PTR_ERR(priv->base);
>
> --
> 2.7.4
>

--
M?ns Rullg?rd

2019-09-05 22:33:29

by Stefan Wahren

[permalink] [raw]
Subject: Re: [PATCH -next 02/15] thermal: bcm2835: use devm_platform_ioremap_resource() to simplify code

Am 04.09.19 um 14:29 schrieb YueHaibing:
> Use devm_platform_ioremap_resource() to simplify the code a bit.
> This is detected by coccinelle.
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: YueHaibing <[email protected]>
Acked-by: Stefan Wahren <[email protected]>

2019-10-04 21:50:47

by Heiko Stübner

[permalink] [raw]
Subject: Re: [PATCH -next 09/15] thermal: rockchip: use devm_platform_ioremap_resource() to simplify code

Am Mittwoch, 4. September 2019, 14:29:33 CEST schrieb YueHaibing:
> Use devm_platform_ioremap_resource() to simplify the code a bit.
> This is detected by coccinelle.
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: YueHaibing <[email protected]>

Reviewed-by: Heiko Stuebner <[email protected]>

> ---
> drivers/thermal/rockchip_thermal.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
> index 343c2f5..044e6eb 100644
> --- a/drivers/thermal/rockchip_thermal.c
> +++ b/drivers/thermal/rockchip_thermal.c
> @@ -1219,7 +1219,6 @@ static int rockchip_thermal_probe(struct platform_device *pdev)
> struct device_node *np = pdev->dev.of_node;
> struct rockchip_thermal_data *thermal;
> const struct of_device_id *match;
> - struct resource *res;
> int irq;
> int i;
> int error;
> @@ -1245,8 +1244,7 @@ static int rockchip_thermal_probe(struct platform_device *pdev)
> if (!thermal->chip)
> return -EINVAL;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - thermal->regs = devm_ioremap_resource(&pdev->dev, res);
> + thermal->regs = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(thermal->regs))
> return PTR_ERR(thermal->regs);
>
>