Skip to contentSkip to conversation

pwm: sun4i: convert to devm_platform_ioremap_resource

PATCH In review Yangtao Li 17 participants 158 messages Dec 29, 2019 – Nov 19, 2020 4 messages not in the archive

Subsystems (25)
lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH 1/32 pwm: sun4i: convert to devm_platform_ioremap_resource

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-sun4i.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-sun4i.c +1 -3
index 581d23287333..f2afd312f77c 100644
@@ -344,7 +344,6 @@ MODULE_DEVICE_TABLE(of, sun4i_pwm_dt_ids);
 static int sun4i_pwm_probe(struct platform_device *pdev)
 {
 	struct sun4i_pwm_chip *pwm;
-	struct resource *res;
 	int ret;
 
 	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
@@ -355,8 +354,7 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
 	if (!pwm->data)
 		return -ENODEV;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pwm->base = devm_ioremap_resource(&pdev->dev, res);
+	pwm->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pwm->base))
 		return PTR_ERR(pwm->base);
 
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 2/32 pwm: fsl-ftm: convert to devm_platform_ioremap_resource

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-fsl-ftm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-fsl-ftm.c +1 -3
index 59272a920479..2a6801226aba 100644
@@ -399,7 +399,6 @@ static const struct regmap_config fsl_pwm_regmap_config = {
 static int fsl_pwm_probe(struct platform_device *pdev)
 {
 	struct fsl_pwm_chip *fpc;
-	struct resource *res;
 	void __iomem *base;
 	int ret;
 
@@ -412,8 +411,7 @@ static int fsl_pwm_probe(struct platform_device *pdev)
 	fpc->soc = of_device_get_match_data(&pdev->dev);
 	fpc->chip.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);
 
Signature · 1 line
2.17.1
#4 lore raw

PATCH 2/32 pwm: fsl-ftm: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-fsl-ftm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-fsl-ftm.c +1 -3
index 59272a920479..2a6801226aba 100644
@@ -399,7 +399,6 @@ static const struct regmap_config fsl_pwm_regmap_config = {
 static int fsl_pwm_probe(struct platform_device *pdev)
 {
 	struct fsl_pwm_chip *fpc;
-	struct resource *res;
 	void __iomem *base;
 	int ret;
 
@@ -412,8 +411,7 @@ static int fsl_pwm_probe(struct platform_device *pdev)
 	fpc->soc = of_device_get_match_data(&pdev->dev);
 	fpc->chip.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);
 
Signature · 1 line
2.17.1
author
#35 lore raw

PATCH 2/32 pwm: fsl-ftm: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-fsl-ftm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-fsl-ftm.c +1 -3
index 59272a920479..2a6801226aba 100644
@@ -399,7 +399,6 @@ static const struct regmap_config fsl_pwm_regmap_config = {
 static int fsl_pwm_probe(struct platform_device *pdev)
 {
 	struct fsl_pwm_chip *fpc;
-	struct resource *res;
 	void __iomem *base;
 	int ret;
 
@@ -412,8 +411,7 @@ static int fsl_pwm_probe(struct platform_device *pdev)
 	fpc->soc = of_device_get_match_data(&pdev->dev);
 	fpc->chip.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);
 
Signature · 1 line
2.17.1
#5 lore raw

PATCH 3/32 pwm: rcar: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-rcar.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-rcar.c +1 -3
index 852eb2347954..7bd67f69db84 100644
@@ -203,15 +203,13 @@ static const struct pwm_ops rcar_pwm_ops = {
 static int rcar_pwm_probe(struct platform_device *pdev)
 {
 	struct rcar_pwm_chip *rcar_pwm;
-	struct resource *res;
 	int ret;
 
 	rcar_pwm = devm_kzalloc(&pdev->dev, sizeof(*rcar_pwm), GFP_KERNEL);
 	if (rcar_pwm == NULL)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	rcar_pwm->base = devm_ioremap_resource(&pdev->dev, res);
+	rcar_pwm->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(rcar_pwm->base))
 		return PTR_ERR(rcar_pwm->base);
 
Signature · 1 line
2.17.1
author
#36 lore raw

PATCH 3/32 pwm: rcar: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-rcar.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-rcar.c +1 -3
index 852eb2347954..7bd67f69db84 100644
@@ -203,15 +203,13 @@ static const struct pwm_ops rcar_pwm_ops = {
 static int rcar_pwm_probe(struct platform_device *pdev)
 {
 	struct rcar_pwm_chip *rcar_pwm;
-	struct resource *res;
 	int ret;
 
 	rcar_pwm = devm_kzalloc(&pdev->dev, sizeof(*rcar_pwm), GFP_KERNEL);
 	if (rcar_pwm == NULL)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	rcar_pwm->base = devm_ioremap_resource(&pdev->dev, res);
+	rcar_pwm->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(rcar_pwm->base))
 		return PTR_ERR(rcar_pwm->base);
 
Signature · 1 line
2.17.1
author
#38 lore raw

PATCH 3/32 pwm: rcar: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-rcar.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-rcar.c +1 -3
index 852eb2347954..7bd67f69db84 100644
@@ -203,15 +203,13 @@ static const struct pwm_ops rcar_pwm_ops = {
 static int rcar_pwm_probe(struct platform_device *pdev)
 {
 	struct rcar_pwm_chip *rcar_pwm;
-	struct resource *res;
 	int ret;
 
 	rcar_pwm = devm_kzalloc(&pdev->dev, sizeof(*rcar_pwm), GFP_KERNEL);
 	if (rcar_pwm == NULL)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	rcar_pwm->base = devm_ioremap_resource(&pdev->dev, res);
+	rcar_pwm->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(rcar_pwm->base))
 		return PTR_ERR(rcar_pwm->base);
 
Signature · 1 line
2.17.1
#6 lore raw

PATCH 4/32 pwm: renesas-tpu: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-renesas-tpu.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-renesas-tpu.c +1 -3
index 4a855a21b782..9f4695cc8e72 100644
@@ -383,7 +383,6 @@ static const struct pwm_ops tpu_pwm_ops = {
 static int tpu_probe(struct platform_device *pdev)
 {
 	struct tpu_device *tpu;
-	struct resource *res;
 	int ret;
 
 	tpu = devm_kzalloc(&pdev->dev, sizeof(*tpu), GFP_KERNEL);
@@ -394,8 +393,7 @@ static int tpu_probe(struct platform_device *pdev)
 	tpu->pdev = pdev;
 
 	/* Map memory, get clock and pin control. */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	tpu->base = devm_ioremap_resource(&pdev->dev, res);
+	tpu->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(tpu->base))
 		return PTR_ERR(tpu->base);
 
Signature · 1 line
2.17.1
author
#39 lore raw

PATCH 4/32 pwm: renesas-tpu: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-renesas-tpu.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-renesas-tpu.c +1 -3
index 4a855a21b782..9f4695cc8e72 100644
@@ -383,7 +383,6 @@ static const struct pwm_ops tpu_pwm_ops = {
 static int tpu_probe(struct platform_device *pdev)
 {
 	struct tpu_device *tpu;
-	struct resource *res;
 	int ret;
 
 	tpu = devm_kzalloc(&pdev->dev, sizeof(*tpu), GFP_KERNEL);
@@ -394,8 +393,7 @@ static int tpu_probe(struct platform_device *pdev)
 	tpu->pdev = pdev;
 
 	/* Map memory, get clock and pin control. */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	tpu->base = devm_ioremap_resource(&pdev->dev, res);
+	tpu->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(tpu->base))
 		return PTR_ERR(tpu->base);
 
Signature · 1 line
2.17.1
author
#41 lore raw

PATCH 4/32 pwm: renesas-tpu: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-renesas-tpu.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-renesas-tpu.c +1 -3
index 4a855a21b782..9f4695cc8e72 100644
@@ -383,7 +383,6 @@ static const struct pwm_ops tpu_pwm_ops = {
 static int tpu_probe(struct platform_device *pdev)
 {
 	struct tpu_device *tpu;
-	struct resource *res;
 	int ret;
 
 	tpu = devm_kzalloc(&pdev->dev, sizeof(*tpu), GFP_KERNEL);
@@ -394,8 +393,7 @@ static int tpu_probe(struct platform_device *pdev)
 	tpu->pdev = pdev;
 
 	/* Map memory, get clock and pin control. */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	tpu->base = devm_ioremap_resource(&pdev->dev, res);
+	tpu->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(tpu->base))
 		return PTR_ERR(tpu->base);
 
Signature · 1 line
2.17.1
#7 lore raw

PATCH 5/32 pwm: ep93xx: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-ep93xx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-ep93xx.c +1 -3
index 4bab73073ad7..c9fc6f223640 100644
@@ -169,15 +169,13 @@ static const struct pwm_ops ep93xx_pwm_ops = {
 static int ep93xx_pwm_probe(struct platform_device *pdev)
 {
 	struct ep93xx_pwm *ep93xx_pwm;
-	struct resource *res;
 	int ret;
 
 	ep93xx_pwm = devm_kzalloc(&pdev->dev, sizeof(*ep93xx_pwm), GFP_KERNEL);
 	if (!ep93xx_pwm)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	ep93xx_pwm->base = devm_ioremap_resource(&pdev->dev, res);
+	ep93xx_pwm->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(ep93xx_pwm->base))
 		return PTR_ERR(ep93xx_pwm->base);
 
Signature · 1 line
2.17.1
author
#42 lore raw

PATCH 5/32 pwm: ep93xx: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-ep93xx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-ep93xx.c +1 -3
index 4bab73073ad7..c9fc6f223640 100644
@@ -169,15 +169,13 @@ static const struct pwm_ops ep93xx_pwm_ops = {
 static int ep93xx_pwm_probe(struct platform_device *pdev)
 {
 	struct ep93xx_pwm *ep93xx_pwm;
-	struct resource *res;
 	int ret;
 
 	ep93xx_pwm = devm_kzalloc(&pdev->dev, sizeof(*ep93xx_pwm), GFP_KERNEL);
 	if (!ep93xx_pwm)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	ep93xx_pwm->base = devm_ioremap_resource(&pdev->dev, res);
+	ep93xx_pwm->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(ep93xx_pwm->base))
 		return PTR_ERR(ep93xx_pwm->base);
 
Signature · 1 line
2.17.1
author
#44 lore raw

PATCH 5/32 pwm: ep93xx: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-ep93xx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-ep93xx.c +1 -3
index 4bab73073ad7..c9fc6f223640 100644
@@ -169,15 +169,13 @@ static const struct pwm_ops ep93xx_pwm_ops = {
 static int ep93xx_pwm_probe(struct platform_device *pdev)
 {
 	struct ep93xx_pwm *ep93xx_pwm;
-	struct resource *res;
 	int ret;
 
 	ep93xx_pwm = devm_kzalloc(&pdev->dev, sizeof(*ep93xx_pwm), GFP_KERNEL);
 	if (!ep93xx_pwm)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	ep93xx_pwm->base = devm_ioremap_resource(&pdev->dev, res);
+	ep93xx_pwm->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(ep93xx_pwm->base))
 		return PTR_ERR(ep93xx_pwm->base);
 
Signature · 1 line
2.17.1
#8 lore raw

PATCH 6/32 pwm: tegra: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-tegra.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-tegra.c +1 -3
index aa12fb3ed92e..7f77a93eb4b5 100644
@@ -170,7 +170,6 @@ static const struct pwm_ops tegra_pwm_ops = {
 static int tegra_pwm_probe(struct platform_device *pdev)
 {
 	struct tegra_pwm_chip *pwm;
-	struct resource *r;
 	int ret;
 
 	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
@@ -180,8 +179,7 @@ static int tegra_pwm_probe(struct platform_device *pdev)
 	pwm->soc = of_device_get_match_data(&pdev->dev);
 	pwm->dev = &pdev->dev;
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pwm->regs = devm_ioremap_resource(&pdev->dev, r);
+	pwm->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pwm->regs))
 		return PTR_ERR(pwm->regs);
 
Signature · 1 line
2.17.1
author
#45 lore raw

PATCH 6/32 pwm: tegra: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-tegra.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-tegra.c +1 -3
index aa12fb3ed92e..7f77a93eb4b5 100644
@@ -170,7 +170,6 @@ static const struct pwm_ops tegra_pwm_ops = {
 static int tegra_pwm_probe(struct platform_device *pdev)
 {
 	struct tegra_pwm_chip *pwm;
-	struct resource *r;
 	int ret;
 
 	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
@@ -180,8 +179,7 @@ static int tegra_pwm_probe(struct platform_device *pdev)
 	pwm->soc = of_device_get_match_data(&pdev->dev);
 	pwm->dev = &pdev->dev;
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pwm->regs = devm_ioremap_resource(&pdev->dev, r);
+	pwm->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pwm->regs))
 		return PTR_ERR(pwm->regs);
 
Signature · 1 line
2.17.1
author
#47 lore raw

PATCH 6/32 pwm: tegra: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-tegra.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-tegra.c +1 -3
index aa12fb3ed92e..7f77a93eb4b5 100644
@@ -170,7 +170,6 @@ static const struct pwm_ops tegra_pwm_ops = {
 static int tegra_pwm_probe(struct platform_device *pdev)
 {
 	struct tegra_pwm_chip *pwm;
-	struct resource *r;
 	int ret;
 
 	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
@@ -180,8 +179,7 @@ static int tegra_pwm_probe(struct platform_device *pdev)
 	pwm->soc = of_device_get_match_data(&pdev->dev);
 	pwm->dev = &pdev->dev;
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pwm->regs = devm_ioremap_resource(&pdev->dev, r);
+	pwm->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pwm->regs))
 		return PTR_ERR(pwm->regs);
 
Signature · 1 line
2.17.1
#9 lore raw

PATCH 7/32 pwm: mediatek: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-mediatek.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-mediatek.c +1 -3
index b94e0d09c300..e4a715d3860c 100644
@@ -207,7 +207,6 @@ static const struct pwm_ops pwm_mediatek_ops = {
 static int pwm_mediatek_probe(struct platform_device *pdev)
 {
 	struct pwm_mediatek_chip *pc;
-	struct resource *res;
 	unsigned int i;
 	int ret;
 
@@ -217,8 +216,7 @@ static int pwm_mediatek_probe(struct platform_device *pdev)
 
 	pc->soc = of_device_get_match_data(&pdev->dev);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pc->regs = devm_ioremap_resource(&pdev->dev, res);
+	pc->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->regs))
 		return PTR_ERR(pc->regs);
 
Signature · 1 line
2.17.1
author
#48 lore raw

PATCH 7/32 pwm: mediatek: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-mediatek.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-mediatek.c +1 -3
index b94e0d09c300..e4a715d3860c 100644
@@ -207,7 +207,6 @@ static const struct pwm_ops pwm_mediatek_ops = {
 static int pwm_mediatek_probe(struct platform_device *pdev)
 {
 	struct pwm_mediatek_chip *pc;
-	struct resource *res;
 	unsigned int i;
 	int ret;
 
@@ -217,8 +216,7 @@ static int pwm_mediatek_probe(struct platform_device *pdev)
 
 	pc->soc = of_device_get_match_data(&pdev->dev);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pc->regs = devm_ioremap_resource(&pdev->dev, res);
+	pc->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->regs))
 		return PTR_ERR(pc->regs);
 
Signature · 1 line
2.17.1
author
#50 lore raw

PATCH 7/32 pwm: mediatek: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-mediatek.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-mediatek.c +1 -3
index b94e0d09c300..e4a715d3860c 100644
@@ -207,7 +207,6 @@ static const struct pwm_ops pwm_mediatek_ops = {
 static int pwm_mediatek_probe(struct platform_device *pdev)
 {
 	struct pwm_mediatek_chip *pc;
-	struct resource *res;
 	unsigned int i;
 	int ret;
 
@@ -217,8 +216,7 @@ static int pwm_mediatek_probe(struct platform_device *pdev)
 
 	pc->soc = of_device_get_match_data(&pdev->dev);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pc->regs = devm_ioremap_resource(&pdev->dev, res);
+	pc->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->regs))
 		return PTR_ERR(pc->regs);
 
Signature · 1 line
2.17.1
#10 lore raw

PATCH 8/32 pwm: sti: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-sti.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/pwm/pwm-sti.c +1 -4
index 1508616d794c..eaeb38c0c0c7 100644
@@ -540,7 +540,6 @@ static int sti_pwm_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct sti_pwm_compat_data *cdata;
 	struct sti_pwm_chip *pc;
-	struct resource *res;
 	unsigned int i;
 	int irq, ret;
 
@@ -552,9 +551,7 @@ static int sti_pwm_probe(struct platform_device *pdev)
 	if (!cdata)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
-	pc->mmio = devm_ioremap_resource(dev, res);
+	pc->mmio = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->mmio))
 		return PTR_ERR(pc->mmio);
 
Signature · 1 line
2.17.1
author
#51 lore raw

PATCH 8/32 pwm: sti: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-sti.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/pwm/pwm-sti.c +1 -4
index 1508616d794c..eaeb38c0c0c7 100644
@@ -540,7 +540,6 @@ static int sti_pwm_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct sti_pwm_compat_data *cdata;
 	struct sti_pwm_chip *pc;
-	struct resource *res;
 	unsigned int i;
 	int irq, ret;
 
@@ -552,9 +551,7 @@ static int sti_pwm_probe(struct platform_device *pdev)
 	if (!cdata)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
-	pc->mmio = devm_ioremap_resource(dev, res);
+	pc->mmio = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->mmio))
 		return PTR_ERR(pc->mmio);
 
Signature · 1 line
2.17.1
author
#53 lore raw

PATCH 8/32 pwm: sti: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-sti.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/pwm/pwm-sti.c +1 -4
index 1508616d794c..eaeb38c0c0c7 100644
@@ -540,7 +540,6 @@ static int sti_pwm_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct sti_pwm_compat_data *cdata;
 	struct sti_pwm_chip *pc;
-	struct resource *res;
 	unsigned int i;
 	int irq, ret;
 
@@ -552,9 +551,7 @@ static int sti_pwm_probe(struct platform_device *pdev)
 	if (!cdata)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
-	pc->mmio = devm_ioremap_resource(dev, res);
+	pc->mmio = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->mmio))
 		return PTR_ERR(pc->mmio);
 
Signature · 1 line
2.17.1
#11 lore raw

PATCH 9/32 pwm: pxa: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-pxa.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-pxa.c +1 -3
index a2a0912c2dcd..d06cf60e6575 100644
@@ -166,7 +166,6 @@ static int pwm_probe(struct platform_device *pdev)
 {
 	const struct platform_device_id *id = platform_get_device_id(pdev);
 	struct pxa_pwm_chip *pwm;
-	struct resource *r;
 	int ret = 0;
 
 	if (IS_ENABLED(CONFIG_OF) && id == NULL)
@@ -193,8 +192,7 @@ static int pwm_probe(struct platform_device *pdev)
 		pwm->chip.of_pwm_n_cells = 1;
 	}
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pwm->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	pwm->mmio_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pwm->mmio_base))
 		return PTR_ERR(pwm->mmio_base);
 
Signature · 1 line
2.17.1
author
#54 lore raw

PATCH 9/32 pwm: pxa: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-pxa.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-pxa.c +1 -3
index a2a0912c2dcd..d06cf60e6575 100644
@@ -166,7 +166,6 @@ static int pwm_probe(struct platform_device *pdev)
 {
 	const struct platform_device_id *id = platform_get_device_id(pdev);
 	struct pxa_pwm_chip *pwm;
-	struct resource *r;
 	int ret = 0;
 
 	if (IS_ENABLED(CONFIG_OF) && id == NULL)
@@ -193,8 +192,7 @@ static int pwm_probe(struct platform_device *pdev)
 		pwm->chip.of_pwm_n_cells = 1;
 	}
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pwm->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	pwm->mmio_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pwm->mmio_base))
 		return PTR_ERR(pwm->mmio_base);
 
Signature · 1 line
2.17.1
author
#56 lore raw

PATCH 9/32 pwm: pxa: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-pxa.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-pxa.c +1 -3
index a2a0912c2dcd..d06cf60e6575 100644
@@ -166,7 +166,6 @@ static int pwm_probe(struct platform_device *pdev)
 {
 	const struct platform_device_id *id = platform_get_device_id(pdev);
 	struct pxa_pwm_chip *pwm;
-	struct resource *r;
 	int ret = 0;
 
 	if (IS_ENABLED(CONFIG_OF) && id == NULL)
@@ -193,8 +192,7 @@ static int pwm_probe(struct platform_device *pdev)
 		pwm->chip.of_pwm_n_cells = 1;
 	}
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pwm->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	pwm->mmio_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pwm->mmio_base))
 		return PTR_ERR(pwm->mmio_base);
 
