[PATCH] devres: use MACRO instead of function for devm_ioremap_nocache

From: Yisheng Xie
Date: Mon Nov 20 2017 - 04:40:52 EST


Define ioremap is ioremap_nocache, so devm_ioremap has the same function
with devm_ioremap_nocache, which may just be killed. However, there
are many places which use devm_ioremap_nocache instead of devm_ioremap.

This patch is to use MACRO for devm_ioremap_nocache, which will reduce
the size of devres.o from 206824 Bytes to 203912 Bytes.

Signed-off-by: Yisheng Xie <xieyisheng1@xxxxxxxxxx>
---
include/linux/io.h | 3 +--
lib/devres.c | 29 -----------------------------
2 files changed, 1 insertion(+), 31 deletions(-)

diff --git a/include/linux/io.h b/include/linux/io.h
index 32e30e8..1516ccd 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -75,14 +75,13 @@ static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr)

void __iomem *devm_ioremap(struct device *dev, resource_size_t offset,
resource_size_t size);
-void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset,
- resource_size_t size);
void __iomem *devm_ioremap_wc(struct device *dev, resource_size_t offset,
resource_size_t size);
void devm_iounmap(struct device *dev, void __iomem *addr);
int check_signature(const volatile void __iomem *io_addr,
const unsigned char *signature, int length);
void devm_ioremap_release(struct device *dev, void *res);
+#define devm_ioremap_nocache devm_ioremap

void *devm_memremap(struct device *dev, resource_size_t offset,
size_t size, unsigned long flags);
diff --git a/lib/devres.c b/lib/devres.c
index 5f2aedd..f818fcf 100644
--- a/lib/devres.c
+++ b/lib/devres.c
@@ -44,35 +44,6 @@ void __iomem *devm_ioremap(struct device *dev, resource_size_t offset,
EXPORT_SYMBOL(devm_ioremap);

/**
- * devm_ioremap_nocache - Managed ioremap_nocache()
- * @dev: Generic device to remap IO address for
- * @offset: Resource address to map
- * @size: Size of map
- *
- * Managed ioremap_nocache(). Map is automatically unmapped on driver
- * detach.
- */
-void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset,
- resource_size_t size)
-{
- void __iomem **ptr, *addr;
-
- ptr = devres_alloc(devm_ioremap_release, sizeof(*ptr), GFP_KERNEL);
- if (!ptr)
- return NULL;
-
- addr = ioremap_nocache(offset, size);
- if (addr) {
- *ptr = addr;
- devres_add(dev, ptr);
- } else
- devres_free(ptr);
-
- return addr;
-}
-EXPORT_SYMBOL(devm_ioremap_nocache);
-
-/**
* devm_ioremap_wc - Managed ioremap_wc()
* @dev: Generic device to remap IO address for
* @offset: Resource address to map
--
1.7.12.4