LKML Archive on lore.kernel.org
 help / color / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Subject: [PATCH 2/2] platform: Rename devm_platform_ioremap_resource to make the implicit request_mem explicit
Date: Fri, 13 Nov 2020 09:53:27 +0100
Message-ID: <20201113085327.125041-3-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20201113085327.125041-1-u.kleine-koenig@pengutronix.de>

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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 .../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(-)

diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst
index 65f9f44d5c39..6dd5c219f11e 100644
--- a/Documentation/driver-api/driver-model/devres.rst
+++ b/Documentation/driver-api/driver-model/devres.rst
@@ -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()
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 88aef93eb4dd..5a451121a9e0 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -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);
 }
 
 /**
diff --git a/include/linux/device.h b/include/linux/device.h
index 927992549db9..3679a42f94a9 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -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)
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 77a2aada106d..87b21f8c7daa 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -55,15 +55,52 @@ extern struct resource *platform_get_resource(struct platform_device *,
 extern struct device *
 platform_find_device_by_driver(struct device *start,
 			       const struct device_driver *drv);
+
 extern void __iomem *
+devm_platform_get_request_and_ioremap_resource(struct platform_device *pdev,
+					       unsigned int index, struct resource **res);
+/*
+ * devm_platform_get_and_ioremap_resource() was the initial name chosen for
+ * devm_platform_get_request_and_ioremap_resource(). Please stick to the latter
+ * for clearer semantics.
+ */
+static inline void __iomem *
 devm_platform_get_and_ioremap_resource(struct platform_device *pdev,
-				unsigned int index, struct resource **res);
+				       unsigned int index, struct resource **res)
+{
+	return devm_platform_get_request_and_ioremap_resource(pdev, index, res);
+}
+
 extern void __iomem *
+devm_platform_request_ioremap_resource(struct platform_device *pdev,
+				       unsigned int index);
+/*
+ * devm_platform_ioremap_resource() was the initial name chosen for
+ * devm_platform_request_ioremap_resource(). Please stick to the latter for
+ * clearer semantics.
+ */
+static inline void __iomem *
 devm_platform_ioremap_resource(struct platform_device *pdev,
-			       unsigned int index);
+							  unsigned int index)
+{
+	return devm_platform_request_ioremap_resource(pdev, index);
+}
+
 extern void __iomem *
+devm_platform_request_ioremap_resource_wc(struct platform_device *pdev,
+					  unsigned int index);
+/*
+ * devm_platform_ioremap_resource_wc() was the initial name chosen for
+ * devm_platform_request_ioremap_resource_wc(). Please stick to the latter for
+ * clearer semantics.
+ */
+static inline void __iomem *
 devm_platform_ioremap_resource_wc(struct platform_device *pdev,
-				  unsigned int index);
+				  unsigned int index)
+{
+	return devm_platform_request_ioremap_resource_wc(pdev, index);
+}
+
 extern void __iomem *
 devm_platform_ioremap_resource_byname(struct platform_device *pdev,
 				      const char *name);