Signature · 1 line
2.17.1
#12 lore raw

PATCH 10/32 pwm: zx: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-zx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-zx.c +1 -3
index e2c21cc34a96..0f5e8919b034 100644
@@ -196,7 +196,6 @@ static const struct pwm_ops zx_pwm_ops = {
 static int zx_pwm_probe(struct platform_device *pdev)
 {
 	struct zx_pwm_chip *zpc;
-	struct resource *res;
 	unsigned int i;
 	int ret;
 
@@ -204,8 +203,7 @@ static int zx_pwm_probe(struct platform_device *pdev)
 	if (!zpc)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	zpc->base = devm_ioremap_resource(&pdev->dev, res);
+	zpc->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(zpc->base))
 		return PTR_ERR(zpc->base);
 
Signature · 1 line
2.17.1
author
#57 lore raw

PATCH 10/32 pwm: zx: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-zx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-zx.c +1 -3
index e2c21cc34a96..0f5e8919b034 100644
@@ -196,7 +196,6 @@ static const struct pwm_ops zx_pwm_ops = {
 static int zx_pwm_probe(struct platform_device *pdev)
 {
 	struct zx_pwm_chip *zpc;
-	struct resource *res;
 	unsigned int i;
 	int ret;
 
@@ -204,8 +203,7 @@ static int zx_pwm_probe(struct platform_device *pdev)
 	if (!zpc)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	zpc->base = devm_ioremap_resource(&pdev->dev, res);
+	zpc->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(zpc->base))
 		return PTR_ERR(zpc->base);
 
Signature · 1 line
2.17.1
author
#59 lore raw

PATCH 10/32 pwm: zx: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-zx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-zx.c +1 -3
index e2c21cc34a96..0f5e8919b034 100644
@@ -196,7 +196,6 @@ static const struct pwm_ops zx_pwm_ops = {
 static int zx_pwm_probe(struct platform_device *pdev)
 {
 	struct zx_pwm_chip *zpc;
-	struct resource *res;
 	unsigned int i;
 	int ret;
 
@@ -204,8 +203,7 @@ static int zx_pwm_probe(struct platform_device *pdev)
 	if (!zpc)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	zpc->base = devm_ioremap_resource(&pdev->dev, res);
+	zpc->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(zpc->base))
 		return PTR_ERR(zpc->base);
 
Signature · 1 line
2.17.1
#13 lore raw

PATCH 11/32 pwm: spear: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-spear.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-spear.c +1 -3
index 6c6b44fd3f43..f63b54aae1b4 100644
@@ -174,7 +174,6 @@ static int spear_pwm_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct spear_pwm_chip *pc;
-	struct resource *r;
 	int ret;
 	u32 val;
 
@@ -182,8 +181,7 @@ static int spear_pwm_probe(struct platform_device *pdev)
 	if (!pc)
 		return -ENOMEM;
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pc->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	pc->mmio_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->mmio_base))
 		return PTR_ERR(pc->mmio_base);
 
Signature · 1 line
2.17.1
author
#60 lore raw

PATCH 11/32 pwm: spear: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-spear.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-spear.c +1 -3
index 6c6b44fd3f43..f63b54aae1b4 100644
@@ -174,7 +174,6 @@ static int spear_pwm_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct spear_pwm_chip *pc;
-	struct resource *r;
 	int ret;
 	u32 val;
 
@@ -182,8 +181,7 @@ static int spear_pwm_probe(struct platform_device *pdev)
 	if (!pc)
 		return -ENOMEM;
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pc->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	pc->mmio_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->mmio_base))
 		return PTR_ERR(pc->mmio_base);
 
Signature · 1 line
2.17.1
author
#62 lore raw

PATCH 11/32 pwm: spear: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-spear.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-spear.c +1 -3
index 6c6b44fd3f43..f63b54aae1b4 100644
@@ -174,7 +174,6 @@ static int spear_pwm_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct spear_pwm_chip *pc;
-	struct resource *r;
 	int ret;
 	u32 val;
 
@@ -182,8 +181,7 @@ static int spear_pwm_probe(struct platform_device *pdev)
 	if (!pc)
 		return -ENOMEM;
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pc->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	pc->mmio_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->mmio_base))
 		return PTR_ERR(pc->mmio_base);
 
Signature · 1 line
2.17.1
#14 lore raw

PATCH 12/32 pwm: bcm-kona: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-bcm-kona.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-bcm-kona.c +1 -3
index 81da91df2529..aa451987733b 100644
@@ -259,7 +259,6 @@ static const struct pwm_ops kona_pwm_ops = {
 static int kona_pwmc_probe(struct platform_device *pdev)
 {
 	struct kona_pwmc *kp;
-	struct resource *res;
 	unsigned int chan;
 	unsigned int value = 0;
 	int ret = 0;
@@ -277,8 +276,7 @@ static int kona_pwmc_probe(struct platform_device *pdev)
 	kp->chip.of_xlate = of_pwm_xlate_with_flags;
 	kp->chip.of_pwm_n_cells = 3;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	kp->base = devm_ioremap_resource(&pdev->dev, res);
+	kp->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(kp->base))
 		return PTR_ERR(kp->base);
 
Signature · 1 line
2.17.1
author
#63 lore raw

PATCH 12/32 pwm: bcm-kona: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-bcm-kona.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-bcm-kona.c +1 -3
index 81da91df2529..aa451987733b 100644
@@ -259,7 +259,6 @@ static const struct pwm_ops kona_pwm_ops = {
 static int kona_pwmc_probe(struct platform_device *pdev)
 {
 	struct kona_pwmc *kp;
-	struct resource *res;
 	unsigned int chan;
 	unsigned int value = 0;
 	int ret = 0;
@@ -277,8 +276,7 @@ static int kona_pwmc_probe(struct platform_device *pdev)
 	kp->chip.of_xlate = of_pwm_xlate_with_flags;
 	kp->chip.of_pwm_n_cells = 3;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	kp->base = devm_ioremap_resource(&pdev->dev, res);
+	kp->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(kp->base))
 		return PTR_ERR(kp->base);
 
Signature · 1 line
2.17.1
author
#65 lore raw

PATCH 12/32 pwm: bcm-kona: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-bcm-kona.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-bcm-kona.c +1 -3
index 81da91df2529..aa451987733b 100644
@@ -259,7 +259,6 @@ static const struct pwm_ops kona_pwm_ops = {
 static int kona_pwmc_probe(struct platform_device *pdev)
 {
 	struct kona_pwmc *kp;
-	struct resource *res;
 	unsigned int chan;
 	unsigned int value = 0;
 	int ret = 0;
@@ -277,8 +276,7 @@ static int kona_pwmc_probe(struct platform_device *pdev)
 	kp->chip.of_xlate = of_pwm_xlate_with_flags;
 	kp->chip.of_pwm_n_cells = 3;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	kp->base = devm_ioremap_resource(&pdev->dev, res);
+	kp->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(kp->base))
 		return PTR_ERR(kp->base);
 
Signature · 1 line
2.17.1
#15 lore raw

PATCH 13/32 pwm: lpc32xx: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-lpc32xx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-lpc32xx.c +1 -3
index 710d9a207d2b..6b4090436c06 100644
@@ -98,7 +98,6 @@ static const struct pwm_ops lpc32xx_pwm_ops = {
 static int lpc32xx_pwm_probe(struct platform_device *pdev)
 {
 	struct lpc32xx_pwm_chip *lpc32xx;
-	struct resource *res;
 	int ret;
 	u32 val;
 
@@ -106,8 +105,7 @@ static int lpc32xx_pwm_probe(struct platform_device *pdev)
 	if (!lpc32xx)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	lpc32xx->base = devm_ioremap_resource(&pdev->dev, res);
+	lpc32xx->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(lpc32xx->base))
 		return PTR_ERR(lpc32xx->base);
 
Signature · 1 line
2.17.1
author
#66 lore raw

PATCH 13/32 pwm: lpc32xx: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-lpc32xx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-lpc32xx.c +1 -3
index 710d9a207d2b..6b4090436c06 100644
@@ -98,7 +98,6 @@ static const struct pwm_ops lpc32xx_pwm_ops = {
 static int lpc32xx_pwm_probe(struct platform_device *pdev)
 {
 	struct lpc32xx_pwm_chip *lpc32xx;
-	struct resource *res;
 	int ret;
 	u32 val;
 
@@ -106,8 +105,7 @@ static int lpc32xx_pwm_probe(struct platform_device *pdev)
 	if (!lpc32xx)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	lpc32xx->base = devm_ioremap_resource(&pdev->dev, res);
+	lpc32xx->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(lpc32xx->base))
 		return PTR_ERR(lpc32xx->base);
 
Signature · 1 line
2.17.1
author
#69 lore raw

PATCH 13/32 pwm: lpc32xx: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-lpc32xx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-lpc32xx.c +1 -3
index 710d9a207d2b..6b4090436c06 100644
@@ -98,7 +98,6 @@ static const struct pwm_ops lpc32xx_pwm_ops = {
 static int lpc32xx_pwm_probe(struct platform_device *pdev)
 {
 	struct lpc32xx_pwm_chip *lpc32xx;
-	struct resource *res;
 	int ret;
 	u32 val;
 
@@ -106,8 +105,7 @@ static int lpc32xx_pwm_probe(struct platform_device *pdev)
 	if (!lpc32xx)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	lpc32xx->base = devm_ioremap_resource(&pdev->dev, res);
+	lpc32xx->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(lpc32xx->base))
 		return PTR_ERR(lpc32xx->base);
 
Signature · 1 line
2.17.1
#16 lore raw

PATCH 14/32 pwm: meson: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-meson.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-meson.c +1 -3
index 6245bbdb6e6c..62fc79092038 100644
@@ -537,15 +537,13 @@ static int meson_pwm_init_channels(struct meson_pwm *meson)
 static int meson_pwm_probe(struct platform_device *pdev)
 {
 	struct meson_pwm *meson;
-	struct resource *regs;
 	int err;
 
 	meson = devm_kzalloc(&pdev->dev, sizeof(*meson), GFP_KERNEL);
 	if (!meson)
 		return -ENOMEM;
 
-	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	meson->base = devm_ioremap_resource(&pdev->dev, regs);
+	meson->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(meson->base))
 		return PTR_ERR(meson->base);
 
Signature · 1 line
2.17.1
author
#70 lore raw

PATCH 14/32 pwm: meson: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-meson.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-meson.c +1 -3
index 6245bbdb6e6c..62fc79092038 100644
@@ -537,15 +537,13 @@ static int meson_pwm_init_channels(struct meson_pwm *meson)
 static int meson_pwm_probe(struct platform_device *pdev)
 {
 	struct meson_pwm *meson;
-	struct resource *regs;
 	int err;
 
 	meson = devm_kzalloc(&pdev->dev, sizeof(*meson), GFP_KERNEL);
 	if (!meson)
 		return -ENOMEM;
 
-	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	meson->base = devm_ioremap_resource(&pdev->dev, regs);
+	meson->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(meson->base))
 		return PTR_ERR(meson->base);
 
Signature · 1 line
2.17.1
author
#73 lore raw

PATCH 14/32 pwm: meson: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-meson.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-meson.c +1 -3
index 6245bbdb6e6c..62fc79092038 100644
@@ -537,15 +537,13 @@ static int meson_pwm_init_channels(struct meson_pwm *meson)
 static int meson_pwm_probe(struct platform_device *pdev)
 {
 	struct meson_pwm *meson;
-	struct resource *regs;
 	int err;
 
 	meson = devm_kzalloc(&pdev->dev, sizeof(*meson), GFP_KERNEL);
 	if (!meson)
 		return -ENOMEM;
 
-	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	meson->base = devm_ioremap_resource(&pdev->dev, regs);
+	meson->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(meson->base))
 		return PTR_ERR(meson->base);
 
Signature · 1 line
2.17.1
#17 lore raw

PATCH 15/32 pwm: rockchip: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-rockchip.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-rockchip.c +1 -3
index 73352e6fbccb..f0549b82338d 100644
@@ -292,7 +292,6 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
 {
 	const struct of_device_id *id;
 	struct rockchip_pwm_chip *pc;
-	struct resource *r;
 	int ret, count;
 
 	id = of_match_device(rockchip_pwm_dt_ids, &pdev->dev);
@@ -303,8 +302,7 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
 	if (!pc)
 		return -ENOMEM;
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pc->base = devm_ioremap_resource(&pdev->dev, r);
+	pc->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->base))
 		return PTR_ERR(pc->base);
 
Signature · 1 line
2.17.1
author
#74 lore raw

PATCH 15/32 pwm: rockchip: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-rockchip.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-rockchip.c +1 -3
index 73352e6fbccb..f0549b82338d 100644
@@ -292,7 +292,6 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
 {
 	const struct of_device_id *id;
 	struct rockchip_pwm_chip *pc;
-	struct resource *r;
 	int ret, count;
 
 	id = of_match_device(rockchip_pwm_dt_ids, &pdev->dev);
@@ -303,8 +302,7 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
 	if (!pc)
 		return -ENOMEM;
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pc->base = devm_ioremap_resource(&pdev->dev, r);
+	pc->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->base))
 		return PTR_ERR(pc->base);
 
Signature · 1 line
2.17.1
author
#77 lore raw

PATCH 15/32 pwm: rockchip: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-rockchip.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-rockchip.c +1 -3
index 73352e6fbccb..f0549b82338d 100644
@@ -292,7 +292,6 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
 {
 	const struct of_device_id *id;
 	struct rockchip_pwm_chip *pc;
-	struct resource *r;
 	int ret, count;
 
 	id = of_match_device(rockchip_pwm_dt_ids, &pdev->dev);
@@ -303,8 +302,7 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
 	if (!pc)
 		return -ENOMEM;
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pc->base = devm_ioremap_resource(&pdev->dev, r);
+	pc->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->base))
 		return PTR_ERR(pc->base);
 
Signature · 1 line
2.17.1
#18 lore raw

PATCH 16/32 pwm: bcm-iproc: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-bcm-iproc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-bcm-iproc.c +1 -3
index 1f829edd8ee7..52860df7d9b7 100644
@@ -193,7 +193,6 @@ static const struct pwm_ops iproc_pwm_ops = {
 static int iproc_pwmc_probe(struct platform_device *pdev)
 {
 	struct iproc_pwmc *ip;
-	struct resource *res;
 	unsigned int i;
 	u32 value;
 	int ret;
@@ -211,8 +210,7 @@ static int iproc_pwmc_probe(struct platform_device *pdev)
 	ip->chip.of_xlate = of_pwm_xlate_with_flags;
 	ip->chip.of_pwm_n_cells = 3;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	ip->base = devm_ioremap_resource(&pdev->dev, res);
+	ip->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(ip->base))
 		return PTR_ERR(ip->base);
 
Signature · 1 line
2.17.1
author
#78 lore raw

PATCH 16/32 pwm: bcm-iproc: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-bcm-iproc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-bcm-iproc.c +1 -3
index 1f829edd8ee7..52860df7d9b7 100644
@@ -193,7 +193,6 @@ static const struct pwm_ops iproc_pwm_ops = {
 static int iproc_pwmc_probe(struct platform_device *pdev)
 {
 	struct iproc_pwmc *ip;
-	struct resource *res;
 	unsigned int i;
 	u32 value;
 	int ret;
@@ -211,8 +210,7 @@ static int iproc_pwmc_probe(struct platform_device *pdev)
 	ip->chip.of_xlate = of_pwm_xlate_with_flags;
 	ip->chip.of_pwm_n_cells = 3;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	ip->base = devm_ioremap_resource(&pdev->dev, res);
+	ip->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(ip->base))
 		return PTR_ERR(ip->base);
 
Signature · 1 line
2.17.1
author
#80 lore raw

PATCH 16/32 pwm: bcm-iproc: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-bcm-iproc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-bcm-iproc.c +1 -3
index 1f829edd8ee7..52860df7d9b7 100644
@@ -193,7 +193,6 @@ static const struct pwm_ops iproc_pwm_ops = {
 static int iproc_pwmc_probe(struct platform_device *pdev)
 {
 	struct iproc_pwmc *ip;
-	struct resource *res;
 	unsigned int i;
 	u32 value;
 	int ret;
@@ -211,8 +210,7 @@ static int iproc_pwmc_probe(struct platform_device *pdev)
 	ip->chip.of_xlate = of_pwm_xlate_with_flags;
 	ip->chip.of_pwm_n_cells = 3;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	ip->base = devm_ioremap_resource(&pdev->dev, res);
+	ip->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(ip->base))
 		return PTR_ERR(ip->base);
 
Signature · 1 line
2.17.1
#19 lore raw

PATCH 17/32 pwm: samsung: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-samsung.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-samsung.c +1 -3
index 87a886f7dc2f..645d0066ff0a 100644
@@ -510,7 +510,6 @@ static int pwm_samsung_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct samsung_pwm_chip *chip;
-	struct resource *res;
 	unsigned int chan;
 	int ret;
 
@@ -541,8 +540,7 @@ static int pwm_samsung_probe(struct platform_device *pdev)
 							sizeof(chip->variant));
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	chip->base = devm_ioremap_resource(&pdev->dev, res);
+	chip->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(chip->base))
 		return PTR_ERR(chip->base);
 
Signature · 1 line
2.17.1
author
#81 lore raw

PATCH 17/32 pwm: samsung: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-samsung.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-samsung.c +1 -3
index 87a886f7dc2f..645d0066ff0a 100644
@@ -510,7 +510,6 @@ static int pwm_samsung_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct samsung_pwm_chip *chip;
-	struct resource *res;
 	unsigned int chan;
 	int ret;
 
@@ -541,8 +540,7 @@ static int pwm_samsung_probe(struct platform_device *pdev)
 							sizeof(chip->variant));
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	chip->base = devm_ioremap_resource(&pdev->dev, res);
+	chip->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(chip->base))
 		return PTR_ERR(chip->base);
 
Signature · 1 line
2.17.1
author
#83 lore raw

PATCH 17/32 pwm: samsung: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-samsung.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-samsung.c +1 -3
index 87a886f7dc2f..645d0066ff0a 100644
@@ -510,7 +510,6 @@ static int pwm_samsung_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct samsung_pwm_chip *chip;
-	struct resource *res;
 	unsigned int chan;
 	int ret;
 
@@ -541,8 +540,7 @@ static int pwm_samsung_probe(struct platform_device *pdev)
 							sizeof(chip->variant));
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	chip->base = devm_ioremap_resource(&pdev->dev, res);
+	chip->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(chip->base))
 		return PTR_ERR(chip->base);
 
