diff options
author | Eli Billauer <eli.billauer@gmail.com> | 2014-06-21 14:07:12 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-06-26 20:19:25 -0400 |
commit | 525be905dc5db388487470be44734f6fb33a8fda (patch) | |
tree | 53b8300bb058ecab55c4d3b0c848e21fbe692576 /drivers/staging/xillybus/xillybus.h | |
parent | 31cd921dea3274202399078443dc6e93ca3f84c1 (diff) |
staging: xillybus: Use devm_ API for memory allocation and DMA mapping
Managed device resource API replaces code that reinvents it for memory
allocation, page allocation and DMA mapping.
devm_add_action() is used for unwinding DMA mappings, since there is no
devm_* API for dma_map_single(). A recent patch that introduces such API
was rejected, mainly on the grounds that it may cause an unnecessary waste of
resources.
Suggested-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/xillybus/xillybus.h')
-rw-r--r-- | drivers/staging/xillybus/xillybus.h | 46 |
1 files changed, 13 insertions, 33 deletions
diff --git a/drivers/staging/xillybus/xillybus.h b/drivers/staging/xillybus/xillybus.h index 78a749a7a1c1..ae58a3eeb293 100644 --- a/drivers/staging/xillybus/xillybus.h +++ b/drivers/staging/xillybus/xillybus.h @@ -25,33 +25,12 @@ struct xilly_endpoint_hardware; -struct xilly_page { - struct list_head node; - unsigned long addr; - unsigned int order; -}; - -struct xilly_dma { - struct list_head node; - struct pci_dev *pdev; - struct device *dev; - dma_addr_t dma_addr; - size_t size; - int direction; -}; - struct xilly_buffer { void *addr; dma_addr_t dma_addr; int end_offset; /* Counting elements, not bytes */ }; -struct xilly_cleanup { - struct list_head to_kfree; - struct list_head to_pagefree; - struct list_head to_unmap; -}; - struct xilly_idt_handle { unsigned char *chandesc; unsigned char *idt; @@ -126,9 +105,6 @@ struct xilly_endpoint { struct mutex register_mutex; wait_queue_head_t ep_wait; - /* List of memory allocations, to make release easy */ - struct xilly_cleanup cleanup; - /* Channels and message handling */ struct cdev cdev; @@ -156,18 +132,22 @@ struct xilly_endpoint_hardware { dma_addr_t, size_t, int); - dma_addr_t (*map_single)(struct xilly_cleanup *, - struct xilly_endpoint *, - void *, - size_t, - int); - void (*unmap_single)(struct xilly_dma *entry); + int (*map_single)(struct xilly_endpoint *, + void *, + size_t, + int, + dma_addr_t *); }; -irqreturn_t xillybus_isr(int irq, void *data); +struct xilly_mapping { + void *device; + dma_addr_t dma_addr; + size_t size; + int direction; +}; -void xillybus_do_cleanup(struct xilly_cleanup *mem, - struct xilly_endpoint *endpoint); + +irqreturn_t xillybus_isr(int irq, void *data); struct xilly_endpoint *xillybus_init_endpoint(struct pci_dev *pdev, struct device *dev, |