]> git.hungrycats.org Git - linux/commitdiff
[PATCH] PCI: Replace pci_pool with generic dma_pool, part 2
authorDeepak Saxena <dsaxena@plexity.net>
Mon, 2 Feb 2004 03:05:17 +0000 (19:05 -0800)
committerGreg Kroah-Hartman <greg@kroah.com>
Mon, 2 Feb 2004 03:05:17 +0000 (19:05 -0800)
include/linux changes:

- Add dma_pools member to struct device
- Add include/linux/dmapool.h
- Remove pools memober from struct pci_dev
- Replace pci_pool_* functions with macros that map to dma_pool_* functions

include/linux/device.h
include/linux/dmapool.h [new file with mode: 0644]
include/linux/pci.h

index 367b21888ad42dafaeccb5d218cbb9fc1482e677..4cf6e0d490d594816ff34482ba1416250f4f5b94 100644 (file)
@@ -284,6 +284,7 @@ struct device {
                                           detached from its driver. */
 
        u64             *dma_mask;      /* dma mask (if dma'able device) */
+       struct list_head        dma_pools;      /* dma pools (if dma'ble) */
 
        void    (*release)(struct device * dev);
 };
diff --git a/include/linux/dmapool.h b/include/linux/dmapool.h
new file mode 100644 (file)
index 0000000..e60bfda
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * include/linux/dmapool.h
+ *
+ * Allocation pools for DMAable (coherent) memory.
+ *
+ * This file is licensed under  the terms of the GNU General Public 
+ * License version 2. This program is licensed "as is" without any 
+ * warranty of any kind, whether express or implied.
+ */
+
+#ifndef LINUX_DMAPOOL_H
+#define        LINUX_DMAPOOL_H
+
+#include <asm/io.h>
+#include <asm/scatterlist.h>
+
+struct dma_pool *dma_pool_create(const char *name, struct device *dev, 
+                       size_t size, size_t align, size_t allocation);
+
+void dma_pool_destroy(struct dma_pool *pool);
+
+void *dma_pool_alloc(struct dma_pool *pool, int mem_flags, dma_addr_t *handle);
+
+void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr);
+
+#endif
+
index 612d14e9058776e23f28928b9880415ea65e63ea..bde9c5e8dbf8b8d18778c19322c39bc09ed5032e 100644 (file)
@@ -393,7 +393,6 @@ struct pci_dev {
                                           0xffffffff.  You only need to change
                                           this if your device has broken DMA
                                           or supports 64-bit transfers.  */
-       struct list_head pools;         /* pci_pools tied to this device */
 
        u64             consistent_dma_mask;/* Like dma_mask, but for
                                               pci_alloc_consistent mappings as
@@ -692,12 +691,15 @@ const struct pci_device_id *pci_match_device(const struct pci_device_id *ids, co
 int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass);
 
 /* kmem_cache style wrapper around pci_alloc_consistent() */
-struct pci_pool *pci_pool_create (const char *name, struct pci_dev *dev,
-               size_t size, size_t align, size_t allocation);
-void pci_pool_destroy (struct pci_pool *pool);
 
-void *pci_pool_alloc (struct pci_pool *pool, int flags, dma_addr_t *handle);
-void pci_pool_free (struct pci_pool *pool, void *vaddr, dma_addr_t addr);
+#include <linux/dmapool.h>
+
+#define        pci_pool dma_pool
+#define pci_pool_create(name, pdev, size, align, allocation) \
+               dma_pool_create(name, &pdev->dev, size, align, allocation)
+#define        pci_pool_destroy(pool) dma_pool_destroy(pool)
+#define        pci_pool_alloc(pool, flags, handle) dma_pool_alloc(pool, flags, handle)
+#define        pci_pool_free(pool, vaddr, addr) dma_pool_free(pool, vaddr, addr)
 
 #if defined(CONFIG_ISA) || defined(CONFIG_EISA)
 extern struct pci_dev *isa_bridge;