Signature · 1 line
2.17.1
#20 lore raw

PATCH 18/32 pwm: tiehrpwm: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-tiehrpwm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-tiehrpwm.c +1 -3
index 7b4c770ce9d6..3a1313caa5fe 100644
@@ -421,7 +421,6 @@ static int ehrpwm_pwm_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct ehrpwm_pwm_chip *pc;
-	struct resource *r;
 	struct clk *clk;
 	int ret;
 
@@ -455,8 +454,7 @@ static int ehrpwm_pwm_probe(struct platform_device *pdev)
 	pc->chip.base = -1;
 	pc->chip.npwm = NUM_PWM_CHANNEL;
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pc->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	pc->mmio_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->mmio_base))
 		return PTR_ERR(pc->mmio_base);
 
Signature · 1 line
2.17.1
author
#84 lore raw

PATCH 18/32 pwm: tiehrpwm: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-tiehrpwm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-tiehrpwm.c +1 -3
index 7b4c770ce9d6..3a1313caa5fe 100644
@@ -421,7 +421,6 @@ static int ehrpwm_pwm_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct ehrpwm_pwm_chip *pc;
-	struct resource *r;
 	struct clk *clk;
 	int ret;
 
@@ -455,8 +454,7 @@ static int ehrpwm_pwm_probe(struct platform_device *pdev)
 	pc->chip.base = -1;
 	pc->chip.npwm = NUM_PWM_CHANNEL;
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pc->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	pc->mmio_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->mmio_base))
 		return PTR_ERR(pc->mmio_base);
 
Signature · 1 line
2.17.1
author
#86 lore raw

PATCH 18/32 pwm: tiehrpwm: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-tiehrpwm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-tiehrpwm.c +1 -3
index 7b4c770ce9d6..3a1313caa5fe 100644
@@ -421,7 +421,6 @@ static int ehrpwm_pwm_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct ehrpwm_pwm_chip *pc;
-	struct resource *r;
 	struct clk *clk;
 	int ret;
 
@@ -455,8 +454,7 @@ static int ehrpwm_pwm_probe(struct platform_device *pdev)
 	pc->chip.base = -1;
 	pc->chip.npwm = NUM_PWM_CHANNEL;
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pc->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	pc->mmio_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->mmio_base))
 		return PTR_ERR(pc->mmio_base);
 
Signature · 1 line
2.17.1
#21 lore raw

PATCH 19/32 pwm: puv3: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-puv3.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-puv3.c +1 -3
index 9d0bd87a425e..2367dad7cf95 100644
@@ -100,7 +100,6 @@ static const struct pwm_ops puv3_pwm_ops = {
 static int pwm_probe(struct platform_device *pdev)
 {
 	struct puv3_pwm_chip *puv3;
-	struct resource *r;
 	int ret;
 
 	puv3 = devm_kzalloc(&pdev->dev, sizeof(*puv3), GFP_KERNEL);
@@ -111,8 +110,7 @@ static int pwm_probe(struct platform_device *pdev)
 	if (IS_ERR(puv3->clk))
 		return PTR_ERR(puv3->clk);
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	puv3->base = devm_ioremap_resource(&pdev->dev, r);
+	puv3->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(puv3->base))
 		return PTR_ERR(puv3->base);
 
Signature · 1 line
2.17.1
author
#87 lore raw

PATCH 19/32 pwm: puv3: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-puv3.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-puv3.c +1 -3
index 9d0bd87a425e..2367dad7cf95 100644
@@ -100,7 +100,6 @@ static const struct pwm_ops puv3_pwm_ops = {
 static int pwm_probe(struct platform_device *pdev)
 {
 	struct puv3_pwm_chip *puv3;
-	struct resource *r;
 	int ret;
 
 	puv3 = devm_kzalloc(&pdev->dev, sizeof(*puv3), GFP_KERNEL);
@@ -111,8 +110,7 @@ static int pwm_probe(struct platform_device *pdev)
 	if (IS_ERR(puv3->clk))
 		return PTR_ERR(puv3->clk);
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	puv3->base = devm_ioremap_resource(&pdev->dev, r);
+	puv3->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(puv3->base))
 		return PTR_ERR(puv3->base);
 
Signature · 1 line
2.17.1
author
#89 lore raw

PATCH 19/32 pwm: puv3: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-puv3.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-puv3.c +1 -3
index 9d0bd87a425e..2367dad7cf95 100644
@@ -100,7 +100,6 @@ static const struct pwm_ops puv3_pwm_ops = {
 static int pwm_probe(struct platform_device *pdev)
 {
 	struct puv3_pwm_chip *puv3;
-	struct resource *r;
 	int ret;
 
 	puv3 = devm_kzalloc(&pdev->dev, sizeof(*puv3), GFP_KERNEL);
@@ -111,8 +110,7 @@ static int pwm_probe(struct platform_device *pdev)
 	if (IS_ERR(puv3->clk))
 		return PTR_ERR(puv3->clk);
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	puv3->base = devm_ioremap_resource(&pdev->dev, r);
+	puv3->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(puv3->base))
 		return PTR_ERR(puv3->base);
 
Signature · 1 line
2.17.1
#22 lore raw

PATCH 20/32 pwm: imx: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-imx1.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-imx1.c +1 -3
index f8b2c2e001a7..1a60bfd7d659 100644
@@ -136,7 +136,6 @@ MODULE_DEVICE_TABLE(of, pwm_imx1_dt_ids);
 static int pwm_imx1_probe(struct platform_device *pdev)
 {
 	struct pwm_imx1_chip *imx;
-	struct resource *r;
 
 	imx = devm_kzalloc(&pdev->dev, sizeof(*imx), GFP_KERNEL);
 	if (!imx)
@@ -168,8 +167,7 @@ static int pwm_imx1_probe(struct platform_device *pdev)
 	imx->chip.base = -1;
 	imx->chip.npwm = 1;
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	imx->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	imx->mmio_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(imx->mmio_base))
 		return PTR_ERR(imx->mmio_base);
 
Signature · 1 line
2.17.1
author
#90 lore raw

PATCH 20/32 pwm: imx: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-imx1.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-imx1.c +1 -3
index f8b2c2e001a7..1a60bfd7d659 100644
@@ -136,7 +136,6 @@ MODULE_DEVICE_TABLE(of, pwm_imx1_dt_ids);
 static int pwm_imx1_probe(struct platform_device *pdev)
 {
 	struct pwm_imx1_chip *imx;
-	struct resource *r;
 
 	imx = devm_kzalloc(&pdev->dev, sizeof(*imx), GFP_KERNEL);
 	if (!imx)
@@ -168,8 +167,7 @@ static int pwm_imx1_probe(struct platform_device *pdev)
 	imx->chip.base = -1;
 	imx->chip.npwm = 1;
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	imx->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	imx->mmio_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(imx->mmio_base))
 		return PTR_ERR(imx->mmio_base);
 
Signature · 1 line
2.17.1
author
#92 lore raw

PATCH 20/32 pwm: imx: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-imx1.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-imx1.c +1 -3
index f8b2c2e001a7..1a60bfd7d659 100644
@@ -136,7 +136,6 @@ MODULE_DEVICE_TABLE(of, pwm_imx1_dt_ids);
 static int pwm_imx1_probe(struct platform_device *pdev)
 {
 	struct pwm_imx1_chip *imx;
-	struct resource *r;
 
 	imx = devm_kzalloc(&pdev->dev, sizeof(*imx), GFP_KERNEL);
 	if (!imx)
@@ -168,8 +167,7 @@ static int pwm_imx1_probe(struct platform_device *pdev)
 	imx->chip.base = -1;
 	imx->chip.npwm = 1;
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	imx->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	imx->mmio_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(imx->mmio_base))
 		return PTR_ERR(imx->mmio_base);
 
Signature · 1 line
2.17.1
#23 lore raw

PATCH 21/32 pwm: tiecap: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-tiecap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-tiecap.c +1 -3
index ab38c8203b79..3a9885cce386 100644
@@ -196,7 +196,6 @@ static int ecap_pwm_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct ecap_pwm_chip *pc;
-	struct resource *r;
 	struct clk *clk;
 	int ret;
 
@@ -230,8 +229,7 @@ static int ecap_pwm_probe(struct platform_device *pdev)
 	pc->chip.base = -1;
 	pc->chip.npwm = 1;
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pc->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	pc->mmio_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->mmio_base))
 		return PTR_ERR(pc->mmio_base);
 
Signature · 1 line
2.17.1
author
#93 lore raw

PATCH 21/32 pwm: tiecap: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-tiecap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-tiecap.c +1 -3
index ab38c8203b79..3a9885cce386 100644
@@ -196,7 +196,6 @@ static int ecap_pwm_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct ecap_pwm_chip *pc;
-	struct resource *r;
 	struct clk *clk;
 	int ret;
 
@@ -230,8 +229,7 @@ static int ecap_pwm_probe(struct platform_device *pdev)
 	pc->chip.base = -1;
 	pc->chip.npwm = 1;
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pc->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	pc->mmio_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->mmio_base))
 		return PTR_ERR(pc->mmio_base);
 
Signature · 1 line
2.17.1
author
#95 lore raw

PATCH 21/32 pwm: tiecap: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-tiecap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-tiecap.c +1 -3
index ab38c8203b79..3a9885cce386 100644
@@ -196,7 +196,6 @@ static int ecap_pwm_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct ecap_pwm_chip *pc;
-	struct resource *r;
 	struct clk *clk;
 	int ret;
 
@@ -230,8 +229,7 @@ static int ecap_pwm_probe(struct platform_device *pdev)
 	pc->chip.base = -1;
 	pc->chip.npwm = 1;
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pc->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	pc->mmio_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->mmio_base))
 		return PTR_ERR(pc->mmio_base);
 
Signature · 1 line
2.17.1
#24 lore raw

