Skip to contentSkip to conversation

char: xillybus: use devm_platform_ioremap_resource() to simplify code

PATCH In review YueHaibing 2 participants 2 messages Oct 16, 2019

Subsystems (2)
lore
Share & tools
lore

YueHaibing

author
#0 lore raw

PATCH 1/1 char: xillybus: use devm_platform_ioremap_resource() to simplify code

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

---
 drivers/char/xillybus/xillybus_of.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/char/xillybus/xillybus_of.c +1 -4
index bfafd8f..96b6de8 100644
@@ -116,7 +116,6 @@ static int xilly_drv_probe(struct platform_device *op)
 	struct xilly_endpoint *endpoint;
 	int rc;
 	int irq;
-	struct resource *res;
 	struct xilly_endpoint_hardware *ephw = &of_hw;
 
 	if (of_property_read_bool(dev->of_node, "dma-coherent"))
@@ -129,9 +128,7 @@ static int xilly_drv_probe(struct platform_device *op)
 
 	dev_set_drvdata(dev, endpoint);
 
-	res = platform_get_resource(op, IORESOURCE_MEM, 0);
-	endpoint->registers = devm_ioremap_resource(dev, res);
-
+	endpoint->registers = devm_platform_ioremap_resource(op, 0);
 	if (IS_ERR(endpoint->registers))
 		return PTR_ERR(endpoint->registers);
 
Signature · 1 line
2.7.4
maintainer Acked-by on v1 1/1
#1 lore raw

Hello,

Thanks for the patch.

I have to admit that this goes slightly against my instinct not to touch code that works. But I'll leave the tradeoff to people who know better than me.

Anyhow, I've verified that it compiles well, and the functional equivalence is quite obvious.

Regards,
Eli

Quoted 32 lines · YueHaibing

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

---
  drivers/char/xillybus/xillybus_of.c | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)
drivers/char/xillybus/xillybus_of.c +1 -4
index bfafd8f..96b6de8 100644
@@ -116,7 +116,6 @@ static int xilly_drv_probe(struct platform_device *op)
  	struct xilly_endpoint *endpoint;
  	int rc;
  	int irq;
-	struct resource *res;
  	struct xilly_endpoint_hardware *ephw =&of_hw;
 
  	if (of_property_read_bool(dev->of_node, "dma-coherent"))
@@ -129,9 +128,7 @@ static int xilly_drv_probe(struct platform_device *op)
 
  	dev_set_drvdata(dev, endpoint);
 
-	res = platform_get_resource(op, IORESOURCE_MEM, 0);
-	endpoint->registers = devm_ioremap_resource(dev, res);
-
+	endpoint->registers = devm_platform_ioremap_resource(op, 0);
  	if (IS_ERR(endpoint->registers))
  		return PTR_ERR(endpoint->registers);