-- 
2.28.0


  parent reply index

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-29  8:05 [PATCH 01/32] pwm: sun4i: convert to devm_platform_ioremap_resource Yangtao Li
2019-12-29  8:05 ` [PATCH 02/32] pwm: fsl-ftm: " Yangtao Li
2020-05-23 17:24   ` Uwe Kleine-König
2019-12-29  8:05 ` [PATCH 03/32] pwm: rcar: " Yangtao Li
2020-05-23 17:24   ` Uwe Kleine-König
2019-12-29  8:05 ` [PATCH 04/32] pwm: renesas-tpu: " Yangtao Li
2020-05-23 17:12   ` Uwe Kleine-König
2019-12-29  8:05 ` [PATCH 05/32] pwm: ep93xx: " Yangtao Li
2020-05-23 17:24   ` Uwe Kleine-König
2019-12-29  8:05 ` [PATCH 06/32] pwm: tegra: " Yangtao Li
2020-05-23 17:23   ` Uwe Kleine-König
2019-12-29  8:05 ` [PATCH 07/32] pwm: mediatek: " Yangtao Li
2020-05-23 17:23   ` Uwe Kleine-König
2019-12-29  8:05 ` [PATCH 08/32] pwm: sti: " Yangtao Li
2020-05-23 17:23   ` Uwe Kleine-König
2019-12-29  8:05 ` [PATCH 09/32] pwm: pxa: " Yangtao Li
2020-05-23 17:20   ` Uwe Kleine-König
2019-12-29  8:05 ` [PATCH 10/32] pwm: zx: " Yangtao Li
2020-05-23 17:23   ` Uwe Kleine-König
2019-12-29  8:05 ` [PATCH 11/32] pwm: spear: " Yangtao Li
2020-05-23 17:23   ` Uwe Kleine-König
2019-12-29  8:05 ` [PATCH 12/32] pwm: bcm-kona: " Yangtao Li
2020-05-23 17:20   ` Uwe Kleine-König
2019-12-29  8:05 ` [PATCH 13/32] pwm: lpc32xx: " Yangtao Li
2020-05-23 17:20   ` Uwe Kleine-König
2020-11-12 21:29   ` Vladimir Zapolskiy
2019-12-29  8:05 ` [PATCH 14/32] pwm: meson: " Yangtao Li
2019-12-31 14:53   ` Martin Blumenstingl
2020-05-23 17:25   ` Uwe Kleine-König
2019-12-29  8:05 ` [PATCH 15/32] pwm: rockchip: " Yangtao Li
2019-12-30  8:39   ` Heiko Stuebner
2020-05-23 17:25   ` Uwe Kleine-König
2019-12-29  8:05 ` [PATCH 16/32] pwm: bcm-iproc: " Yangtao Li
2020-05-23 17:22   ` Uwe Kleine-König
2019-12-29  8:05 ` [PATCH 17/32] pwm: samsung: " Yangtao Li
2020-05-23 17:21   ` Uwe Kleine-König
2019-12-29  8:05 ` [PATCH 18/32] pwm: tiehrpwm: " Yangtao Li
2020-05-23 17:22   ` Uwe Kleine-König
2019-12-29  8:05 ` [PATCH 19/32] pwm: puv3: " Yangtao Li
2020-05-23 17:19   ` Uwe Kleine-König
2019-12-29  8:05 ` [PATCH 20/32] pwm: imx: " Yangtao Li
2020-05-23 17:22   ` Uwe Kleine-König
2019-12-29  8:05 ` [PATCH 21/32] pwm: tiecap: " Yangtao Li
2020-05-23 17:19   ` Uwe Kleine-König
2019-12-29  8:06 ` [PATCH 22/32] pwm: bcm2835: " Yangtao Li
2020-05-23 17:18   ` Uwe Kleine-König
2019-12-29  8:06 ` [PATCH 23/32] pwm: berlin: " Yangtao Li
2020-05-23 17:18   ` Uwe Kleine-König
2019-12-29  8:06 ` [PATCH 24/32] pwm: vt8500: " Yangtao Li
2020-05-23 17:14   ` Uwe Kleine-König
2019-12-29  8:06 ` [PATCH 25/32] pwm: brcmstb: " Yangtao Li
2020-01-07 10:54   ` Nicolas Saenz Julienne
2020-05-23 17:25   ` Uwe Kleine-König
2019-12-29  8:06 ` [PATCH 26/32] pwm: mtk-disp: " Yangtao Li
2020-02-20 20:49   ` Matthias Brugger
2019-12-29  8:06 ` [PATCH 27/32] pwm: clps711x: " Yangtao Li
2020-05-23 17:17   ` Uwe Kleine-König
2019-12-29  8:06 ` [PATCH 28/32] pwm: img: " Yangtao Li
2020-05-23 17:16   ` Uwe Kleine-König
2019-12-29  8:06 ` [PATCH 29/32] pwm: lpc18xx-sct: " Yangtao Li
2020-05-23 17:14   ` Uwe Kleine-König
2020-11-12 21:29   ` Vladimir Zapolskiy
2019-12-29  8:06 ` [PATCH 30/32] pwm: hibvt: do some cleanup Yangtao Li
2020-02-20 20:41   ` Uwe Kleine-König
2020-05-23 17:44     ` Uwe Kleine-König
2019-12-29  8:06 ` [PATCH 31/32] pwm: sifive: convert to devm_platform_ioremap_resource Yangtao Li
2020-05-23 17:15   ` Uwe Kleine-König
2019-12-29  8:06 ` [PATCH 32/32] pwm: atmel: " Yangtao Li
2020-01-06 10:32   ` Claudiu.Beznea
2020-05-23 17:25   ` Uwe Kleine-König
2020-05-23 17:11 ` [PATCH 01/32] pwm: sun4i: " Uwe Kleine-König
2020-11-12 16:13 ` Uwe Kleine-König
2020-11-12 19:06   ` Thierry Reding
2020-11-12 21:14     ` Uwe Kleine-König
2020-11-13  7:03       ` About devm_platform_ioremap_resource [Was: Re: [PATCH 01/32] pwm: sun4i: convert to devm_platform_ioremap_resource] Uwe Kleine-König
2020-11-13  8:53         ` [PATCH 0/2] Rename ioremap functions that include request_mem Uwe Kleine-König
2020-11-13  8:53           ` [PATCH 1/2] base: Rename devm_ioremap_resource to make the implicit request_mem explicit Uwe Kleine-König
2020-11-13  8:53           ` Uwe Kleine-König [this message]
2020-11-13  9:11           ` [PATCH 3/2] checkpatch: document the function renaming and deprecation around devm_ioremap_resource Uwe Kleine-König
2020-11-13 12:28             ` Greg Kroah-Hartman
2020-11-13 16:36             ` Joe Perches
2020-11-13 17:00               ` Uwe Kleine-König
2020-11-13 17:08                 ` Joe Perches
2020-11-13 15:47           ` [PATCH 0/2] Rename ioremap functions that include request_mem Thierry Reding
2020-11-13  9:12         ` About devm_platform_ioremap_resource [Was: Re: [PATCH 01/32] pwm: sun4i: convert to devm_platform_ioremap_resource] Bartosz Golaszewski
2020-11-13  9:35           ` Uwe Kleine-König
2020-11-13 16:11         ` Thierry Reding
2020-11-13 17:40           ` Robin Murphy
2020-11-19 17:08           ` Uwe Kleine-König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201113085327.125041-3-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
	git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git
	git clone --mirror https://lore.kernel.org/lkml/10 lkml/git/10.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git