PATCH 22/32 pwm: bcm2835: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-bcm2835.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-bcm2835.c +1 -3
index 91e24f01b54e..9923cd2f069e 100644
@@ -137,7 +137,6 @@ static const struct pwm_ops bcm2835_pwm_ops = {
 static int bcm2835_pwm_probe(struct platform_device *pdev)
 {
 	struct bcm2835_pwm *pc;
-	struct resource *res;
 	int ret;
 
 	pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL);
@@ -146,8 +145,7 @@ static int bcm2835_pwm_probe(struct platform_device *pdev)
 
 	pc->dev = &pdev->dev;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pc->base = devm_ioremap_resource(&pdev->dev, res);
+	pc->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->base))
 		return PTR_ERR(pc->base);
 
Signature · 1 line
2.17.1
author
#96 lore raw

PATCH 22/32 pwm: bcm2835: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-bcm2835.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-bcm2835.c +1 -3
index 91e24f01b54e..9923cd2f069e 100644
@@ -137,7 +137,6 @@ static const struct pwm_ops bcm2835_pwm_ops = {
 static int bcm2835_pwm_probe(struct platform_device *pdev)
 {
 	struct bcm2835_pwm *pc;
-	struct resource *res;
 	int ret;
 
 	pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL);
@@ -146,8 +145,7 @@ static int bcm2835_pwm_probe(struct platform_device *pdev)
 
 	pc->dev = &pdev->dev;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pc->base = devm_ioremap_resource(&pdev->dev, res);
+	pc->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->base))
 		return PTR_ERR(pc->base);
 
Signature · 1 line
2.17.1
author
#98 lore raw

PATCH 22/32 pwm: bcm2835: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-bcm2835.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-bcm2835.c +1 -3
index 91e24f01b54e..9923cd2f069e 100644
@@ -137,7 +137,6 @@ static const struct pwm_ops bcm2835_pwm_ops = {
 static int bcm2835_pwm_probe(struct platform_device *pdev)
 {
 	struct bcm2835_pwm *pc;
-	struct resource *res;
 	int ret;
 
 	pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL);
@@ -146,8 +145,7 @@ static int bcm2835_pwm_probe(struct platform_device *pdev)
 
 	pc->dev = &pdev->dev;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pc->base = devm_ioremap_resource(&pdev->dev, res);
+	pc->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->base))
 		return PTR_ERR(pc->base);
 
Signature · 1 line
2.17.1
#25 lore raw

PATCH 23/32 pwm: berlin: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-berlin.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-berlin.c +1 -3
index b91c477cc84b..fe405289e582 100644
@@ -186,15 +186,13 @@ MODULE_DEVICE_TABLE(of, berlin_pwm_match);
 static int berlin_pwm_probe(struct platform_device *pdev)
 {
 	struct berlin_pwm_chip *pwm;
-	struct resource *res;
 	int ret;
 
 	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
 	if (!pwm)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pwm->base = devm_ioremap_resource(&pdev->dev, res);
+	pwm->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pwm->base))
 		return PTR_ERR(pwm->base);
 
Signature · 1 line
2.17.1
author
#99 lore raw

PATCH 23/32 pwm: berlin: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-berlin.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-berlin.c +1 -3
index b91c477cc84b..fe405289e582 100644
@@ -186,15 +186,13 @@ MODULE_DEVICE_TABLE(of, berlin_pwm_match);
 static int berlin_pwm_probe(struct platform_device *pdev)
 {
 	struct berlin_pwm_chip *pwm;
-	struct resource *res;
 	int ret;
 
 	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
 	if (!pwm)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pwm->base = devm_ioremap_resource(&pdev->dev, res);
+	pwm->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pwm->base))
 		return PTR_ERR(pwm->base);
 
Signature · 1 line
2.17.1
author
#101 lore raw

PATCH 23/32 pwm: berlin: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-berlin.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-berlin.c +1 -3
index b91c477cc84b..fe405289e582 100644
@@ -186,15 +186,13 @@ MODULE_DEVICE_TABLE(of, berlin_pwm_match);
 static int berlin_pwm_probe(struct platform_device *pdev)
 {
 	struct berlin_pwm_chip *pwm;
-	struct resource *res;
 	int ret;
 
 	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
 	if (!pwm)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pwm->base = devm_ioremap_resource(&pdev->dev, res);
+	pwm->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pwm->base))
 		return PTR_ERR(pwm->base);
 
Signature · 1 line
2.17.1
#26 lore raw

PATCH 24/32 pwm: vt8500: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-vt8500.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-vt8500.c +1 -3
index 11d45e56a923..6e36851a22bb 100644
@@ -193,7 +193,6 @@ MODULE_DEVICE_TABLE(of, vt8500_pwm_dt_ids);
 static int vt8500_pwm_probe(struct platform_device *pdev)
 {
 	struct vt8500_chip *chip;
-	struct resource *r;
 	struct device_node *np = pdev->dev.of_node;
 	int ret;
 
@@ -219,8 +218,7 @@ static int vt8500_pwm_probe(struct platform_device *pdev)
 		return PTR_ERR(chip->clk);
 	}
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	chip->base = devm_ioremap_resource(&pdev->dev, r);
+	chip->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(chip->base))
 		return PTR_ERR(chip->base);
 
Signature · 1 line
2.17.1
author
#102 lore raw

PATCH 24/32 pwm: vt8500: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-vt8500.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-vt8500.c +1 -3
index 11d45e56a923..6e36851a22bb 100644
@@ -193,7 +193,6 @@ MODULE_DEVICE_TABLE(of, vt8500_pwm_dt_ids);
 static int vt8500_pwm_probe(struct platform_device *pdev)
 {
 	struct vt8500_chip *chip;
-	struct resource *r;
 	struct device_node *np = pdev->dev.of_node;
 	int ret;
 
@@ -219,8 +218,7 @@ static int vt8500_pwm_probe(struct platform_device *pdev)
 		return PTR_ERR(chip->clk);
 	}
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	chip->base = devm_ioremap_resource(&pdev->dev, r);
+	chip->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(chip->base))
 		return PTR_ERR(chip->base);
 
Signature · 1 line
2.17.1
author
#104 lore raw

PATCH 24/32 pwm: vt8500: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-vt8500.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-vt8500.c +1 -3
index 11d45e56a923..6e36851a22bb 100644
@@ -193,7 +193,6 @@ MODULE_DEVICE_TABLE(of, vt8500_pwm_dt_ids);
 static int vt8500_pwm_probe(struct platform_device *pdev)
 {
 	struct vt8500_chip *chip;
-	struct resource *r;
 	struct device_node *np = pdev->dev.of_node;
 	int ret;
 
@@ -219,8 +218,7 @@ static int vt8500_pwm_probe(struct platform_device *pdev)
 		return PTR_ERR(chip->clk);
 	}
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	chip->base = devm_ioremap_resource(&pdev->dev, r);
+	chip->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(chip->base))
 		return PTR_ERR(chip->base);
 
Signature · 1 line
2.17.1
#27 lore raw

PATCH 25/32 pwm: brcmstb: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-brcmstb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-brcmstb.c +1 -3
index fea612c45f20..8b66f9d2f589 100644
@@ -234,7 +234,6 @@ MODULE_DEVICE_TABLE(of, brcmstb_pwm_of_match);
 static int brcmstb_pwm_probe(struct platform_device *pdev)
 {
 	struct brcmstb_pwm *p;
-	struct resource *res;
 	int ret;
 
 	p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
@@ -262,8 +261,7 @@ static int brcmstb_pwm_probe(struct platform_device *pdev)
 	p->chip.base = -1;
 	p->chip.npwm = 2;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	p->base = devm_ioremap_resource(&pdev->dev, res);
+	p->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(p->base)) {
 		ret = PTR_ERR(p->base);
 		goto out_clk;
Signature · 1 line
2.17.1
author
#105 lore raw

PATCH 25/32 pwm: brcmstb: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-brcmstb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-brcmstb.c +1 -3
index fea612c45f20..8b66f9d2f589 100644
@@ -234,7 +234,6 @@ MODULE_DEVICE_TABLE(of, brcmstb_pwm_of_match);
 static int brcmstb_pwm_probe(struct platform_device *pdev)
 {
 	struct brcmstb_pwm *p;
-	struct resource *res;
 	int ret;
 
 	p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
@@ -262,8 +261,7 @@ static int brcmstb_pwm_probe(struct platform_device *pdev)
 	p->chip.base = -1;
 	p->chip.npwm = 2;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	p->base = devm_ioremap_resource(&pdev->dev, res);
+	p->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(p->base)) {
 		ret = PTR_ERR(p->base);
 		goto out_clk;
Signature · 1 line
2.17.1
author
#111 lore raw

PATCH 25/32 pwm: brcmstb: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-brcmstb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-brcmstb.c +1 -3
index fea612c45f20..8b66f9d2f589 100644
@@ -234,7 +234,6 @@ MODULE_DEVICE_TABLE(of, brcmstb_pwm_of_match);
 static int brcmstb_pwm_probe(struct platform_device *pdev)
 {
 	struct brcmstb_pwm *p;
-	struct resource *res;
 	int ret;
 
 	p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
@@ -262,8 +261,7 @@ static int brcmstb_pwm_probe(struct platform_device *pdev)
 	p->chip.base = -1;
 	p->chip.npwm = 2;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	p->base = devm_ioremap_resource(&pdev->dev, res);
+	p->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(p->base)) {
 		ret = PTR_ERR(p->base);
 		goto out_clk;
Signature · 1 line
2.17.1
#28 lore raw

PATCH 26/32 pwm: mtk-disp: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-mtk-disp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-mtk-disp.c +1 -3
index 83b8be0209b7..87c6b4bc5d43 100644
@@ -172,7 +172,6 @@ static const struct pwm_ops mtk_disp_pwm_ops = {
 static int mtk_disp_pwm_probe(struct platform_device *pdev)
 {
 	struct mtk_disp_pwm *mdp;
-	struct resource *r;
 	int ret;
 
 	mdp = devm_kzalloc(&pdev->dev, sizeof(*mdp), GFP_KERNEL);
@@ -181,8 +180,7 @@ static int mtk_disp_pwm_probe(struct platform_device *pdev)
 
 	mdp->data = of_device_get_match_data(&pdev->dev);
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	mdp->base = devm_ioremap_resource(&pdev->dev, r);
+	mdp->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(mdp->base))
 		return PTR_ERR(mdp->base);
 
Signature · 1 line
2.17.1
author
#112 lore raw

PATCH 26/32 pwm: mtk-disp: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-mtk-disp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-mtk-disp.c +1 -3
index 83b8be0209b7..87c6b4bc5d43 100644
@@ -172,7 +172,6 @@ static const struct pwm_ops mtk_disp_pwm_ops = {
 static int mtk_disp_pwm_probe(struct platform_device *pdev)
 {
 	struct mtk_disp_pwm *mdp;
-	struct resource *r;
 	int ret;
 
 	mdp = devm_kzalloc(&pdev->dev, sizeof(*mdp), GFP_KERNEL);
@@ -181,8 +180,7 @@ static int mtk_disp_pwm_probe(struct platform_device *pdev)
 
 	mdp->data = of_device_get_match_data(&pdev->dev);
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	mdp->base = devm_ioremap_resource(&pdev->dev, r);
+	mdp->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(mdp->base))
 		return PTR_ERR(mdp->base);
 
Signature · 1 line
2.17.1
author
#117 lore raw

PATCH 26/32 pwm: mtk-disp: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-mtk-disp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-mtk-disp.c +1 -3
index 83b8be0209b7..87c6b4bc5d43 100644
@@ -172,7 +172,6 @@ static const struct pwm_ops mtk_disp_pwm_ops = {
 static int mtk_disp_pwm_probe(struct platform_device *pdev)
 {
 	struct mtk_disp_pwm *mdp;
-	struct resource *r;
 	int ret;
 
 	mdp = devm_kzalloc(&pdev->dev, sizeof(*mdp), GFP_KERNEL);
@@ -181,8 +180,7 @@ static int mtk_disp_pwm_probe(struct platform_device *pdev)
 
 	mdp->data = of_device_get_match_data(&pdev->dev);
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	mdp->base = devm_ioremap_resource(&pdev->dev, r);
+	mdp->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(mdp->base))
 		return PTR_ERR(mdp->base);
 
Signature · 1 line
2.17.1
#29 lore raw

PATCH 27/32 pwm: clps711x: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-clps711x.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-clps711x.c +1 -3
index 924d39a797cf..e69a5877cec6 100644
@@ -113,14 +113,12 @@ static struct pwm_device *clps711x_pwm_xlate(struct pwm_chip *chip,
 static int clps711x_pwm_probe(struct platform_device *pdev)
 {
 	struct clps711x_chip *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->pmpcon = devm_ioremap_resource(&pdev->dev, res);
+	priv->pmpcon = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(priv->pmpcon))
 		return PTR_ERR(priv->pmpcon);
 
Signature · 1 line
2.17.1
author
#118 lore raw

PATCH 27/32 pwm: clps711x: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-clps711x.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-clps711x.c +1 -3
index 924d39a797cf..e69a5877cec6 100644
@@ -113,14 +113,12 @@ static struct pwm_device *clps711x_pwm_xlate(struct pwm_chip *chip,
 static int clps711x_pwm_probe(struct platform_device *pdev)
 {
 	struct clps711x_chip *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->pmpcon = devm_ioremap_resource(&pdev->dev, res);
+	priv->pmpcon = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(priv->pmpcon))
 		return PTR_ERR(priv->pmpcon);
 
Signature · 1 line
2.17.1
author
#120 lore raw

PATCH 27/32 pwm: clps711x: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-clps711x.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-clps711x.c +1 -3
index 924d39a797cf..e69a5877cec6 100644
@@ -113,14 +113,12 @@ static struct pwm_device *clps711x_pwm_xlate(struct pwm_chip *chip,
 static int clps711x_pwm_probe(struct platform_device *pdev)
 {
 	struct clps711x_chip *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->pmpcon = devm_ioremap_resource(&pdev->dev, res);
+	priv->pmpcon = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(priv->pmpcon))
 		return PTR_ERR(priv->pmpcon);
 
Signature · 1 line
2.17.1
#30 lore raw

PATCH 28/32 pwm: img: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-img.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-img.c +1 -3
index c9e57bd109fb..e9b25440b808 100644
@@ -238,7 +238,6 @@ static int img_pwm_probe(struct platform_device *pdev)
 	int ret;
 	u64 val;
 	unsigned long clk_rate;
-	struct resource *res;
 	struct img_pwm_chip *pwm;
 	const struct of_device_id *of_dev_id;
 
@@ -248,8 +247,7 @@ static int img_pwm_probe(struct platform_device *pdev)
 
 	pwm->dev = &pdev->dev;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pwm->base = devm_ioremap_resource(&pdev->dev, res);
+	pwm->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pwm->base))
 		return PTR_ERR(pwm->base);
 
Signature · 1 line
2.17.1
author
#121 lore raw

PATCH 28/32 pwm: img: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-img.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-img.c +1 -3
index c9e57bd109fb..e9b25440b808 100644
@@ -238,7 +238,6 @@ static int img_pwm_probe(struct platform_device *pdev)
 	int ret;
 	u64 val;
 	unsigned long clk_rate;
-	struct resource *res;
 	struct img_pwm_chip *pwm;
 	const struct of_device_id *of_dev_id;
 
@@ -248,8 +247,7 @@ static int img_pwm_probe(struct platform_device *pdev)
 
 	pwm->dev = &pdev->dev;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pwm->base = devm_ioremap_resource(&pdev->dev, res);
+	pwm->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pwm->base))
 		return PTR_ERR(pwm->base);
 
Signature · 1 line
2.17.1
author
#123 lore raw

PATCH 28/32 pwm: img: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-img.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-img.c +1 -3
index c9e57bd109fb..e9b25440b808 100644
@@ -238,7 +238,6 @@ static int img_pwm_probe(struct platform_device *pdev)
 	int ret;
 	u64 val;
 	unsigned long clk_rate;
-	struct resource *res;
 	struct img_pwm_chip *pwm;
 	const struct of_device_id *of_dev_id;
 
@@ -248,8 +247,7 @@ static int img_pwm_probe(struct platform_device *pdev)
 
 	pwm->dev = &pdev->dev;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pwm->base = devm_ioremap_resource(&pdev->dev, res);
+	pwm->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pwm->base))
 		return PTR_ERR(pwm->base);
 
Signature · 1 line
2.17.1
#31 lore raw

PATCH 29/32 pwm: lpc18xx-sct: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-lpc18xx-sct.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-lpc18xx-sct.c +1 -3
index 5ff11145c1a3..dc5133bec3e7 100644
@@ -325,7 +325,6 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev)
 {
 	struct lpc18xx_pwm_chip *lpc18xx_pwm;
 	struct pwm_device *pwm;
-	struct resource *res;
 	int ret, i;
 	u64 val;
 
@@ -336,8 +335,7 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev)
 
 	lpc18xx_pwm->dev = &pdev->dev;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	lpc18xx_pwm->base = devm_ioremap_resource(&pdev->dev, res);
+	lpc18xx_pwm->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(lpc18xx_pwm->base))
 		return PTR_ERR(lpc18xx_pwm->base);
 
Signature · 1 line
2.17.1
author
#124 lore raw

PATCH 29/32 pwm: lpc18xx-sct: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-lpc18xx-sct.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-lpc18xx-sct.c +1 -3
index 5ff11145c1a3..dc5133bec3e7 100644
@@ -325,7 +325,6 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev)
 {
 	struct lpc18xx_pwm_chip *lpc18xx_pwm;
 	struct pwm_device *pwm;
-	struct resource *res;
 	int ret, i;
 	u64 val;
 
@@ -336,8 +335,7 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev)
 
 	lpc18xx_pwm->dev = &pdev->dev;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	lpc18xx_pwm->base = devm_ioremap_resource(&pdev->dev, res);
