[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1450741676-5865-29-git-send-email-viro@ZenIV.linux.org.uk>
Date: Mon, 21 Dec 2015 23:47:02 +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 29/83] switch the remaining users of __get_dma_pages() to get_dma_pages()
From: Al Viro <viro@...iv.linux.org.uk>
Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
---
drivers/char/mbcs.c | 24 ++++++++++++------------
drivers/net/appletalk/ltpc.c | 8 +++-----
drivers/net/ethernet/amd/mvme147.c | 8 ++++----
drivers/net/ethernet/cirrus/cs89x0.c | 3 +--
include/linux/gfp.h | 3 ---
5 files changed, 20 insertions(+), 26 deletions(-)
diff --git a/drivers/char/mbcs.c b/drivers/char/mbcs.c
index b9d9619..eddf892 100644
--- a/drivers/char/mbcs.c
+++ b/drivers/char/mbcs.c
@@ -404,22 +404,22 @@ static ssize_t mbcs_sram_read(struct file * fp, char __user *buf, size_t len, lo
{
struct cx_dev *cx_dev = fp->private_data;
struct mbcs_soft *soft = cx_dev->soft;
- uint64_t hostAddr;
+ void *hostAddr;
int rv = 0;
- hostAddr = __get_dma_pages(GFP_KERNEL, get_order(len));
- if (hostAddr == 0)
+ hostAddr = get_dma_pages(GFP_KERNEL, get_order(len));
+ if (!hostAddr)
return -ENOMEM;
- rv = do_mbcs_sram_dmawrite(soft, hostAddr, len, off);
+ rv = do_mbcs_sram_dmawrite(soft, (unsigned long)hostAddr, len, off);
if (rv < 0)
goto exit;
- if (copy_to_user(buf, (void *)hostAddr, len))
+ if (copy_to_user(buf, hostAddr, len))
rv = -EFAULT;
exit:
- free_pages((void *)hostAddr, get_order(len));
+ free_pages(hostAddr, get_order(len));
return rv;
}
@@ -429,22 +429,22 @@ mbcs_sram_write(struct file * fp, const char __user *buf, size_t len, loff_t * o
{
struct cx_dev *cx_dev = fp->private_data;
struct mbcs_soft *soft = cx_dev->soft;
- uint64_t hostAddr;
+ void *hostAddr;
int rv = 0;
- hostAddr = __get_dma_pages(GFP_KERNEL, get_order(len));
- if (hostAddr == 0)
+ hostAddr = get_dma_pages(GFP_KERNEL, get_order(len));
+ if (!hostAddr)
return -ENOMEM;
- if (copy_from_user((void *)hostAddr, buf, len)) {
+ if (copy_from_user(hostAddr, buf, len)) {
rv = -EFAULT;
goto exit;
}
- rv = do_mbcs_sram_dmaread(soft, hostAddr, len, off);
+ rv = do_mbcs_sram_dmaread(soft, (unsigned long)hostAddr, len, off);
exit:
- free_pages((void *)hostAddr, get_order(len));
+ free_pages(hostAddr, get_order(len));
return rv;
}
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c
index c98dea0..daaffd7 100644
--- a/drivers/net/appletalk/ltpc.c
+++ b/drivers/net/appletalk/ltpc.c
@@ -245,11 +245,9 @@ static int sendup_buffer (struct net_device *dev);
/* Dma Memory related stuff, cribbed directly from 3c505.c */
-static unsigned long dma_mem_alloc(int size)
+static void *dma_mem_alloc(int size)
{
- int order = get_order(size);
-
- return __get_dma_pages(GFP_KERNEL, order);
+ return get_dma_pages(GFP_KERNEL, get_order(size));
}
/* DMA data buffer, DMA command buffer */
@@ -1075,7 +1073,7 @@ struct net_device * __init ltpc_probe(void)
}
/* allocate a DMA buffer */
- ltdmabuf = (unsigned char *) dma_mem_alloc(1000);
+ ltdmabuf = dma_mem_alloc(1000);
if (!ltdmabuf) {
printk(KERN_ERR "ltpc: mem alloc failed\n");
err = -ENOMEM;
diff --git a/drivers/net/ethernet/amd/mvme147.c b/drivers/net/ethernet/amd/mvme147.c
index abda91c..b3487fb 100644
--- a/drivers/net/ethernet/amd/mvme147.c
+++ b/drivers/net/ethernet/amd/mvme147.c
@@ -38,7 +38,7 @@
/* Our private data structure */
struct m147lance_private {
struct lance_private lance;
- unsigned long ram;
+ void *ram;
};
/* function prototypes... This is easy because all the grot is in the
@@ -111,7 +111,7 @@ struct net_device * __init mvme147lance_probe(int unit)
dev->dev_addr);
lp = netdev_priv(dev);
- lp->ram = __get_dma_pages(GFP_ATOMIC, 3); /* 32K */
+ lp->ram = get_dma_pages(GFP_ATOMIC, 3); /* 32K */
if (!lp->ram) {
printk("%s: No memory for LANCE buffers\n", dev->name);
free_netdev(dev);
@@ -134,7 +134,7 @@ struct net_device * __init mvme147lance_probe(int unit)
err = register_netdev(dev);
if (err) {
- free_pages((void *)lp->ram, 3);
+ free_pages(lp->ram, 3);
free_netdev(dev);
return ERR_PTR(err);
}
@@ -193,7 +193,7 @@ void __exit cleanup_module(void)
{
struct m147lance_private *lp = netdev_priv(dev_mvme147_lance);
unregister_netdev(dev_mvme147_lance);
- free_pages((void *)lp->ram, 3);
+ free_pages(lp->ram, 3);
free_netdev(dev_mvme147_lance);
}
diff --git a/drivers/net/ethernet/cirrus/cs89x0.c b/drivers/net/ethernet/cirrus/cs89x0.c
index 815c596..25e128f 100644
--- a/drivers/net/ethernet/cirrus/cs89x0.c
+++ b/drivers/net/ethernet/cirrus/cs89x0.c
@@ -883,8 +883,7 @@ net_open(struct net_device *dev)
#if ALLOW_DMA
if (lp->use_dma && (lp->isa_config & ANY_ISA_DMA)) {
unsigned long flags;
- lp->dma_buff = (unsigned char *)__get_dma_pages(GFP_KERNEL,
- get_order(lp->dmasize * 1024));
+ lp->dma_buff = get_dma_pages(GFP_KERNEL, get_order(lp->dmasize * 1024));
if (!lp->dma_buff) {
pr_err("%s: cannot get %dK memory for DMA\n",
dev->name, lp->dmasize);
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 07b714d..fc4529d 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -483,9 +483,6 @@ void * __meminit alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask);
#define __get_free_page(gfp_mask) \
__get_free_pages((gfp_mask), 0)
-#define __get_dma_pages(gfp_mask, order) \
- __get_free_pages((gfp_mask) | GFP_DMA, (order))
-
#define get_dma_pages(gfp_mask, order) \
((void *)__get_free_pages((gfp_mask) | GFP_DMA, (order)))
--
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