kernel: replace ulong with uintptr in ucallocb() and fix unneeded parentheses

This commit is contained in:
cinap_lenrek 2014-12-16 09:41:05 +01:00
parent 5c29603f50
commit 0e03a5f9fd
2 changed files with 12 additions and 12 deletions

View file

@ -28,7 +28,7 @@ _allocb(int size)
b->next = nil; b->next = nil;
b->list = nil; b->list = nil;
b->free = 0; b->free = nil;
b->flag = 0; b->flag = 0;
/* align start of data portion by rounding up */ /* align start of data portion by rounding up */
@ -37,9 +37,9 @@ _allocb(int size)
b->base = (uchar*)addr; b->base = (uchar*)addr;
/* align end of data portion by rounding down */ /* align end of data portion by rounding down */
b->lim = ((uchar*)b) + msize(b); b->lim = (uchar*)b + msize(b);
addr = (uintptr)(b->lim); addr = (uintptr)b->lim;
addr = addr & ~(BLOCKALIGN-1); addr &= ~(BLOCKALIGN-1);
b->lim = (uchar*)addr; b->lim = (uchar*)addr;
/* leave sluff at beginning for added headers */ /* leave sluff at beginning for added headers */
@ -129,7 +129,7 @@ freeb(Block *b)
* drivers which perform non cache coherent DMA manage their own buffer * drivers which perform non cache coherent DMA manage their own buffer
* pool of uncached buffers and provide their own free routine. * pool of uncached buffers and provide their own free routine.
*/ */
if(b->free) { if(b->free != nil) {
b->free(b); b->free(b);
return; return;
} }

View file

@ -24,25 +24,25 @@ static Block*
_ucallocb(int size) _ucallocb(int size)
{ {
Block *b; Block *b;
ulong addr; uintptr addr;
if((b = ucalloc(sizeof(Block)+size+Hdrspc)) == nil) if((b = ucalloc(sizeof(Block)+size+Hdrspc)) == nil)
return nil; return nil;
b->next = nil; b->next = nil;
b->list = nil; b->list = nil;
b->free = 0; b->free = nil;
b->flag = 0; b->flag = 0;
/* align start of data portion by rounding up */ /* align start of data portion by rounding up */
addr = (ulong)b; addr = (uintptr)b;
addr = ROUND(addr + sizeof(Block), BLOCKALIGN); addr = ROUND(addr + sizeof(Block), BLOCKALIGN);
b->base = (uchar*)addr; b->base = (uchar*)addr;
/* align end of data portion by rounding down */ /* align end of data portion by rounding down */
b->lim = ((uchar*)b) + msize(b); b->lim = (uchar*)b + msize(b);
addr = (ulong)(b->lim); addr = (uintptr)b->lim;
addr = addr & ~(BLOCKALIGN-1); addr &= ~(BLOCKALIGN-1);
b->lim = (uchar*)addr; b->lim = (uchar*)addr;
/* leave sluff at beginning for added headers */ /* leave sluff at beginning for added headers */
@ -123,7 +123,7 @@ ucfreeb(Block *b)
* drivers which perform non cache coherent DMA manage their own buffer * drivers which perform non cache coherent DMA manage their own buffer
* pool of uncached buffers and provide their own free routine. * pool of uncached buffers and provide their own free routine.
*/ */
if(b->free) { if(b->free != nil) {
b->free(b); b->free(b);
return; return;
} }