+	lpc18xx_pwm->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(lpc18xx_pwm->base))
 		return PTR_ERR(lpc18xx_pwm->base);
 
Signature · 1 line
2.17.1
author
#127 lore raw

PATCH 29/32 pwm: lpc18xx-sct: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-lpc18xx-sct.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-lpc18xx-sct.c +1 -3
index 5ff11145c1a3..dc5133bec3e7 100644
@@ -325,7 +325,6 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev)
 {
 	struct lpc18xx_pwm_chip *lpc18xx_pwm;
 	struct pwm_device *pwm;
-	struct resource *res;
 	int ret, i;
 	u64 val;
 
@@ -336,8 +335,7 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev)
 
 	lpc18xx_pwm->dev = &pdev->dev;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	lpc18xx_pwm->base = devm_ioremap_resource(&pdev->dev, res);
+	lpc18xx_pwm->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(lpc18xx_pwm->base))
 		return PTR_ERR(lpc18xx_pwm->base);
 
Signature · 1 line
2.17.1
#32 lore raw

PATCH 30/32 pwm: hibvt: do some cleanup

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code. 'i' and 'ret' are variables of the same type and there is no need to use two lines.

---
 drivers/pwm/pwm-hibvt.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/pwm/pwm-hibvt.c +2 -5
index ad205fdad372..a1900d0a872e 100644
@@ -190,9 +190,7 @@ static int hibvt_pwm_probe(struct platform_device *pdev)
 	const struct hibvt_pwm_soc *soc =
 				of_device_get_match_data(&pdev->dev);
 	struct hibvt_pwm_chip *pwm_chip;
-	struct resource *res;
-	int ret;
-	int i;
+	int ret, i;
 
 	pwm_chip = devm_kzalloc(&pdev->dev, sizeof(*pwm_chip), GFP_KERNEL);
 	if (pwm_chip == NULL)
@@ -213,8 +211,7 @@ static int hibvt_pwm_probe(struct platform_device *pdev)
 	pwm_chip->chip.of_pwm_n_cells = 3;
 	pwm_chip->soc = soc;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pwm_chip->base = devm_ioremap_resource(&pdev->dev, res);
+	pwm_chip->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pwm_chip->base))
 		return PTR_ERR(pwm_chip->base);
 
Signature · 1 line
2.17.1
author
#128 lore raw

PATCH 30/32 pwm: hibvt: do some cleanup

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code. 'i' and 'ret' are variables of the same type and there is no need to use two lines.

---
 drivers/pwm/pwm-hibvt.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/pwm/pwm-hibvt.c +2 -5
index ad205fdad372..a1900d0a872e 100644
@@ -190,9 +190,7 @@ static int hibvt_pwm_probe(struct platform_device *pdev)
 	const struct hibvt_pwm_soc *soc =
 				of_device_get_match_data(&pdev->dev);
 	struct hibvt_pwm_chip *pwm_chip;
-	struct resource *res;
-	int ret;
-	int i;
+	int ret, i;
 
 	pwm_chip = devm_kzalloc(&pdev->dev, sizeof(*pwm_chip), GFP_KERNEL);
 	if (pwm_chip == NULL)
@@ -213,8 +211,7 @@ static int hibvt_pwm_probe(struct platform_device *pdev)
 	pwm_chip->chip.of_pwm_n_cells = 3;
 	pwm_chip->soc = soc;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pwm_chip->base = devm_ioremap_resource(&pdev->dev, res);
+	pwm_chip->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pwm_chip->base))
 		return PTR_ERR(pwm_chip->base);
 
Signature · 1 line
2.17.1
author
#131 lore raw

PATCH 30/32 pwm: hibvt: do some cleanup

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code. 'i' and 'ret' are variables of the same type and there is no need to use two lines.

---
 drivers/pwm/pwm-hibvt.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/pwm/pwm-hibvt.c +2 -5
index ad205fdad372..a1900d0a872e 100644
@@ -190,9 +190,7 @@ static int hibvt_pwm_probe(struct platform_device *pdev)
 	const struct hibvt_pwm_soc *soc =
 				of_device_get_match_data(&pdev->dev);
 	struct hibvt_pwm_chip *pwm_chip;
-	struct resource *res;
-	int ret;
-	int i;
+	int ret, i;
 
 	pwm_chip = devm_kzalloc(&pdev->dev, sizeof(*pwm_chip), GFP_KERNEL);
 	if (pwm_chip == NULL)
@@ -213,8 +211,7 @@ static int hibvt_pwm_probe(struct platform_device *pdev)
 	pwm_chip->chip.of_pwm_n_cells = 3;
 	pwm_chip->soc = soc;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pwm_chip->base = devm_ioremap_resource(&pdev->dev, res);
+	pwm_chip->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pwm_chip->base))
 		return PTR_ERR(pwm_chip->base);
 
Signature · 1 line
2.17.1
#33 lore raw

PATCH 31/32 pwm: sifive: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-sifive.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-sifive.c +1 -3
index cc63f9baa481..cb9134d7197b 100644
@@ -232,7 +232,6 @@ static int pwm_sifive_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct pwm_sifive_ddata *ddata;
 	struct pwm_chip *chip;
-	struct resource *res;
 	int ret;
 
 	ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL);
@@ -248,8 +247,7 @@ static int pwm_sifive_probe(struct platform_device *pdev)
 	chip->base = -1;
 	chip->npwm = 4;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	ddata->regs = devm_ioremap_resource(dev, res);
+	ddata->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(ddata->regs))
 		return PTR_ERR(ddata->regs);
 
Signature · 1 line
2.17.1
author
#132 lore raw

PATCH 31/32 pwm: sifive: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-sifive.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-sifive.c +1 -3
index cc63f9baa481..cb9134d7197b 100644
@@ -232,7 +232,6 @@ static int pwm_sifive_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct pwm_sifive_ddata *ddata;
 	struct pwm_chip *chip;
-	struct resource *res;
 	int ret;
 
 	ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL);
@@ -248,8 +247,7 @@ static int pwm_sifive_probe(struct platform_device *pdev)
 	chip->base = -1;
 	chip->npwm = 4;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	ddata->regs = devm_ioremap_resource(dev, res);
+	ddata->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(ddata->regs))
 		return PTR_ERR(ddata->regs);
 
Signature · 1 line
2.17.1
author
#134 lore raw

PATCH 31/32 pwm: sifive: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-sifive.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-sifive.c +1 -3
index cc63f9baa481..cb9134d7197b 100644
@@ -232,7 +232,6 @@ static int pwm_sifive_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct pwm_sifive_ddata *ddata;
 	struct pwm_chip *chip;
-	struct resource *res;
 	int ret;
 
 	ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL);
@@ -248,8 +247,7 @@ static int pwm_sifive_probe(struct platform_device *pdev)
 	chip->base = -1;
 	chip->npwm = 4;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	ddata->regs = devm_ioremap_resource(dev, res);
+	ddata->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(ddata->regs))
 		return PTR_ERR(ddata->regs);
 
Signature · 1 line
2.17.1
#34 lore raw

PATCH 32/32 pwm: atmel: convert to devm_platform_ioremap_resource

In reply to a message not in the archive

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-atmel.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-atmel.c +1 -3
index 9ba733467e26..86cc5ccaa46c 100644
@@ -340,7 +340,6 @@ MODULE_DEVICE_TABLE(of, atmel_pwm_dt_ids);
 static int atmel_pwm_probe(struct platform_device *pdev)
 {
 	struct atmel_pwm_chip *atmel_pwm;
-	struct resource *res;
 	int ret;
 
 	atmel_pwm = devm_kzalloc(&pdev->dev, sizeof(*atmel_pwm), GFP_KERNEL);
@@ -351,8 +350,7 @@ static int atmel_pwm_probe(struct platform_device *pdev)
 	atmel_pwm->data = of_device_get_match_data(&pdev->dev);
 	atmel_pwm->updated_pwms = 0;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	atmel_pwm->base = devm_ioremap_resource(&pdev->dev, res);
+	atmel_pwm->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(atmel_pwm->base))
 		return PTR_ERR(atmel_pwm->base);
 
Signature · 1 line
2.17.1
author
#135 lore raw

PATCH 32/32 pwm: atmel: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-atmel.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-atmel.c +1 -3
index 9ba733467e26..86cc5ccaa46c 100644
@@ -340,7 +340,6 @@ MODULE_DEVICE_TABLE(of, atmel_pwm_dt_ids);
 static int atmel_pwm_probe(struct platform_device *pdev)
 {
 	struct atmel_pwm_chip *atmel_pwm;
-	struct resource *res;
 	int ret;
 
 	atmel_pwm = devm_kzalloc(&pdev->dev, sizeof(*atmel_pwm), GFP_KERNEL);
@@ -351,8 +350,7 @@ static int atmel_pwm_probe(struct platform_device *pdev)
 	atmel_pwm->data = of_device_get_match_data(&pdev->dev);
 	atmel_pwm->updated_pwms = 0;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	atmel_pwm->base = devm_ioremap_resource(&pdev->dev, res);
+	atmel_pwm->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(atmel_pwm->base))
 		return PTR_ERR(atmel_pwm->base);
 
Signature · 1 line
2.17.1
author
#142 lore raw

PATCH 32/32 pwm: atmel: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-atmel.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-atmel.c +1 -3
index 9ba733467e26..86cc5ccaa46c 100644
@@ -340,7 +340,6 @@ MODULE_DEVICE_TABLE(of, atmel_pwm_dt_ids);
 static int atmel_pwm_probe(struct platform_device *pdev)
 {
 	struct atmel_pwm_chip *atmel_pwm;
-	struct resource *res;
 	int ret;
 
 	atmel_pwm = devm_kzalloc(&pdev->dev, sizeof(*atmel_pwm), GFP_KERNEL);
@@ -351,8 +350,7 @@ static int atmel_pwm_probe(struct platform_device *pdev)
 	atmel_pwm->data = of_device_get_match_data(&pdev->dev);
 	atmel_pwm->updated_pwms = 0;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	atmel_pwm->base = devm_ioremap_resource(&pdev->dev, res);
+	atmel_pwm->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(atmel_pwm->base))
 		return PTR_ERR(atmel_pwm->base);
 
Signature · 1 line
2.17.1
maintainer Reviewed-by on v1 15/32
#75 lore raw

Re: [PATCH 15/32] pwm: rockchip: convert to devm_platform_ioremap_resource

In reply to Yangtao Li

Am Sonntag, 29. Dezember 2019, 09:05:53 CET schrieb Yangtao Li:

Quoted 3 lines

Use devm_platform_ioremap_resource() to simplify code.

Quoted 27 lines
---
 drivers/pwm/pwm-rockchip.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-rockchip.c +1 -3
index 73352e6fbccb..f0549b82338d 100644
@@ -292,7 +292,6 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
 {
 	const struct of_device_id *id;
 	struct rockchip_pwm_chip *pc;
-	struct resource *r;
 	int ret, count;
 
 	id = of_match_device(rockchip_pwm_dt_ids, &pdev->dev);
@@ -303,8 +302,7 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
 	if (!pc)
 		return -ENOMEM;
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pc->base = devm_ioremap_resource(&pdev->dev, r);
+	pc->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pc->base))
 		return PTR_ERR(pc->base);
 
Acked-by on v1 32/32
#136 lore raw

Re: [PATCH 32/32] pwm: atmel: convert to devm_platform_ioremap_resource

In reply to Yangtao Li
Quoted 3 lines · Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

Quoted 30 lines
---
 drivers/pwm/pwm-atmel.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-atmel.c +1 -4
index 9ba733467e26..86cc5ccaa46c 100644
@@ -340,7 +340,6 @@ MODULE_DEVICE_TABLE(of, atmel_pwm_dt_ids);
 static int atmel_pwm_probe(struct platform_device *pdev)
 {
        struct atmel_pwm_chip *atmel_pwm;
-       struct resource *res;
        int ret;
 
        atmel_pwm = devm_kzalloc(&pdev->dev, sizeof(*atmel_pwm), GFP_KERNEL);
@@ -351,8 +350,7 @@ static int atmel_pwm_probe(struct platform_device *pdev)
        atmel_pwm->data = of_device_get_match_data(&pdev->dev);
        atmel_pwm->updated_pwms = 0;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       atmel_pwm->base = devm_ioremap_resource(&pdev->dev, res);
+       atmel_pwm->base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(atmel_pwm->base))
                return PTR_ERR(atmel_pwm->base);
 
--

2.17.1

#138 lore raw

Re: [PATCH 32/32] pwm: atmel: convert to devm_platform_ioremap_resource

In reply to a message not in the archive
Quoted 3 lines · Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

Quoted 30 lines
---
 drivers/pwm/pwm-atmel.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-atmel.c +1 -4
index 9ba733467e26..86cc5ccaa46c 100644
@@ -340,7 +340,6 @@ MODULE_DEVICE_TABLE(of, atmel_pwm_dt_ids);
 static int atmel_pwm_probe(struct platform_device *pdev)
 {
        struct atmel_pwm_chip *atmel_pwm;
-       struct resource *res;
        int ret;
 
        atmel_pwm = devm_kzalloc(&pdev->dev, sizeof(*atmel_pwm), GFP_KERNEL);
@@ -351,8 +350,7 @@ static int atmel_pwm_probe(struct platform_device *pdev)
        atmel_pwm->data = of_device_get_match_data(&pdev->dev);
        atmel_pwm->updated_pwms = 0;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       atmel_pwm->base = devm_ioremap_resource(&pdev->dev, res);
+       atmel_pwm->base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(atmel_pwm->base))
                return PTR_ERR(atmel_pwm->base);
 
--

2.17.1

#139 lore raw

Re: [PATCH 32/32] pwm: atmel: convert to devm_platform_ioremap_resource

In reply to a message not in the archive
Quoted 3 lines · Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

Quoted 30 lines
---
 drivers/pwm/pwm-atmel.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-atmel.c +1 -4
index 9ba733467e26..86cc5ccaa46c 100644
@@ -340,7 +340,6 @@ MODULE_DEVICE_TABLE(of, atmel_pwm_dt_ids);
 static int atmel_pwm_probe(struct platform_device *pdev)
 {
        struct atmel_pwm_chip *atmel_pwm;
-       struct resource *res;
        int ret;
 
        atmel_pwm = devm_kzalloc(&pdev->dev, sizeof(*atmel_pwm), GFP_KERNEL);
@@ -351,8 +350,7 @@ static int atmel_pwm_probe(struct platform_device *pdev)
        atmel_pwm->data = of_device_get_match_data(&pdev->dev);
        atmel_pwm->updated_pwms = 0;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       atmel_pwm->base = devm_ioremap_resource(&pdev->dev, res);
+       atmel_pwm->base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(atmel_pwm->base))
                return PTR_ERR(atmel_pwm->base);
 
--

2.17.1

Acked-by on v1 32/32
#140 lore raw

Re: [PATCH 32/32] pwm: atmel: convert to devm_platform_ioremap_resource

In reply to Yangtao Li
Quoted 3 lines · Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

