lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201113085327.125041-3-u.kleine-koenig@pengutronix.de>
Date:   Fri, 13 Nov 2020 09:53:27 +0100
From:   Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>
To:     linux-kernel@...r.kernel.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Thierry Reding <thierry.reding@...il.com>
Subject: [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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