Skip to contentSkip to conversation

drivers: new helper for ioremapping memory resources

PATCH Superseded Dejin Zheng 5 participants 18 messages Mar 15, 2020 – Mar 23, 2020

Subsystems (4)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover drivers: new helper for ioremapping memory resources

Since commit "drivers: provide devm_platform_ioremap_resource()", It was wrap platform_get_resource() and devm_ioremap_resource() as single helper devm_platform_ioremap_resource(). but now, many drivers still used platform_get_resource() and devm_ioremap_resource() together in the kernel tree. The reason can not be replaced is they still need use the resource variables obtained by platform_get_resource(). so provide this helper.

The first patch in this series adds a wrapper for these two calls and the other uses it in a driver.

v2 -> v3:
- rename the function to devm_platform_get_and_ioremap_resource() by Sergei's suggestion.
- make the last parameter res as optional by Geert's suggestion.
- Reimplement devm_platform_ioremap_resource by calling devm_platform_get_and_ioremap_resource() by Geert's suggestion.

v1 -> v2:
- add some real users of this function (Thanks for greg k-h's reminder)

Dejin Zheng (5):
drivers: provide devm_platform_get_and_ioremap_resource()
usb: host: xhci-plat: convert to
devm_platform_get_and_ioremap_resource
usb: host: hisilicon: convert to
devm_platform_get_and_ioremap_resource
usb: dwc2: convert to devm_platform_get_and_ioremap_resource driver core: platform: Reimplement devm_platform_ioremap_resource

 drivers/base/platform.c         | 27 +++++++++++++++++++++++----
 drivers/usb/dwc2/platform.c     |  3 +--
 drivers/usb/host/xhci-histb.c   |  3 +--
 drivers/usb/host/xhci-plat.c    |  3 +--
 include/linux/platform_device.h |  3 +++
 5 files changed, 29 insertions(+), 10 deletions(-)
Signature · 1 line
2.25.0
#1 lore raw

PATCH v3 1/5 drivers: provide devm_platform_get_and_ioremap_resource()

Since commit "drivers: provide devm_platform_ioremap_resource()", it was wrap platform_get_resource() and devm_ioremap_resource() as single helper devm_platform_ioremap_resource(). but now, many drivers still used platform_get_resource() and devm_ioremap_resource() together in the kernel tree. The reason can not be replaced is they still need use the resource variables obtained by platform_get_resource(). so provide this helper.

---
v2 -> v3:
- rename the function to devm_platform_get_and_ioremap_resource() by Sergei's suggestion.
- make the last parameter res as optional by Geert's suggestion.

v1 -> v2:
- No change.

 drivers/base/platform.c         | 22 ++++++++++++++++++++++
 include/linux/platform_device.h |  3 +++
 2 files changed, 25 insertions(+)
drivers/base/platform.c +22 -0
index 7fa654f1288b..9f6a78f79235 100644
@@ -62,6 +62,28 @@ struct resource *platform_get_resource(struct platform_device *dev,
 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
+ *
+ * @pdev: platform device to use both for memory resource lookup as well as
+ *        resource management
+ * @index: resource index
+ * @res: get the resource
+ */
+void __iomem *
+devm_platform_get_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);
+}
+EXPORT_SYMBOL_GPL(devm_platform_get_and_ioremap_resource);
+
 /**
  * devm_platform_ioremap_resource - call devm_ioremap_resource() for a platform
  *				    device
include/linux/platform_device.h +3 -0
index 8e83c6ff140d..8aa6b448450f 100644
@@ -55,6 +55,9 @@ extern struct device *
 platform_find_device_by_driver(struct device *start,
 			       const struct device_driver *drv);
 extern void __iomem *
+devm_platform_get_and_ioremap_resource(struct platform_device *pdev,
+				unsigned int index, struct resource **res);
+extern void __iomem *
 devm_platform_ioremap_resource(struct platform_device *pdev,
 			       unsigned int index);
 extern void __iomem *
Signature · 1 line
2.25.0
maintainer
#2 lore raw

Re: [PATCH v3 1/5] drivers: provide devm_platform_get_and_ioremap_resource()

Quoted 40 lines · Dejin Zheng

Since commit "drivers: provide devm_platform_ioremap_resource()", it was wrap platform_get_resource() and devm_ioremap_resource() as single helper devm_platform_ioremap_resource(). but now, many drivers still used platform_get_resource() and devm_ioremap_resource() together in the kernel tree. The reason can not be replaced is they still need use the resource variables obtained by platform_get_resource(). so provide this helper.

---
v2 -> v3:
- rename the function to devm_platform_get_and_ioremap_resource() by Sergei's suggestion.
- make the last parameter res as optional by Geert's suggestion.

v1 -> v2:
- No change.

 drivers/base/platform.c         | 22 ++++++++++++++++++++++
 include/linux/platform_device.h |  3 +++
 2 files changed, 25 insertions(+)
drivers/base/platform.c +8 -0
index 7fa654f1288b..9f6a78f79235 100644
@@ -62,6 +62,28 @@ struct resource *platform_get_resource(struct platform_device *dev,
 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
+ *
+ * @pdev: platform device to use both for memory resource lookup as well as
+ *        resource management
+ * @index: resource index
+ * @res: get the resource

drivers/base/platform.c struct resource *platform_get_resource(struct platform_device *dev, · line 82

Quoted 10 lines
drivers/base/platform.c +10 -0
+ */
+void __iomem *
+devm_platform_get_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;