Quoted 30 lines
---
 drivers/pwm/pwm-atmel.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-atmel.c +1 -4
index 9ba733467e26..86cc5ccaa46c 100644
@@ -340,7 +340,6 @@ MODULE_DEVICE_TABLE(of, atmel_pwm_dt_ids);
 static int atmel_pwm_probe(struct platform_device *pdev)
 {
        struct atmel_pwm_chip *atmel_pwm;
-       struct resource *res;
        int ret;
 
        atmel_pwm = devm_kzalloc(&pdev->dev, sizeof(*atmel_pwm), GFP_KERNEL);
@@ -351,8 +350,7 @@ static int atmel_pwm_probe(struct platform_device *pdev)
        atmel_pwm->data = of_device_get_match_data(&pdev->dev);
        atmel_pwm->updated_pwms = 0;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       atmel_pwm->base = devm_ioremap_resource(&pdev->dev, res);
+       atmel_pwm->base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(atmel_pwm->base))
                return PTR_ERR(atmel_pwm->base);
 
--

2.17.1

Reviewed-by on v1 25/32
#106 lore raw

Re: [PATCH 25/32] pwm: brcmstb: convert to devm_platform_ioremap_resource

In reply to Yangtao Li
Quoted 4 lines · Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---

Thanks!

Quoted 25 lines
 drivers/pwm/pwm-brcmstb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-brcmstb.c +1 -3
