Skip to contentSkip to conversation

thermal/drivers/tsens: Use devm_platform_ioremap_resource()

PATCH In review [email protected] 2 participants 2 messages Feb 17, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal/drivers/tsens: Use devm_platform_ioremap_resource()

From: Ye Xingchen <[email protected]>

Convert platform_get_resource(), devm_ioremap_resource() to a single call to Use devm_platform_ioremap_resource(), as this is exactly what this function does.

---
 drivers/thermal/qcom/tsens.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/thermal/qcom/tsens.c +2 -5
index 8020ead2794e..bfe7e4728cf0 100644
@@ -876,7 +876,6 @@ int __init init_common(struct tsens_priv *priv)
 	void __iomem *tm_base, *srot_base;
 	struct device *dev = priv->dev;
 	u32 ver_minor;
-	struct resource *res;
 	u32 enabled;
 	int ret, i, j;
 	struct platform_device *op = of_find_device_by_node(priv->dev->of_node);
@@ -887,8 +886,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(dev, res);
+		srot_base = devm_platform_ioremap_resource(op, 1);
 		if (IS_ERR(srot_base)) {
 			ret = PTR_ERR(srot_base);
 			goto err_put_device;
@@ -906,8 +904,7 @@ int __init init_common(struct tsens_priv *priv)
 	}
 
 	if (tsens_version(priv) >= VER_0_1) {
-		res = platform_get_resource(op, IORESOURCE_MEM, 0);
-		tm_base = devm_ioremap_resource(dev, res);
+		tm_base = devm_platform_ioremap_resource(op, 0);
 		if (IS_ERR(tm_base)) {
 			ret = PTR_ERR(tm_base);
 			goto err_put_device;
Signature · 1 line
2.25.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · On Fri, Feb 17, 2023 at 9:08 AM <[email protected]> wrote:

From: Ye Xingchen <[email protected]>

Convert platform_get_resource(), devm_ioremap_resource() to a single call to Use devm_platform_ioremap_resource(), as this is exactly what this function does.

Quoted 38 lines
---
 drivers/thermal/qcom/tsens.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/thermal/qcom/tsens.c +2 -6
index 8020ead2794e..bfe7e4728cf0 100644
@@ -876,7 +876,6 @@ int __init init_common(struct tsens_priv *priv)
        void __iomem *tm_base, *srot_base;
        struct device *dev = priv->dev;
        u32 ver_minor;
-       struct resource *res;
        u32 enabled;
        int ret, i, j;
        struct platform_device *op = of_find_device_by_node(priv->dev->of_node);
@@ -887,8 +886,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(dev, res);
+               srot_base = devm_platform_ioremap_resource(op, 1);
                if (IS_ERR(srot_base)) {
                        ret = PTR_ERR(srot_base);
                        goto err_put_device;
@@ -906,8 +904,7 @@ int __init init_common(struct tsens_priv *priv)
        }
 
        if (tsens_version(priv) >= VER_0_1) {
-               res = platform_get_resource(op, IORESOURCE_MEM, 0);
-               tm_base = devm_ioremap_resource(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.25.1