Thread: [Linux1394-cvslog] rev 714 - trunk
Brought to you by:
aeb,
bencollins
From: SVN U. <ano...@li...> - 2002-12-22 14:51:06
|
Author: anonymous Date: 2002-12-20 02:46:28 -0500 (Fri, 20 Dec 2002) New Revision: 714 Modified: trunk/dma.c trunk/dma.h Log: might as well make rounding up to PAGE_SIZE multiples a function Modified: trunk/dma.c ============================================================================== --- trunk/dma.c (original) +++ trunk/dma.c 2002-12-22 09:50:34.000000000 -0500 @@ -25,8 +25,7 @@ int dma_prog_region_alloc(struct dma_prog_region *prog, unsigned long n_bytes, struct pci_dev *dev) { /* round up to page size */ - if(n_bytes % PAGE_SIZE) - n_bytes += PAGE_SIZE - (n_bytes % PAGE_SIZE); + n_bytes = round_up_to_page(n_bytes); prog->n_pages = n_bytes / PAGE_SIZE; @@ -70,8 +69,7 @@ unsigned int i, n_pages; /* round up to page size */ - if(n_bytes % PAGE_SIZE) - n_bytes += PAGE_SIZE - (n_bytes % PAGE_SIZE); + n_bytes = round_up_to_page(n_bytes); n_pages = n_bytes / PAGE_SIZE; Modified: trunk/dma.h ============================================================================== --- trunk/dma.h (original) +++ trunk/dma.h 2002-12-22 09:50:34.000000000 -0500 @@ -73,4 +73,12 @@ relative to the beginning of the dma_region */ dma_addr_t dma_region_offset_to_bus(struct dma_region *dma, unsigned long offset); +/* round up a number of bytes to be a multiple of the PAGE_SIZE */ +static inline unsigned long round_up_to_page(unsigned long len) +{ + if(len % PAGE_SIZE) + len += PAGE_SIZE - (len % PAGE_SIZE); + return len; +} + #endif /* IEEE1394_DMA_H */ |