index fea612c45f20..8b66f9d2f589 100644
@@ -234,7 +234,6 @@ MODULE_DEVICE_TABLE(of, brcmstb_pwm_of_match);
 static int brcmstb_pwm_probe(struct platform_device *pdev)
 {
 	struct brcmstb_pwm *p;
-	struct resource *res;
 	int ret;
 
 	p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
@@ -262,8 +261,7 @@ static int brcmstb_pwm_probe(struct platform_device *pdev)
 	p->chip.base = -1;
 	p->chip.npwm = 2;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	p->base = devm_ioremap_resource(&pdev->dev, res);
+	p->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(p->base)) {
 		ret = PTR_ERR(p->base);
 		goto out_clk;
#108 lore raw

Re: [PATCH 25/32] pwm: brcmstb: convert to devm_platform_ioremap_resource

In reply to a message not in the archive
Quoted 4 lines · Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---

Thanks!

Quoted 16 lines
 drivers/pwm/pwm-brcmstb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-brcmstb.c +0 -1
index fea612c45f20..8b66f9d2f589 100644
@@ -234,7 +234,6 @@ MODULE_DEVICE_TABLE(of, brcmstb_pwm_of_match);
 static int brcmstb_pwm_probe(struct platform_device *pdev)
 {
 	struct brcmstb_pwm *p;
-	struct resource *res;
 	int ret;
 
 	p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);

drivers/pwm/pwm-brcmstb.c static int brcmstb_pwm_probe(struct platform_device *pdev) · line 267

Quoted 9 lines
drivers/pwm/pwm-brcmstb.c +1 -2
@@ -262,8 +261,7 @@ static int brcmstb_pwm_probe(struct platform_device *pdev)
 	p->chip.base = -1;
 	p->chip.npwm = 2;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	p->base = devm_ioremap_resource(&pdev->dev, res);
+	p->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(p->base)) {
 		ret = PTR_ERR(p->base);
 		goto out_clk;

_______________________________________________
Linux-rockchip mailing list [email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

Reviewed-by on v1 25/32
#109 lore raw

Re: [PATCH 25/32] pwm: brcmstb: convert to devm_platform_ioremap_resource

In reply to Yangtao Li
Quoted 4 lines · Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---

Thanks!

Quoted 25 lines
 drivers/pwm/pwm-brcmstb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-brcmstb.c +1 -3
index fea612c45f20..8b66f9d2f589 100644
@@ -234,7 +234,6 @@ MODULE_DEVICE_TABLE(of, brcmstb_pwm_of_match);
 static int brcmstb_pwm_probe(struct platform_device *pdev)
 {
 	struct brcmstb_pwm *p;
-	struct resource *res;
 	int ret;
 
 	p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
@@ -262,8 +261,7 @@ static int brcmstb_pwm_probe(struct platform_device *pdev)
 	p->chip.base = -1;
 	p->chip.npwm = 2;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	p->base = devm_ioremap_resource(&pdev->dev, res);
+	p->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(p->base)) {
 		ret = PTR_ERR(p->base);
 		goto out_clk;
Acked-by on v1 30/32
#129 lore raw

Re: [PATCH 30/32] pwm: hibvt: do some cleanup

In reply to Yangtao Li
Quoted 3 lines · Yangtao Li

Use devm_platform_ioremap_resource() to simplify code. 'i' and 'ret' are variables of the same type and there is no need to use two lines.

I think I wouldn't have merged these two lines, but I don't feel strong here. The other 31 patches are clean replacements.

But I also don't think respining just for this minor thing is worth the effort, so:

for the whole series. (Not sure it is sensible to ack each patch individually, @Thierry, tell me if this simplifies things for you.)

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
maintainer Reviewed-by on v1 26/32
#113 lore raw

Re: [PATCH 26/32] pwm: mtk-disp: convert to devm_platform_ioremap_resource

In reply to Yangtao Li
Quoted 3 lines · Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

Quoted 27 lines
---
 drivers/pwm/pwm-mtk-disp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-mtk-disp.c +1 -3
index 83b8be0209b7..87c6b4bc5d43 100644
@@ -172,7 +172,6 @@ static const struct pwm_ops mtk_disp_pwm_ops = {
 static int mtk_disp_pwm_probe(struct platform_device *pdev)
 {
 	struct mtk_disp_pwm *mdp;
-	struct resource *r;
 	int ret;
 
 	mdp = devm_kzalloc(&pdev->dev, sizeof(*mdp), GFP_KERNEL);
@@ -181,8 +180,7 @@ static int mtk_disp_pwm_probe(struct platform_device *pdev)
 
 	mdp->data = of_device_get_match_data(&pdev->dev);
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	mdp->base = devm_ioremap_resource(&pdev->dev, r);
+	mdp->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(mdp->base))
 		return PTR_ERR(mdp->base);
 
Reviewed-by
#115 lore raw

Re: [PATCH 26/32] pwm: mtk-disp: convert to devm_platform_ioremap_resource

In reply to a message not in the archive
Quoted 3 lines · Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

Quoted 27 lines
---
 drivers/pwm/pwm-mtk-disp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-mtk-disp.c +1 -3
index 83b8be0209b7..87c6b4bc5d43 100644
@@ -172,7 +172,6 @@ static const struct pwm_ops mtk_disp_pwm_ops = {
 static int mtk_disp_pwm_probe(struct platform_device *pdev)
 {
 	struct mtk_disp_pwm *mdp;
-	struct resource *r;
 	int ret;
 
 	mdp = devm_kzalloc(&pdev->dev, sizeof(*mdp), GFP_KERNEL);
@@ -181,8 +180,7 @@ static int mtk_disp_pwm_probe(struct platform_device *pdev)
 
 	mdp->data = of_device_get_match_data(&pdev->dev);
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	mdp->base = devm_ioremap_resource(&pdev->dev, r);
+	mdp->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(mdp->base))
 		return PTR_ERR(mdp->base);
 
maintainer Reviewed-by on v1 26/32
#116 lore raw

Re: [PATCH 26/32] pwm: mtk-disp: convert to devm_platform_ioremap_resource

In reply to Yangtao Li
Quoted 3 lines · Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

Quoted 27 lines
---
 drivers/pwm/pwm-mtk-disp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-mtk-disp.c +1 -3
index 83b8be0209b7..87c6b4bc5d43 100644
@@ -172,7 +172,6 @@ static const struct pwm_ops mtk_disp_pwm_ops = {
 static int mtk_disp_pwm_probe(struct platform_device *pdev)
 {
 	struct mtk_disp_pwm *mdp;
-	struct resource *r;
 	int ret;
 
 	mdp = devm_kzalloc(&pdev->dev, sizeof(*mdp), GFP_KERNEL);
@@ -181,8 +180,7 @@ static int mtk_disp_pwm_probe(struct platform_device *pdev)
 
 	mdp->data = of_device_get_match_data(&pdev->dev);
 
-	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	mdp->base = devm_ioremap_resource(&pdev->dev, r);
+	mdp->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(mdp->base))
 		return PTR_ERR(mdp->base);
 
Reviewed-by
#130 lore raw

Re: [PATCH 30/32] pwm: hibvt: do some cleanup

In reply to Uwe Kleine-König
Quoted 8 lines · Uwe Kleine-König
Quoted 3 lines · Yangtao Li

Use devm_platform_ioremap_resource() to simplify code. 'i' and 'ret' are variables of the same type and there is no need to use two lines.

I think I wouldn't have merged these two lines, but I don't feel strong here. The other 31 patches are clean replacements.

Quoted 7 lines

But I also don't think respining just for this minor thing is worth the effort, so:

for the whole series. (Not sure it is sensible to ack each patch individually, @Thierry, tell me if this simplifies things for you.)

I took a deeper look now and added Reviewed-by for all other patches to ease application. So doing the same here:

FTR: I'd do the following now:

	for patch in 1216003 1216065 1216063 1216005 1216062 1216061 1216059 1216057 1216054 1216056 1216051 1216050 1216048 1216010 1216044 1216046 1216042 1216041 1216036 1216037 1216034 1216032 1216030 1216013 1216029 1216025 1216026 1216024 1216015 1216021 1216017 1216019; do

		pwclient git-am -m -s $patch && pwclient update -s "Accepted" -c "$(git rev-parse HEAD)" $patch || break
	done

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
#144 lore raw
In reply to Yangtao Li

Hello Thierry,

Quoted 20 lines · Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-sun4i.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-sun4i.c +0 -1
index 581d23287333..f2afd312f77c 100644
@@ -344,7 +344,6 @@ MODULE_DEVICE_TABLE(of, sun4i_pwm_dt_ids);
 static int sun4i_pwm_probe(struct platform_device *pdev)
 {
 	struct sun4i_pwm_chip *pwm;
-	struct resource *res;
 	int ret;
 
 	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);

drivers/pwm/pwm-sun4i.c static int sun4i_pwm_probe(struct platform_device *pdev) · line 359

Quoted 8 lines
drivers/pwm/pwm-sun4i.c +1 -2
@@ -355,8 +354,7 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
 	if (!pwm->data)
 		return -ENODEV;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pwm->base = devm_ioremap_resource(&pdev->dev, res);
+	pwm->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pwm->base))
 		return PTR_ERR(pwm->base);

Can you please comment why you don't apply this series?

My point of view is:

devm_platform_ioremap_resource is the designated wrapper to replace platform_get_resource() and devm_ioremap_resource(). So I don't see a good reason to continue open coding it.

The patch series doesn't apply to 5.10-rc1 as is. (pwm-puv3 was removed and a simple conflict in the pwm-rockchip driver.) The overall diffstat (of the fixed series applied on top of 5.10-rc1) is

	31 files changed, 32 insertions(+), 96 deletions(-)

and it converts all of drivers/pwm but a single instance of platform_get_resource() + devm_ioremap_resource() (for pwm-lpss where platform_get_resource and devm_ioremap_resource are in different functions (different files even)) which isn't trivial to fix.

So in my eyes applying this series is the right thing to do.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
#145 lore raw
Quoted 26 lines · Uwe Kleine-König

Hello Thierry,

Quoted 23 lines · Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/pwm/pwm-sun4i.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-sun4i.c +0 -1
index 581d23287333..f2afd312f77c 100644
@@ -344,7 +344,6 @@ MODULE_DEVICE_TABLE(of, sun4i_pwm_dt_ids);
 static int sun4i_pwm_probe(struct platform_device *pdev)
 {
 	struct sun4i_pwm_chip *pwm;
-	struct resource *res;
 	int ret;
 
 	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
@@ -355,8 +354,7 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
 	if (!pwm->data)
 		return -ENODEV;
 
Quoted 7 lines

drivers/pwm/pwm-sun4i.c static int sun4i_pwm_probe(struct platform_device *pdev) · line 359

Quoted 5 lines
drivers/pwm/pwm-sun4i.c +1 -2
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pwm->base = devm_ioremap_resource(&pdev->dev, res);
+	pwm->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pwm->base))
 		return PTR_ERR(pwm->base);

Can you please comment why you don't apply this series?

I did in fact apply this yesterday, but I now see that I didn't reply to the thread to report that.

Quoted 10 lines

My point of view is:

devm_platform_ioremap_resource is the designated wrapper to replace platform_get_resource() and devm_ioremap_resource(). So I don't see a good reason to continue open coding it.

The patch series doesn't apply to 5.10-rc1 as is. (pwm-puv3 was removed and a simple conflict in the pwm-rockchip driver.) The overall diffstat (of the fixed series applied on top of 5.10-rc1) is

Quoted 8 lines
	31 files changed, 32 insertions(+), 96 deletions(-)

and it converts all of drivers/pwm but a single instance of platform_get_resource() + devm_ioremap_resource() (for pwm-lpss where platform_get_resource and devm_ioremap_resource are in different functions (different files even)) which isn't trivial to fix.

So in my eyes applying this series is the right thing to do.

For the record, I personally think this helper is a bit over the top. I do agree that it's nice to create helpers for common code sequences, but this is a *lot* of churn all across the kernel to save just two lines, which I don't think is worth it in this case. Often these helpers allow common mistakes to be avoided while at the same time reducing lines of code, but devm_ioremap_resource() was already created to address the pitfalls (like returning all sorts of weird and inconsistent error codes). So this helper doesn't actually add any value other than saving a few lines, which I don't think justifies the churn. I would've been sold on this if the ratio had been slightly higher, like maybe saving a dozen or so lines, but as it is, I just don't think it's worth the churn that it's causing.

I also think that it's overly narrow is scope, so you can't actually "blindly" use this helper and I've seen quite a few cases where this was unknowingly used for cases where it shouldn't have been used and then broke things (because some drivers must not do the request_mem_region() for example). And then there are cases where the driver needs the resource for some other purpose, so you can't use the helper either, or at least it looses all of its advantages in those cases.

That said, the helper is there and has been widely accepted, so my opinion has been overruled by the majority.

Thierry

#146 lore raw

Hello Thierry,

Quoted 5 lines · Thierry Reding

I also think that it's overly narrow is scope, so you can't actually "blindly" use this helper and I've seen quite a few cases where this was unknowingly used for cases where it shouldn't have been used and then broke things (because some drivers must not do the request_mem_region() for example).

You have a link to such an accident?

Quoted 3 lines

And then there are cases where the driver needs the
resource for some other purpose, so you can't use the helper either, or at least it looses all of its advantages in those cases.

There is devm_platform_get_and_ioremap_resource() for (some of) these cases.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
#147 lore raw

About devm_platform_ioremap_resource [Was: Re: [PATCH 01/32] pwm: sun4i: convert to devm_platform_ioremap_resource]

In reply to Uwe Kleine-König

Hello,

[Added lkml and the people involved in commit 7945f929f1a7 ("drivers: provide devm_platform_ioremap_resource()") to Cc:. For the new readers: This is about patches making use of devm_platform_ioremap_resource() instead of open coding it. Full context at https://lore.kernel.org/r/20201112190649.GA908613@ulmo]

Quoted 8 lines · Uwe Kleine-König
Quoted 5 lines · Thierry Reding

I also think that it's overly narrow is scope, so you can't actually "blindly" use this helper and I've seen quite a few cases where this was unknowingly used for cases where it shouldn't have been used and then broke things (because some drivers must not do the request_mem_region() for example).

You have a link to such an accident?

I got a hint in private here: https://lore.kernel.org/r/[email protected]

devm_platform_ioremap_resource() is platform_get_resource() + devm_ioremap_resource() and here it was used to replace platform_get_resource() + devm_ioremap().

IMHO the unlucky thing in this situation is that devm_ioremap_resource() and devm_ioremap() are different by more than just how they get the area to remap. (i.e. devm_ioremap_resource() also does devm_request_mem_region().)

So the problem is not the added wrapper, but unclear semantics in the functions it uses. In my eyes devm_ioremap() and devm_platform_ioremap_resource() should better be named devm_request_ioremap() and devm_platform_request_ioremap_resource() respectively. Is it worth to rename these for clearity?

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
#148 lore raw

cover Rename ioremap functions that include request_mem

Hello,

here comes a patch set that implements the suggestion in the previous mail so we have something to discuss about.

Best regards
Uwe

Uwe Kleine-König (2):
base: Rename devm_ioremap_resource to make the implicit request_mem
explicit
platform: Rename devm_platform_ioremap_resource to make the implicit
request_mem explicit

 .../driver-api/driver-model/devres.rst        |  6 +--
 drivers/base/platform.c                       | 26 +++++------
 include/linux/device.h                        | 32 ++++++++++++--
 include/linux/platform_device.h               | 43 +++++++++++++++++--
 lib/devres.c                                  | 18 ++++----
 5 files changed, 93 insertions(+), 32 deletions(-)

base-commit: 3650b228f83adda7e5ee532e2b90429c03f7b9ec

Signature · 1 line
2.28.0
#150 lore raw

PATCH 2/2 platform: Rename devm_platform_ioremap_resource to make the implicit request_mem explicit

devm_ioremap_resource() and so devm_platform_ioremap_resource() et al also include a call to devm_request_mem(). Make this explicit in their name to make this difference compared to devm_ioremap() more obvious.

This follows the similar rename of devm_ioremap_resource in the previous commit.

---
 .../driver-api/driver-model/devres.rst        |  2 +-
 drivers/base/platform.c                       | 26 +++++------
 include/linux/device.h                        |  3 +-
 include/linux/platform_device.h               | 43 +++++++++++++++++--
 4 files changed, 56 insertions(+), 18 deletions(-)
Documentation/driver-api/driver-model/devres.rst +1 -1
index 65f9f44d5c39..6dd5c219f11e 100644
@@ -311,7 +311,7 @@ IOMAP
   devm_ioremap_wc()
   devm_request_ioremap_resource() : checks resource, requests memory region, ioremaps
   devm_request_ioremap_resource_wc()
-  devm_platform_ioremap_resource() : calls devm_ioremap_resource() for platform device
+  devm_platform_request_ioremap_resource() : calls devm_request_ioremap_resource() for platform device
   devm_platform_ioremap_resource_wc()
   devm_platform_ioremap_resource_byname()
   devm_platform_get_and_ioremap_resource()
drivers/base/platform.c +13 -13
index 88aef93eb4dd..5a451121a9e0 100644
@@ -65,8 +65,8 @@ EXPORT_SYMBOL_GPL(platform_get_resource);
 
 #ifdef CONFIG_HAS_IOMEM
 /**
- * devm_platform_get_and_ioremap_resource - call devm_ioremap_resource() for a
- *					    platform device and get resource
+ * devm_platform_get_request_and_ioremap_resource - call devm_ioremap_resource() for a
+ *						    platform device and get resource
  *
  * @pdev: platform device to use both for memory resource lookup as well as
  *        resource management
@@ -77,17 +77,17 @@ EXPORT_SYMBOL_GPL(platform_get_resource);
  * on failure.
  */
 void __iomem *
-devm_platform_get_and_ioremap_resource(struct platform_device *pdev,
-				unsigned int index, struct resource **res)
+devm_platform_get_request_and_ioremap_resource(struct platform_device *pdev,
+					       unsigned int index, struct resource **res)
 {
 	struct resource *r;
 
 	r = platform_get_resource(pdev, IORESOURCE_MEM, index);
 	if (res)
 		*res = r;
-	return devm_ioremap_resource(&pdev->dev, r);
+	return devm_request_ioremap_resource(&pdev->dev, r);
 }
-EXPORT_SYMBOL_GPL(devm_platform_get_and_ioremap_resource);
+EXPORT_SYMBOL_GPL(devm_platform_get_request_and_ioremap_resource);
 
 /**
  * devm_platform_ioremap_resource - call devm_ioremap_resource() for a platform
@@ -100,12 +100,12 @@ EXPORT_SYMBOL_GPL(devm_platform_get_and_ioremap_resource);
  * Return: a pointer to the remapped memory or an ERR_PTR() encoded error code
  * on failure.
  */
-void __iomem *devm_platform_ioremap_resource(struct platform_device *pdev,
-					     unsigned int index)
+void __iomem *devm_platform_request_ioremap_resource(struct platform_device *pdev,
+						     unsigned int index)
 {
-	return devm_platform_get_and_ioremap_resource(pdev, index, NULL);
+	return devm_platform_get_request_and_ioremap_resource(pdev, index, NULL);
 }
-EXPORT_SYMBOL_GPL(devm_platform_ioremap_resource);
+EXPORT_SYMBOL_GPL(devm_platform_request_ioremap_resource);
 
 /**
  * devm_platform_ioremap_resource_wc - write-combined variant of
@@ -118,13 +118,13 @@ EXPORT_SYMBOL_GPL(devm_platform_ioremap_resource);
  * Return: a pointer to the remapped memory or an ERR_PTR() encoded error code
  * on failure.
  */
-void __iomem *devm_platform_ioremap_resource_wc(struct platform_device *pdev,
-						unsigned int index)
+void __iomem *devm_platform_request_ioremap_resource_wc(struct platform_device *pdev,
+							unsigned int index)
 {
 	struct resource *res;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, index);
-	return devm_ioremap_resource_wc(&pdev->dev, res);
+	return devm_request_ioremap_resource_wc(&pdev->dev, res);
 }
 
 /**
include/linux/device.h +2 -1
index 927992549db9..3679a42f94a9 100644
@@ -245,7 +245,8 @@ void __iomem *devm_request_ioremap_resource(struct device *dev,
 /*
  * devm_ioremap_resource() was the initial name chosen for
  * devm_request_ioremap_resource(). Please stick to the latter for clearer
- * semantics.
+ * semantics. When converting consider using
+ * devm_platform_request_ioremap_resource().
  */
 static inline void __iomem *
 devm_ioremap_resource(struct device *dev, const struct resource *res)
include/linux/platform_device.h +40 -3

55 lines not on this page · raw message

Signature · 1 line
2.28.0
#149 lore raw

PATCH 1/2 base: Rename devm_ioremap_resource to make the implicit request_mem explicit

In reply to Uwe Kleine-König

The main difference between devm_ioremap() and devm_ioremap_resource() (apart from the different way to pass the area to map) is that the latter also calls devm_request_mem() which is unintuitive and yields problems like https://lore.kernel.org/r/[email protected] .

So rename devm_ioremap_resource and it's relative devm_ioremap_resource_wc to include "request" in their name.

Until all users are converted, provide wrappers with the old name.

---
 .../driver-api/driver-model/devres.rst        |  4 +--
 include/linux/device.h                        | 31 ++++++++++++++++---
 lib/devres.c                                  | 18 +++++------
 3 files changed, 38 insertions(+), 15 deletions(-)
Documentation/driver-api/driver-model/devres.rst +2 -2
index bb676570acc3..65f9f44d5c39 100644
@@ -309,8 +309,8 @@ IOMAP
   devm_ioremap()
   devm_ioremap_uc()
   devm_ioremap_wc()
-  devm_ioremap_resource() : checks resource, requests memory region, ioremaps
-  devm_ioremap_resource_wc()
+  devm_request_ioremap_resource() : checks resource, requests memory region, ioremaps
+  devm_request_ioremap_resource_wc()
   devm_platform_ioremap_resource() : calls devm_ioremap_resource() for platform device
   devm_platform_ioremap_resource_wc()
   devm_platform_ioremap_resource_byname()
include/linux/device.h +27 -4
index 5ed101be7b2e..927992549db9 100644
@@ -240,10 +240,33 @@ unsigned long devm_get_free_pages(struct device *dev,
 				  gfp_t gfp_mask, unsigned int order);
 void devm_free_pages(struct device *dev, unsigned long addr);
 
-void __iomem *devm_ioremap_resource(struct device *dev,
-				    const struct resource *res);
-void __iomem *devm_ioremap_resource_wc(struct device *dev,
-				       const struct resource *res);
+void __iomem *devm_request_ioremap_resource(struct device *dev,
+					    const struct resource *res);
+/*
+ * devm_ioremap_resource() was the initial name chosen for
+ * devm_request_ioremap_resource(). Please stick to the latter for clearer
+ * semantics.
+ */
+static inline void __iomem *
+devm_ioremap_resource(struct device *dev, const struct resource *res)
+{
+	return devm_request_ioremap_resource(dev, res);
+}
+
+void __iomem *devm_request_ioremap_resource_wc(struct device *dev,
+					       const struct resource *res);
+
+/*
+ * devm_ioremap_resource_wc() was the initial name chosen for
+ * devm_request_ioremap_resource_wc(). Please stick to the latter for clearer
+ * semantics.
+ */
+static inline void __iomem *
+devm_ioremap_resource_wc(struct device *dev,
+			 const struct resource *res)
+{
+	return devm_request_ioremap_resource_wc(dev, res);
+}
 
 void __iomem *devm_of_iomap(struct device *dev,
 			    struct device_node *node, int index,
lib/devres.c +9 -9
index 2a4ff5d64288..907588f1a5b7 100644
@@ -114,8 +114,8 @@ void devm_iounmap(struct device *dev, void __iomem *addr)
 EXPORT_SYMBOL(devm_iounmap);
 
 static void __iomem *
-__devm_ioremap_resource(struct device *dev, const struct resource *res,
-			enum devm_ioremap_type type)
+__devm_request_ioremap_resource(struct device *dev, const struct resource *res,
+				enum devm_ioremap_type type)
 {
 	resource_size_t size;
 	void __iomem *dest_ptr;
@@ -172,12 +172,12 @@ __devm_ioremap_resource(struct device *dev, const struct resource *res,
  * Return: a pointer to the remapped memory or an ERR_PTR() encoded error code
  * on failure.
  */
-void __iomem *devm_ioremap_resource(struct device *dev,
-				    const struct resource *res)
+void __iomem *devm_request_ioremap_resource(struct device *dev,
+					    const struct resource *res)
 {
-	return __devm_ioremap_resource(dev, res, DEVM_IOREMAP);
+	return __devm_request_ioremap_resource(dev, res, DEVM_IOREMAP);
 }
-EXPORT_SYMBOL(devm_ioremap_resource);
+EXPORT_SYMBOL(devm_request_ioremap_resource);
 
 /**
  * devm_ioremap_resource_wc() - write-combined variant of
@@ -188,10 +188,10 @@ EXPORT_SYMBOL(devm_ioremap_resource);
  * Return: a pointer to the remapped memory or an ERR_PTR() encoded error code
  * on failure.
  */
-void __iomem *devm_ioremap_resource_wc(struct device *dev,
-				       const struct resource *res)
+void __iomem *devm_request_ioremap_resource_wc(struct device *dev,
+					       const struct resource *res)
 {
-	return __devm_ioremap_resource(dev, res, DEVM_IOREMAP_WC);
+	return __devm_request_ioremap_resource(dev, res, DEVM_IOREMAP_WC);
 }
 
 /*
Signature · 1 line
2.28.0
#151 lore raw

[PATCH 3/2] checkpatch: document the function renaming and deprecation around devm_ioremap_resource

In reply to Uwe Kleine-König

---
Hello,

this can also be squashed into the respective patches instead.

Best regards
Uwe

 scripts/checkpatch.pl | 5 +++++
 1 file changed, 5 insertions(+)
scripts/checkpatch.pl +5 -0
index fab38b493cef..5abb87256d4c 100755
@@ -615,6 +615,11 @@ our %deprecated_apis = (
 	"rcu_barrier_sched"			=> "rcu_barrier",
 	"get_state_synchronize_sched"		=> "get_state_synchronize_rcu",
 	"cond_synchronize_sched"		=> "cond_synchronize_rcu",
+	"devm_platform_get_and_ioremap_resource" => "devm_platform_get_request_and_ioremap_resource",
+	"devm_platform_ioremap_resource"	=> "devm_platform_request_ioremap_resource",
+	"devm_platform_ioremap_resource_wc"	=> "devm_platform_request_ioremap_resource_wc",
+	"devm_ioremap_resource"			=> "devm_request_ioremap_resource",
+	"devm_ioremap_resource_wc"		=> "devm_request_ioremap_resource_wc",
 );
 
 #Create a search pattern for all these strings to speed up a loop below
Signature · 1 line
2.28.0
#157 lore raw

Re: About devm_platform_ioremap_resource [Was: Re: [PATCH 01/32] pwm: sun4i: convert to devm_platform_ioremap_resource]

In reply to Uwe Kleine-König
Quoted 30 lines · Uwe Kleine-König

Hello,

[Added lkml and the people involved in commit 7945f929f1a7 ("drivers: provide devm_platform_ioremap_resource()") to Cc:. For the new readers: This is about patches making use of devm_platform_ioremap_resource() instead of open coding it. Full context at https://lore.kernel.org/r/20201112190649.GA908613@ulmo]

Quoted 8 lines · Uwe Kleine-König
Quoted 5 lines · Thierry Reding

I also think that it's overly narrow is scope, so you can't actually "blindly" use this helper and I've seen quite a few cases where this was unknowingly used for cases where it shouldn't have been used and then broke things (because some drivers must not do the request_mem_region() for example).

You have a link to such an accident?

I got a hint in private here: https://lore.kernel.org/r/[email protected]

devm_platform_ioremap_resource() is platform_get_resource() + devm_ioremap_resource() and here it was used to replace platform_get_resource() + devm_ioremap().

IMHO the unlucky thing in this situation is that devm_ioremap_resource() and devm_ioremap() are different by more than just how they get the area to remap. (i.e. devm_ioremap_resource() also does devm_request_mem_region().)

Quoted 5 lines

So the problem is not the added wrapper, but unclear semantics in the functions it uses. In my eyes devm_ioremap() and devm_platform_ioremap_resource() should better be named devm_request_ioremap() and devm_platform_request_ioremap_resource() respectively. Is it worth to rename these for clearity?

But devm_ioremap() doesn't request the region. Did you mean devm_ioremap_resource() should become devm_request_ioremap_resource()?

Bartosz

#158 lore raw

Re: About devm_platform_ioremap_resource [Was: Re: [PATCH 01/32] pwm: sun4i: convert to devm_platform_ioremap_resource]

Quoted 32 lines · Bartosz Golaszewski
Quoted 30 lines · Uwe Kleine-König

Hello,

[Added lkml and the people involved in commit 7945f929f1a7 ("drivers: provide devm_platform_ioremap_resource()") to Cc:. For the new readers: This is about patches making use of devm_platform_ioremap_resource() instead of open coding it. Full context at https://lore.kernel.org/r/20201112190649.GA908613@ulmo]

Quoted 8 lines · Uwe Kleine-König
Quoted 5 lines · Thierry Reding

I also think that it's overly narrow is scope, so you can't actually "blindly" use this helper and I've seen quite a few cases where this was unknowingly used for cases where it shouldn't have been used and then broke things (because some drivers must not do the request_mem_region() for example).

You have a link to such an accident?

I got a hint in private here: https://lore.kernel.org/r/[email protected]

devm_platform_ioremap_resource() is platform_get_resource() + devm_ioremap_resource() and here it was used to replace platform_get_resource() + devm_ioremap().

IMHO the unlucky thing in this situation is that devm_ioremap_resource() and devm_ioremap() are different by more than just how they get the area to remap. (i.e. devm_ioremap_resource() also does devm_request_mem_region().)

Quoted 8 lines
Quoted 5 lines

So the problem is not the added wrapper, but unclear semantics in the functions it uses. In my eyes devm_ioremap() and devm_platform_ioremap_resource() should better be named devm_request_ioremap() and devm_platform_request_ioremap_resource() respectively. Is it worth to rename these for clearity?

But devm_ioremap() doesn't request the region. Did you mean devm_ioremap_resource() should become devm_request_ioremap_resource()?

Yes indeed. The last paragraph should be:

So the problem is not the added wrapper, but unclear semantics in the functions it uses. In my eyes devm_ioremap_resource() and devm_platform_ioremap_resource() should better be named devm_request_ioremap_resource() and devm_platform_request_ioremap_resource().

(Note that I created a patch series that implements this suggestion, but
you were not on Cc: as I extensively trimmed the recipents assuming most
people are not interested. See https://lore.kernel.org/r/[email protected])

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
#152 lore raw

Re: [PATCH 3/2] checkpatch: document the function renaming and deprecation around devm_ioremap_resource

In reply to Uwe Kleine-König
Quoted 5 lines · Uwe Kleine-König

---
Hello,

this can also be squashed into the respective patches instead.

Hm, how? Please just resend the series, or just provide a changelog text for this patch and I'll be glad to take it that way.

thanks,

greg k-h

#156 lore raw

Re: [PATCH 0/2] Rename ioremap functions that include request_mem

In reply to Uwe Kleine-König
Quoted 14 lines · Uwe Kleine-König

Hello,

here comes a patch set that implements the suggestion in the previous mail so we have something to discuss about.

Best regards
Uwe

Uwe Kleine-König (2):
base: Rename devm_ioremap_resource to make the implicit request_mem
explicit
platform: Rename devm_platform_ioremap_resource to make the implicit
request_mem explicit

Quoted 6 lines
 .../driver-api/driver-model/devres.rst        |  6 +--
 drivers/base/platform.c                       | 26 +++++------
 include/linux/device.h                        | 32 ++++++++++++--
 include/linux/platform_device.h               | 43 +++++++++++++++++--
 lib/devres.c                                  | 18 ++++----
 5 files changed, 93 insertions(+), 32 deletions(-)

To be honest, this is getting a bit eccentric for my taste. Yes, devm_ioremap_resource() does more than just devm_ioremap(), but that's why it's called devm_ioremap_resource(). It's a compromise between the new functionality and practical symbol length.

The kerneldoc for devm_ioremap_resource() is very explicit about what it does, so I think it's fine to omit some of the details from the symbol name for the sake of brevity.

Things get out of hand pretty quickly if we start incorporating every single aspect of what a function does into its name.

Thierry

#159 lore raw

Re: About devm_platform_ioremap_resource [Was: Re: [PATCH 01/32] pwm: sun4i: convert to devm_platform_ioremap_resource]

In reply to Uwe Kleine-König
Quoted 24 lines · Uwe Kleine-König

Hello,

[Added lkml and the people involved in commit 7945f929f1a7 ("drivers: provide devm_platform_ioremap_resource()") to Cc:. For the new readers: This is about patches making use of devm_platform_ioremap_resource() instead of open coding it. Full context at https://lore.kernel.org/r/20201112190649.GA908613@ulmo]

Quoted 8 lines · Uwe Kleine-König
Quoted 5 lines · Thierry Reding

I also think that it's overly narrow is scope, so you can't actually "blindly" use this helper and I've seen quite a few cases where this was unknowingly used for cases where it shouldn't have been used and then broke things (because some drivers must not do the request_mem_region() for example).

You have a link to such an accident?

I got a hint in private here: https://lore.kernel.org/r/[email protected]

devm_platform_ioremap_resource() is platform_get_resource() + devm_ioremap_resource() and here it was used to replace platform_get_resource() + devm_ioremap().

Quoted 7 lines

IMHO the unlucky thing in this situation is that devm_ioremap_resource() and devm_ioremap() are different by more than just how they get the area to remap. (i.e. devm_ioremap_resource() also does devm_request_mem_region().)

So the problem is not the added wrapper, but unclear semantics in the functions it uses.

The semantics aren't unclear. It's just that the symbol name doesn't spell out every detail that the function implements, which, frankly, no function name ever does, at least not for anything beyond simple instructional examples. That's what we have documentation for and why people should read the documentation before they use a function and make (potentially wrong) assumption about what it does.

Quoted 4 lines

In my eyes devm_ioremap() and
devm_platform_ioremap_resource() should better be named devm_request_ioremap() and devm_platform_request_ioremap_resource() respectively. Is it worth to rename these for clearity?

I think function names are always a compromise between giving you the gist of what the implementation does and being short enough so it doesn't become difficult to read or use.

One of the reasons why I dislike the addition of helpers for every common special case (like devm_platform_ioremap_resource()) is because it doesn't (always) actually make things easier for developers and/or maintainers. Replacing three lines of code with one is a minor improvement, even though there may be many callsites and therefore in the sum this being a fairly sizeable reduction. The flip side is that now we've got an extra symbol with an unwieldy name that people need to become familiar with, and then, like the link above shows, it doesn't work in all cases, so you either need to fall back to the open-coded version or you keep adding helpers until you've covered all cases. And then we end up with a bunch of helpers that you actually have to go and read the documentation for in order to find out which one exactly fits your use-case.

Without the helpers it's pretty simple to write, even if a little repetitive:

1) get the resource you want to map
2) request the resource
3) map the resource

2) & 3) are very commonly done together, so it makes sense to have a generic helper for them. If you look at the implementation, the devm_ioremap_request() implementation does quite a bit of things in addition to just requesting and remapping, and that's the reason why that helper makes sense.

For me personally, devm_platform_ioremap_resource() is just not adding enough value to justify its existence. And then we get all these other variants that operate on the resource name (_byname) and those which remap write-combined (_wc). But don't we also need a _byname_wc() variant for the combination? Where does it stop?

Thierry

maintainer
#153 lore raw

Re: [PATCH 3/2] checkpatch: document the function renaming and deprecation around devm_ioremap_resource

In reply to Uwe Kleine-König

scripts/checkpatch.pl

Quoted 13 lines · Uwe Kleine-König

---
Hello,

this can also be squashed into the respective patches instead.

Best regards
Uwe

 scripts/checkpatch.pl | 5 +++++

 1 file changed, 5 insertions(+)
scripts/checkpatch.pl +0 -0

[]

scripts/checkpatch.pl our %deprecated_apis = ( · line 618

Quoted 5 lines
scripts/checkpatch.pl +1 -0
@@ -615,6 +615,11 @@ our %deprecated_apis = (
  	"rcu_barrier_sched"			=> "rcu_barrier",
  	"get_state_synchronize_sched"		=> "get_state_synchronize_rcu",
  	"cond_synchronize_sched"		=> "cond_synchronize_rcu",
+	"devm_platform_get_and_ioremap_resource" => "devm_platform_get_request_and_ioremap_resource",

Do we really need 46 character length function names?

Quoted 8 lines
scripts/checkpatch.pl +4 -0
+	"devm_platform_ioremap_resource"	=> "devm_platform_request_ioremap_resource",
+	"devm_platform_ioremap_resource_wc"	=> "devm_platform_request_ioremap_resource_wc",
+	"devm_ioremap_resource"			=> "devm_request_ioremap_resource",
+	"devm_ioremap_resource_wc"		=> "devm_request_ioremap_resource_wc",
  );

 #Create a search pattern for all these strings to speed up a loop below

And do please send your proposed patches to the appropriate maintainers.

#154 lore raw

Re: [PATCH 3/2] checkpatch: document the function renaming and deprecation around devm_ioremap_resource

Quoted 15 lines · Joe Perches

scripts/checkpatch.pl

Quoted 13 lines · Uwe Kleine-König

---
Hello,

this can also be squashed into the respective patches instead.

Best regards
Uwe

 scripts/checkpatch.pl | 5 +++++

 1 file changed, 5 insertions(+)
scripts/checkpatch.pl +0 -0

[]

Quoted 7 lines

scripts/checkpatch.pl our %deprecated_apis = ( · line 618

Quoted 5 lines
scripts/checkpatch.pl +1 -0
@@ -615,6 +615,11 @@ our %deprecated_apis = (
  	"rcu_barrier_sched"			=> "rcu_barrier",
  	"get_state_synchronize_sched"		=> "get_state_synchronize_rcu",
  	"cond_synchronize_sched"		=> "cond_synchronize_rcu",
+	"devm_platform_get_and_ioremap_resource" => "devm_platform_get_request_and_ioremap_resource",

Do we really need 46 character length function names?

I can drop the "_and" and maybe "_get", so we're down to 38 "only". Other than that I think all name parts are relevant.

Quoted 10 lines
Quoted 8 lines
scripts/checkpatch.pl +4 -0
+	"devm_platform_ioremap_resource"	=> "devm_platform_request_ioremap_resource",
+	"devm_platform_ioremap_resource_wc"	=> "devm_platform_request_ioremap_resource_wc",
+	"devm_ioremap_resource"			=> "devm_request_ioremap_resource",
+	"devm_ioremap_resource_wc"		=> "devm_request_ioremap_resource_wc",
  );

 #Create a search pattern for all these strings to speed up a loop below

And do please send your proposed patches to the appropriate maintainers.

Yes, sure. This patch 3/2 was only a quick shot and it was already clear to me that I have to redo it. I want to squash this change in the patch that does the actual renaming, I assume that's fine for you?!

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
maintainer
#155 lore raw

Re: [PATCH 3/2] checkpatch: document the function renaming and deprecation around devm_ioremap_resource

Quoted 34 lines · Uwe Kleine-König
Quoted 15 lines · Joe Perches

scripts/checkpatch.pl

Quoted 13 lines · Uwe Kleine-König

---
Hello,

this can also be squashed into the respective patches instead.

Best regards
Uwe

 scripts/checkpatch.pl | 5 +++++

 1 file changed, 5 insertions(+)
scripts/checkpatch.pl +0 -0

[]

Quoted 7 lines

scripts/checkpatch.pl our %deprecated_apis = ( · line 618

Quoted 5 lines
scripts/checkpatch.pl +1 -0
@@ -615,6 +615,11 @@ our %deprecated_apis = (
  	"rcu_barrier_sched"			=> "rcu_barrier",
  	"get_state_synchronize_sched"		=> "get_state_synchronize_rcu",
  	"cond_synchronize_sched"		=> "cond_synchronize_rcu",
+	"devm_platform_get_and_ioremap_resource" => "devm_platform_get_request_and_ioremap_resource",

Do we really need 46 character length function names?

I can drop the "_and" and maybe "_get", so we're down to 38 "only". Other than that I think all name parts are relevant.

Quoted 7 lines
Quoted 7 lines
scripts/checkpatch.pl +4 -0
+	"devm_platform_ioremap_resource"	=> "devm_platform_request_ioremap_resource",
+	"devm_platform_ioremap_resource_wc"	=> "devm_platform_request_ioremap_resource_wc",
+	"devm_ioremap_resource"			=> "devm_request_ioremap_resource",
+	"devm_ioremap_resource_wc"		=> "devm_request_ioremap_resource_wc",
  );

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

 #Create a search pattern for all these strings to speed up a loop below

And do please send your proposed patches to the appropriate maintainers.

Yes, sure. This patch 3/2 was only a quick shot and it was already clear to me that I have to redo it. I want to squash this change in the patch that does the actual renaming, I assume that's fine for you?!

Sure.

But please do take Thierry Reding's comment about overall API complexity into account.

All wrapper macro/functions aren't always obviously good.

They can be useful, but can make knowing which of many possible wrappers to use and when to use them appropriately difficult.

Wrappers also add complexity to documentation.

#160 lore raw

Re: About devm_platform_ioremap_resource [Was: Re: [PATCH 01/32] pwm: sun4i: convert to devm_platform_ioremap_resource]

In reply to Thierry Reding
Quoted 76 lines · Thierry Reding
Quoted 24 lines · Uwe Kleine-König

Hello,

[Added lkml and the people involved in commit 7945f929f1a7 ("drivers: provide devm_platform_ioremap_resource()") to Cc:. For the new readers: This is about patches making use of devm_platform_ioremap_resource() instead of open coding it. Full context at https://lore.kernel.org/r/20201112190649.GA908613@ulmo]

Quoted 8 lines · Uwe Kleine-König
Quoted 5 lines · Thierry Reding

I also think that it's overly narrow is scope, so you can't actually "blindly" use this helper and I've seen quite a few cases where this was unknowingly used for cases where it shouldn't have been used and then broke things (because some drivers must not do the request_mem_region() for example).

You have a link to such an accident?

I got a hint in private here: https://lore.kernel.org/r/[email protected]

devm_platform_ioremap_resource() is platform_get_resource() + devm_ioremap_resource() and here it was used to replace platform_get_resource() + devm_ioremap().

Quoted 7 lines

IMHO the unlucky thing in this situation is that devm_ioremap_resource() and devm_ioremap() are different by more than just how they get the area to remap. (i.e. devm_ioremap_resource() also does devm_request_mem_region().)

So the problem is not the added wrapper, but unclear semantics in the functions it uses.

The semantics aren't unclear. It's just that the symbol name doesn't spell out every detail that the function implements, which, frankly, no function name ever does, at least not for anything beyond simple instructional examples. That's what we have documentation for and why people should read the documentation before they use a function and make (potentially wrong) assumption about what it does.

Quoted 4 lines

In my eyes devm_ioremap() and
devm_platform_ioremap_resource() should better be named devm_request_ioremap() and devm_platform_request_ioremap_resource() respectively. Is it worth to rename these for clearity?

I think function names are always a compromise between giving you the gist of what the implementation does and being short enough so it doesn't become difficult to read or use.

One of the reasons why I dislike the addition of helpers for every common special case (like devm_platform_ioremap_resource()) is because it doesn't (always) actually make things easier for developers and/or maintainers. Replacing three lines of code with one is a minor improvement, even though there may be many callsites and therefore in the sum this being a fairly sizeable reduction. The flip side is that now we've got an extra symbol with an unwieldy name that people need to become familiar with, and then, like the link above shows, it doesn't work in all cases, so you either need to fall back to the open-coded version or you keep adding helpers until you've covered all cases. And then we end up with a bunch of helpers that you actually have to go and read the documentation for in order to find out which one exactly fits your use-case.

Without the helpers it's pretty simple to write, even if a little repetitive:

1) get the resource you want to map
2) request the resource
3) map the resource

2) & 3) are very commonly done together, so it makes sense to have a generic helper for them. If you look at the implementation, the devm_ioremap_request() implementation does quite a bit of things in addition to just requesting and remapping, and that's the reason why that helper makes sense.

Quoted 5 lines

For me personally, devm_platform_ioremap_resource() is just not adding enough value to justify its existence. And then we get all these other variants that operate on the resource name (_byname) and those which remap write-combined (_wc). But don't we also need a _byname_wc() variant for the combination? Where does it stop?

Arguably the worst thing about devm_platform_ioremap_resource() is that it was apparently the gateway drug to a belief that devm_platform_get_and_ioremap_resource() is anything other than a hideous way to obfuscate an assignment...

Robin.

#161 lore raw

Re: About devm_platform_ioremap_resource [Was: Re: [PATCH 01/32] pwm: sun4i: convert to devm_platform_ioremap_resource]

In reply to Thierry Reding

Hello,

Quoted 3 lines · Thierry Reding

I think function names are always a compromise between giving you the gist of what the implementation does and being short enough so it doesn't become difficult to read or use.

Right. In my eyes if you have

- devm_platform_ioremap_resource
- devm_platform_get_and_ioremap_resource
- devm_ioremap_resource
- devm_ioremap

(to list just a few) with the current semantics, the compromise is badly shifted into the "short name" direction however; and that was the motivation for this patch set. In my eyes it must be more obvious which of these functions include devm_request_mem_region() and which don't.

And note, my patch series doesn't introduce new helpers, just renames them to have a better name (and adds compat glue for the old names).

Quoted 5 lines

One of the reasons why I dislike the addition of helpers for every common special case (like devm_platform_ioremap_resource()) is because it doesn't (always) actually make things easier for developers and/or maintainers. Replacing three lines of code with one is a minor improvement, even though there may be many callsites and therefore in

Quoted 8 lines

the sum this being a fairly sizeable reduction. The flip side is that now we've got an extra symbol with an unwieldy name that people need to become familiar with, and then, like the link above shows, it doesn't work in all cases, so you either need to fall back to the open-coded version or you keep adding helpers until you've covered all cases. And then we end up with a bunch of helpers that you actually have to go and read the documentation for in order to find out which one exactly fits your use-case.

This is indeed a relevant point. An alternative is to make the helper more flexible. This complicates the API, too, however, so this isn't always gold, either.

Quoted 13 lines

Without the helpers it's pretty simple to write, even if a little repetitive:

1) get the resource you want to map
2) request the resource
3) map the resource

2) & 3) are very commonly done together, so it makes sense to have a generic helper for them. If you look at the implementation, the devm_ioremap_request() implementation does quite a bit of things in addition to just requesting and remapping, and that's the reason why that helper makes sense.

Quoted 5 lines

For me personally, devm_platform_ioremap_resource() is just not adding enough value to justify its existence. And then we get all these other variants that operate on the resource name (_byname) and those which remap write-combined (_wc). But don't we also need a _byname_wc() variant for the combination? Where does it stop?

I'm on your side for the _wc stuff, looking at next-20201119:

- devm_ioremap_resource_wc has a single user:
devm_platform_ioremap_resource_wc
- devm_platform_ioremap_resource_wc has a single user:
drivers/misc/sram.c

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |