driver core: Drop helper devm_platform_ioremap_resource_wc()
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tue, 25 May 2021 10:37:11 +0000 (12:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 May 2021 13:51:33 +0000 (15:51 +0200)
Since the macro was introduced in 2019 (commit bb6243b4f73d ("drivers:
platform: provide devm_platform_ioremap_resource_wc()") there is only a
single user which hardly justifies the function for the small task it
provides.

So drop the helper and open-code it in the only user. Adapt the non-wc
case accordingly.

For a all-mod-config build on amd64 this change introduces the following
changes according to bloat-o-meter:

add/remove: 0/1 grow/shrink: 1/0 up/down: 20/-252 (-232)
Function                                     old     new   delta
devm_platform_ioremap_resource_wc            252       -    -252
sram_probe                                   796     816     +20

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20210525103711.956438-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/driver-api/driver-model/devres.rst
drivers/base/platform.c
drivers/misc/sram.c
include/linux/platform_device.h

index e0814d2..0fe1fff 100644 (file)
@@ -314,7 +314,6 @@ IOMAP
   devm_ioremap_resource() : checks resource, requests memory region, ioremaps
   devm_ioremap_resource_wc()
   devm_platform_ioremap_resource() : calls devm_ioremap_resource() for platform device
-  devm_platform_ioremap_resource_wc()
   devm_platform_ioremap_resource_byname()
   devm_platform_get_and_ioremap_resource()
   devm_iounmap()
index 9cd34de..ae071e8 100644 (file)
@@ -125,26 +125,6 @@ void __iomem *devm_platform_ioremap_resource(struct platform_device *pdev,
 EXPORT_SYMBOL_GPL(devm_platform_ioremap_resource);
 
 /**
- * devm_platform_ioremap_resource_wc - write-combined variant of
- *                                     devm_platform_ioremap_resource()
- *
- * @pdev: platform device to use both for memory resource lookup as well as
- *        resource management
- * @index: resource index
- *
- * 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)
-{
-       struct resource *res;
-
-       res = platform_get_resource(pdev, IORESOURCE_MEM, index);
-       return devm_ioremap_resource_wc(&pdev->dev, res);
-}
-
-/**
  * devm_platform_ioremap_resource_byname - call devm_ioremap_resource for
  *                                        a platform device, retrieve the
  *                                        resource by name
index 202bf95..93638ae 100644 (file)
@@ -341,6 +341,7 @@ static int sram_probe(struct platform_device *pdev)
 {
        struct sram_dev *sram;
        int ret;
+       struct resource *res;
        int (*init_func)(void);
 
        sram = devm_kzalloc(&pdev->dev, sizeof(*sram), GFP_KERNEL);
@@ -349,10 +350,11 @@ static int sram_probe(struct platform_device *pdev)
 
        sram->dev = &pdev->dev;
 
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (of_property_read_bool(pdev->dev.of_node, "no-memory-wc"))
-               sram->virt_base = devm_platform_ioremap_resource(pdev, 0);
+               sram->virt_base = devm_ioremap_resource(&pdev->dev, res);
        else
-               sram->virt_base = devm_platform_ioremap_resource_wc(pdev, 0);
+               sram->virt_base = devm_ioremap_resource_wc(&pdev->dev, res);
        if (IS_ERR(sram->virt_base)) {
                dev_err(&pdev->dev, "could not map SRAM registers\n");
                return PTR_ERR(sram->virt_base);
index cd81e06..ed42ea9 100644 (file)
@@ -66,9 +66,6 @@ extern void __iomem *
 devm_platform_ioremap_resource(struct platform_device *pdev,
                               unsigned int index);
 extern void __iomem *
-devm_platform_ioremap_resource_wc(struct platform_device *pdev,
-                                 unsigned int index);
-extern void __iomem *
 devm_platform_ioremap_resource_byname(struct platform_device *pdev,
                                      const char *name);
 extern int platform_get_irq(struct platform_device *, unsigned int);