unsigned int ul_DmaBufferHw[2]; /* hw address of DMA buff */
unsigned int ui_DmaBufferSize[2]; /* size of dma buffer in bytes */
unsigned int ui_DmaBufferUsesize[2]; /* which size we may now used for transfer */
- unsigned int ui_DmaBufferPages[2]; /* number of pages in buffer */
+ unsigned int ui_DmaBufferPageOrder[2]; /* log2 of pages in buffer */
unsigned char b_DigitalOutputRegister; /* Digital Output Register */
unsigned char b_OutputMemoryStatus;
unsigned char b_TimerSelectMode; /* Contain data written at iobase + 0C */
const struct addi_board *this_board = NULL;
struct addi_private *devpriv;
struct comedi_subdevice *s;
- int ret, pages, i;
+ int ret, order, i;
if (context < ARRAY_SIZE(apci3120_boardtypes))
this_board = &apci3120_boardtypes[context];
/* Allocate DMA buffers */
devpriv->b_DmaDoubleBuffer = 0;
for (i = 0; i < 2; i++) {
- for (pages = 4; pages >= 0; pages--) {
+ for (order = 2; order >= 0; order--) {
devpriv->ul_DmaBufferVirtual[i] =
- (void *) __get_free_pages(GFP_KERNEL, pages);
+ (void *)__get_free_pages(GFP_KERNEL, order);
if (devpriv->ul_DmaBufferVirtual[i])
break;
}
if (!devpriv->ul_DmaBufferVirtual[i])
break;
- devpriv->ui_DmaBufferPages[i] = pages;
- devpriv->ui_DmaBufferSize[i] = PAGE_SIZE * pages;
+ devpriv->ui_DmaBufferPageOrder[i] = order;
+ devpriv->ui_DmaBufferSize[i] = PAGE_SIZE << order;
devpriv->ul_DmaBufferHw[i] =
virt_to_bus(devpriv->ul_DmaBufferVirtual[i]);
}
if (devpriv->ul_DmaBufferVirtual[0]) {
free_pages((unsigned long)devpriv->
ul_DmaBufferVirtual[0],
- devpriv->ui_DmaBufferPages[0]);
+ devpriv->ui_DmaBufferPageOrder[0]);
}
if (devpriv->ul_DmaBufferVirtual[1]) {
free_pages((unsigned long)devpriv->
ul_DmaBufferVirtual[1],
- devpriv->ui_DmaBufferPages[1]);
+ devpriv->ui_DmaBufferPageOrder[1]);
}
}
}