What happens if that call fails? Shouldn't that be checked?

thanks,

greg k-h

#3 lore raw

Re: [PATCH v3 1/5] drivers: provide devm_platform_get_and_ioremap_resource()

Hi Greg,

Quoted 45 lines · Greg KH
Quoted 44 lines · Dejin Zheng

Since commit "drivers: provide devm_platform_ioremap_resource()", it was wrap platform_get_resource() and devm_ioremap_resource() as single helper devm_platform_ioremap_resource(). but now, many drivers still used platform_get_resource() and devm_ioremap_resource() together in the kernel tree. The reason can not be replaced is they still need use the resource variables obtained by platform_get_resource(). so provide this helper.

---
v2 -> v3:
- rename the function to devm_platform_get_and_ioremap_resource() by Sergei's suggestion.
- make the last parameter res as optional by Geert's suggestion.

v1 -> v2:
- No change.

 drivers/base/platform.c         | 22 ++++++++++++++++++++++
 include/linux/platform_device.h |  3 +++
 2 files changed, 25 insertions(+)
drivers/base/platform.c +12 -0
index 7fa654f1288b..9f6a78f79235 100644
@@ -62,6 +62,28 @@ struct resource *platform_get_resource(struct platform_device *dev,
 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
+ *
+ * @pdev: platform device to use both for memory resource lookup as well as
+ *        resource management
+ * @index: resource index
+ * @res: get the resource
+ */
+void __iomem *
+devm_platform_get_and_ioremap_resource(struct platform_device *pdev,
+                             unsigned int index, struct resource **res)
Quoted 8 lines

drivers/base/platform.c struct resource *platform_get_resource(struct platform_device *dev, · line 82

Quoted 6 lines
drivers/base/platform.c +6 -0
+{
+     struct resource *r;
+
+     r = platform_get_resource(pdev, IORESOURCE_MEM, index);
+     if (res)
+             *res = r;

What happens if that call fails? Shouldn't that be checked?

Then devm_ioremap_resource() will print an error message, and return an error.
It's designed to be pipelined that way, so you have to check for an error only once.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
maintainer
#4 lore raw

Re: [PATCH v3 1/5] drivers: provide devm_platform_get_and_ioremap_resource()

Quoted 57 lines · Geert Uytterhoeven

Hi Greg,

Quoted 45 lines · Greg KH
Quoted 44 lines · Dejin Zheng

Since commit "drivers: provide devm_platform_ioremap_resource()", it was wrap platform_get_resource() and devm_ioremap_resource() as single helper devm_platform_ioremap_resource(). but now, many drivers still used platform_get_resource() and devm_ioremap_resource() together in the kernel tree. The reason can not be replaced is they still need use the resource variables obtained by platform_get_resource(). so provide this helper.

---
v2 -> v3:
- rename the function to devm_platform_get_and_ioremap_resource() by Sergei's suggestion.
- make the last parameter res as optional by Geert's suggestion.

v1 -> v2:
- No change.

 drivers/base/platform.c         | 22 ++++++++++++++++++++++
 include/linux/platform_device.h |  3 +++
 2 files changed, 25 insertions(+)
drivers/base/platform.c +12 -0
index 7fa654f1288b..9f6a78f79235 100644
@@ -62,6 +62,28 @@ struct resource *platform_get_resource(struct platform_device *dev,
 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
+ *
+ * @pdev: platform device to use both for memory resource lookup as well as
+ *        resource management
+ * @index: resource index
+ * @res: get the resource
+ */
+void __iomem *
+devm_platform_get_and_ioremap_resource(struct platform_device *pdev,
+                             unsigned int index, struct resource **res)
Quoted 8 lines

drivers/base/platform.c struct resource *platform_get_resource(struct platform_device *dev, · line 82

Quoted 6 lines
drivers/base/platform.c +6 -0
+{
+     struct resource *r;
+
+     r = platform_get_resource(pdev, IORESOURCE_MEM, index);
+     if (res)
+             *res = r;

What happens if that call fails? Shouldn't that be checked?

Quoted 4 lines

Then devm_ioremap_resource() will print an error message, and return an error.
It's designed to be pipelined that way, so you have to check for an error only once.

Ok, thanks. Can I get an ack/reviewed-by for this series then?

thanks,

greg k-h

#5 lore raw

Re: [PATCH v3 1/5] drivers: provide devm_platform_get_and_ioremap_resource()

Quoted 63 lines · Greg KH
Quoted 57 lines · Geert Uytterhoeven

Hi Greg,

Quoted 45 lines · Greg KH
Quoted 44 lines · Dejin Zheng

Since commit "drivers: provide devm_platform_ioremap_resource()", it was wrap platform_get_resource() and devm_ioremap_resource() as single helper devm_platform_ioremap_resource(). but now, many drivers still used platform_get_resource() and devm_ioremap_resource() together in the kernel tree. The reason can not be replaced is they still need use the resource variables obtained by platform_get_resource(). so provide this helper.

---
v2 -> v3:
- rename the function to devm_platform_get_and_ioremap_resource() by Sergei's suggestion.
- make the last parameter res as optional by Geert's suggestion.

v1 -> v2:
- No change.

 drivers/base/platform.c         | 22 ++++++++++++++++++++++
 include/linux/platform_device.h |  3 +++
 2 files changed, 25 insertions(+)
drivers/base/platform.c +12 -0
index 7fa654f1288b..9f6a78f79235 100644
@@ -62,6 +62,28 @@ struct resource *platform_get_resource(struct platform_device *dev,
 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
+ *
+ * @pdev: platform device to use both for memory resource lookup as well as
+ *        resource management
+ * @index: resource index
+ * @res: get the resource
+ */
+void __iomem *
+devm_platform_get_and_ioremap_resource(struct platform_device *pdev,
+                             unsigned int index, struct resource **res)
Quoted 8 lines

drivers/base/platform.c struct resource *platform_get_resource(struct platform_device *dev, · line 82

Quoted 6 lines
drivers/base/platform.c +6 -0
+{
+     struct resource *r;
+
+     r = platform_get_resource(pdev, IORESOURCE_MEM, index);
+     if (res)
+             *res = r;

What happens if that call fails? Shouldn't that be checked?

Quoted 4 lines

Then devm_ioremap_resource() will print an error message, and return an error.
It's designed to be pipelined that way, so you have to check for an error only once.

Quoted 5 lines

Ok, thanks. Can I get an ack/reviewed-by for this series then?

thanks,

greg k-h

Hi Geert:

Could you help me review these patches if you have free time? Your comments and suggestions will be of great help to me. It is important to me and thanks again for your help.

Hi Greg, Mathias and Minas:

Thank you very much for taking your time to help me review my code.

BR,
Dejin

Reviewed-by on v3 1/5
#6 lore raw

Re: [PATCH v3 1/5] drivers: provide devm_platform_get_and_ioremap_resource()

In reply to Dejin Zheng

Hi Dejin,

Quoted 11 lines · Dejin Zheng

Since commit "drivers: provide devm_platform_ioremap_resource()", it was wrap platform_get_resource() and devm_ioremap_resource() as single helper devm_platform_ioremap_resource(). but now, many drivers still used platform_get_resource() and devm_ioremap_resource() together in the kernel tree. The reason can not be replaced is they still need use the resource variables obtained by platform_get_resource(). so provide this helper.

Thanks for your patch!

Quoted 4 lines
drivers/base/platform.c +0 -0
@@ -62,6 +62,28 @@ struct resource *platform_get_resource(struct platform_device *dev,
 EXPORT_SYMBOL_GPL(platform_get_resource);

drivers/base/platform.c struct resource *platform_get_resource(struct platform_device *dev, · line 72

Quoted 10 lines
drivers/base/platform.c +8 -0
 
 #ifdef CONFIG_HAS_IOMEM
+/**
+ * devm_platform_get_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
+ * @index: resource index
+ * @res: get the resource

Optional output parameter to store a pointer to the obtained resource.

With the above changed:

drivers/base/platform.c struct resource *platform_get_resource(struct platform_device *dev, · line 85

Quoted 13 lines
drivers/base/platform.c +13 -0
+ */
+void __iomem *
+devm_platform_get_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);
+}
+EXPORT_SYMBOL_GPL(devm_platform_get_and_ioremap_resource);

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#7 lore raw

PATCH v3 2/5 usb: host: xhci-plat: convert to devm_platform_get_and_ioremap_resource

In reply to Dejin Zheng

Use devm_platform_get_and_ioremap_resource() to simplify code, which contains platform_get_resource() and devm_ioremap_resource(), it also get the resource for use by the following code.

---
v2 -> v3:
- call the rename function devm_platform_get_and_ioremap_resource()

v1 -> v2:
- add this patch for add some real users of this function.

 drivers/usb/host/xhci-plat.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/host/xhci-plat.c +1 -2
index d90cd5ec09cf..dcc0bfe04c43 100644
@@ -219,8 +219,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
 		goto disable_runtime;
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	hcd->regs = devm_ioremap_resource(&pdev->dev, res);
+	hcd->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
 	if (IS_ERR(hcd->regs)) {
 		ret = PTR_ERR(hcd->regs);
 		goto put_hcd;
Signature · 1 line
2.25.0
Acked-by on v3 2/5
#8 lore raw

Re: [PATCH v3 2/5] usb: host: xhci-plat: convert to devm_platform_get_and_ioremap_resource

Quoted 5 lines · Dejin Zheng

Use devm_platform_get_and_ioremap_resource() to simplify code, which contains platform_get_resource() and devm_ioremap_resource(), it also get the resource for use by the following code.

Reviewed-by on v3 2/5
#9 lore raw

Re: [PATCH v3 2/5] usb: host: xhci-plat: convert to devm_platform_get_and_ioremap_resource

In reply to Dejin Zheng
Quoted 5 lines · Dejin Zheng

Use devm_platform_get_and_ioremap_resource() to simplify code, which contains platform_get_resource() and devm_ioremap_resource(), it also get the resource for use by the following code.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#10 lore raw

PATCH v3 3/5 usb: host: hisilicon: convert to devm_platform_get_and_ioremap_resource

In reply to Dejin Zheng

Use devm_platform_get_and_ioremap_resource() to simplify code, which contains platform_get_resource() and devm_ioremap_resource(), it also get the resource for use by the following code.

---
v2 -> v3:
- call the rename function devm_platform_get_and_ioremap_resource()

v1 -> v2:
- add this patch for add some real users of this function.

 drivers/usb/host/xhci-histb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/host/xhci-histb.c +1 -2
index 3c4abb5a1c3f..5546e7e013a8 100644
@@ -219,8 +219,7 @@ static int xhci_histb_probe(struct platform_device *pdev)
 	if (irq < 0)
 		return irq;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	histb->ctrl = devm_ioremap_resource(&pdev->dev, res);
+	histb->ctrl = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
 	if (IS_ERR(histb->ctrl))
 		return PTR_ERR(histb->ctrl);
 
Signature · 1 line
2.25.0
Acked-by on v3 3/5
#11 lore raw

Re: [PATCH v3 3/5] usb: host: hisilicon: convert to devm_platform_get_and_ioremap_resource

Quoted 6 lines · Dejin Zheng

Use devm_platform_get_and_ioremap_resource() to simplify code, which contains platform_get_resource() and devm_ioremap_resource(), it also get the resource for use by the following code.

---

Reviewed-by on v3 3/5
#12 lore raw

Re: [PATCH v3 3/5] usb: host: hisilicon: convert to devm_platform_get_and_ioremap_resource

In reply to Dejin Zheng
Quoted 5 lines · Dejin Zheng

Use devm_platform_get_and_ioremap_resource() to simplify code, which contains platform_get_resource() and devm_ioremap_resource(), it also get the resource for use by the following code.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#13 lore raw

PATCH v3 4/5 usb: dwc2: convert to devm_platform_get_and_ioremap_resource

In reply to Dejin Zheng

Use devm_platform_get_and_ioremap_resource() to simplify code, which contains platform_get_resource() and devm_ioremap_resource(), it also get the resource for use by the following code.

---
v2 -> v3:
- call the rename function devm_platform_get_and_ioremap_resource()

v1 -> v2:
- add this patch for add some real users of this function.

 drivers/usb/dwc2/platform.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/dwc2/platform.c +1 -2
index 3c6ce09a6db5..8a68e89749d2 100644
@@ -392,8 +392,7 @@ static int dwc2_driver_probe(struct platform_device *dev)
 		return retval;
 	}
 
-	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
-	hsotg->regs = devm_ioremap_resource(&dev->dev, res);
+	hsotg->regs = devm_platform_get_and_ioremap_resource(dev, 0, &res);
 	if (IS_ERR(hsotg->regs))
 		return PTR_ERR(hsotg->regs);
 
Signature · 1 line
2.25.0
Acked-by on v3 4/5
#14 lore raw

Re: [PATCH v3 4/5] usb: dwc2: convert to devm_platform_get_and_ioremap_resource

Quoted 5 lines · Dejin Zheng

Use devm_platform_get_and_ioremap_resource() to simplify code, which contains platform_get_resource() and devm_ioremap_resource(), it also get the resource for use by the following code.

Quoted 25 lines

---
v2 -> v3:
- call the rename function devm_platform_get_and_ioremap_resource()

v1 -> v2:
- add this patch for add some real users of this function.

  drivers/usb/dwc2/platform.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/dwc2/platform.c +1 -2
index 3c6ce09a6db5..8a68e89749d2 100644
@@ -392,8 +392,7 @@ static int dwc2_driver_probe(struct platform_device *dev)
  		return retval;
  	}
 
-	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
-	hsotg->regs = devm_ioremap_resource(&dev->dev, res);
+	hsotg->regs = devm_platform_get_and_ioremap_resource(dev, 0, &res);
  	if (IS_ERR(hsotg->regs))
  		return PTR_ERR(hsotg->regs);
 
Reviewed-by on v3 4/5
#15 lore raw

Re: [PATCH v3 4/5] usb: dwc2: convert to devm_platform_get_and_ioremap_resource

In reply to Dejin Zheng
Quoted 5 lines · Dejin Zheng

Use devm_platform_get_and_ioremap_resource() to simplify code, which contains platform_get_resource() and devm_ioremap_resource(), it also get the resource for use by the following code.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#16 lore raw

PATCH v3 5/5 driver core: platform: Reimplement devm_platform_ioremap_resource

In reply to Dejin Zheng

Reimplement devm_platform_ioremap_resource() by calling devm_platform_ioremap_and_get_resource() with res = NULL for simplify the code.

---
v2 -> v3:
- add this patch to simplify the code by Geert's suggestion.

 drivers/base/platform.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/base/platform.c +1 -4
index 9f6a78f79235..b83b789c8e34 100644
@@ -95,10 +95,7 @@ EXPORT_SYMBOL_GPL(devm_platform_get_and_ioremap_resource);
 void __iomem *devm_platform_ioremap_resource(struct platform_device *pdev,
 					     unsigned int index)
 {
-	struct resource *res;
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, index);
-	return devm_ioremap_resource(&pdev->dev, res);
+	return devm_platform_get_and_ioremap_resource(pdev, index, NULL);
 }
 EXPORT_SYMBOL_GPL(devm_platform_ioremap_resource);
 
Signature · 1 line
2.25.0
Reviewed-by on v3 5/5
#17 lore raw

Re: [PATCH v3 5/5] driver core: platform: Reimplement devm_platform_ioremap_resource

Quoted 2 lines · Dejin Zheng

Reimplement devm_platform_ioremap_resource() by calling devm_platform_ioremap_and_get_resource() with res = NULL for

s/for/to/

Quoted 4 lines

simplify the code.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds