[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1450741676-5865-52-git-send-email-viro@ZenIV.linux.org.uk>
Date: Mon, 21 Dec 2015 23:47:25 +0000
From: Al Viro <viro@...IV.linux.org.uk>
To: linux-kernel@...r.kernel.org
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [POC][PATCH 52/83] devm_{get_}free_pages(): switch to pointers
From: Al Viro <viro@...iv.linux.org.uk>
the only caller of devm_get_free_pages() casts anyway
Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
---
drivers/base/devres.c | 14 ++++++--------
drivers/char/xillybus/xillybus_core.c | 2 +-
include/linux/device.h | 4 ++--
3 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/base/devres.c b/drivers/base/devres.c
index 854f7ae..414ac33 100644
--- a/drivers/base/devres.c
+++ b/drivers/base/devres.c
@@ -911,7 +911,7 @@ void *devm_kmemdup(struct device *dev, const void *src, size_t len, gfp_t gfp)
EXPORT_SYMBOL_GPL(devm_kmemdup);
struct pages_devres {
- unsigned long addr;
+ void *addr;
unsigned int order;
};
@@ -927,7 +927,7 @@ static void devm_pages_release(struct device *dev, void *res)
{
struct pages_devres *devres = res;
- free_pages((void *)devres->addr, devres->order);
+ free_pages(devres->addr, devres->order);
}
/**
@@ -943,13 +943,11 @@ static void devm_pages_release(struct device *dev, void *res)
* Address of allocated memory on success, 0 on failure.
*/
-unsigned long devm_get_free_pages(struct device *dev,
+void *devm_get_free_pages(struct device *dev,
gfp_t gfp_mask, unsigned int order)
{
struct pages_devres *devres;
- unsigned long addr;
-
- addr = __get_free_pages(gfp_mask, order);
+ void *addr = (void *)__get_free_pages(gfp_mask, order);
if (unlikely(!addr))
return 0;
@@ -957,7 +955,7 @@ unsigned long devm_get_free_pages(struct device *dev,
devres = devres_alloc(devm_pages_release,
sizeof(struct pages_devres), GFP_KERNEL);
if (unlikely(!devres)) {
- free_pages((void *)addr, order);
+ free_pages(addr, order);
return 0;
}
@@ -977,7 +975,7 @@ EXPORT_SYMBOL_GPL(devm_get_free_pages);
* Free memory allocated with devm_get_free_pages(). Unlike free_pages,
* there is no need to supply the @order.
*/
-void devm_free_pages(struct device *dev, unsigned long addr)
+void devm_free_pages(struct device *dev, void *addr)
{
struct pages_devres devres = { .addr = addr };
diff --git a/drivers/char/xillybus/xillybus_core.c b/drivers/char/xillybus/xillybus_core.c
index 77d6c12..28cd936 100644
--- a/drivers/char/xillybus/xillybus_core.c
+++ b/drivers/char/xillybus/xillybus_core.c
@@ -359,7 +359,7 @@ static int xilly_get_dma_buffers(struct xilly_endpoint *ep,
allocorder++;
}
- s->salami = (void *) devm_get_free_pages(
+ s->salami = devm_get_free_pages(
dev,
GFP_KERNEL | __GFP_DMA32 | __GFP_ZERO,
allocorder);
diff --git a/include/linux/device.h b/include/linux/device.h
index b8f411b..24d957d 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -671,9 +671,9 @@ extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp);
extern void *devm_kmemdup(struct device *dev, const void *src, size_t len,
gfp_t gfp);
-extern unsigned long devm_get_free_pages(struct device *dev,
+extern void *devm_get_free_pages(struct device *dev,
gfp_t gfp_mask, unsigned int order);
-extern void devm_free_pages(struct device *dev, unsigned long addr);
+extern void devm_free_pages(struct device *dev, void *addr);
void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists