Staging: dt3155: coding style cleanups for allocator code

This fixes up the worst of the coding style errors for the
allocator code.

Cc: Scott Smedley <ss@aao.gov.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Greg Kroah-Hartman
2009-12-22 15:18:28 -08:00
parent 8125e2f668
commit 1769fd86e1
2 changed files with 143 additions and 143 deletions

View File

@@ -88,8 +88,8 @@ int allocator_himem = 1; /* 0 = probe, pos. = megs, neg. = disable */
int allocator_step = 1; /* This is the step size in MB */ int allocator_step = 1; /* This is the step size in MB */
int allocator_probe = 1; /* This is a flag -- 1=probe, 0=don't probe */ int allocator_probe = 1; /* This is a flag -- 1=probe, 0=don't probe */
static unsigned long allocator_buffer = 0; /* physical address */ static unsigned long allocator_buffer; /* physical address */
static unsigned long allocator_buffer_size = 0; /* kilobytes */ static unsigned long allocator_buffer_size; /* kilobytes */
/* /*
* The allocator keeps a list of DMA areas, so multiple devices * The allocator keeps a list of DMA areas, so multiple devices
@@ -102,7 +102,7 @@ struct allocator_struct {
struct allocator_struct *next; struct allocator_struct *next;
}; };
struct allocator_struct *allocator_list = NULL; struct allocator_struct *allocator_list;
#ifdef ALL_DEBUG #ifdef ALL_DEBUG
@@ -111,9 +111,8 @@ static int dump_list(void)
struct allocator_struct *ptr; struct allocator_struct *ptr;
PDEBUG("Current list:\n"); PDEBUG("Current list:\n");
for (ptr = allocator_list; ptr; ptr = ptr->next) { for (ptr = allocator_list; ptr; ptr = ptr->next)
PDEBUG("0x%08lx (size %likB)\n", ptr->address, ptr->size>>10); PDEBUG("0x%08lx (size %likB)\n", ptr->address, ptr->size>>10);
}
return 0; return 0;
} }
#endif #endif
@@ -177,7 +176,8 @@ int allocator_free_dma (unsigned long address)
prev = ptr; ptr = ptr->next; prev = ptr; ptr = ptr->next;
if (!ptr) { if (!ptr) {
printk(KERN_ERR ALL_MSG "free_dma(0x%08lx) but add. not allocated\n", printk(KERN_ERR ALL_MSG
"free_dma(0x%08lx) but add. not allocated\n",
ptr->address); ptr->address);
return -EINVAL; return -EINVAL;
} }
@@ -199,8 +199,7 @@ int allocator_free_dma (unsigned long address)
int allocator_init(u_long *allocator_max) int allocator_init(u_long *allocator_max)
{ {
/* check how much free memory is there */ /* check how much free memory is there */
void *remapped;
volatile void *remapped;
unsigned long max; unsigned long max;
unsigned long trial_size = allocator_himem<<20; unsigned long trial_size = allocator_himem<<20;
unsigned long last_trial = 0; unsigned long last_trial = 0;
@@ -213,12 +212,12 @@ int allocator_init(u_long *allocator_max)
if (allocator_himem < 0) /* don't even try */ if (allocator_himem < 0) /* don't even try */
return -EINVAL; return -EINVAL;
if (!trial_size) trial_size = 1<<20; /* not specified: try one meg */ if (!trial_size)
trial_size = 1<<20; /* not specified: try one meg */
while (1) { while (1) {
remapped = ioremap(__pa(high_memory), trial_size); remapped = ioremap(__pa(high_memory), trial_size);
if (!remapped) if (!remapped) {
{
PDEBUGG("%li megs failed!\n", trial_size>>20); PDEBUGG("%li megs failed!\n", trial_size>>20);
break; break;
} }
@@ -234,12 +233,12 @@ int allocator_init(u_long *allocator_max)
last_trial = trial_size; last_trial = trial_size;
if (i == trial_size) if (i == trial_size)
trial_size += step; /* increment, if all went well */ trial_size += step; /* increment, if all went well */
else else {
{
PDEBUGG("%li megs copy test failed!\n", trial_size>>20); PDEBUGG("%li megs copy test failed!\n", trial_size>>20);
break; break;
} }
if (!allocator_probe) break; if (!allocator_probe)
break;
} }
PDEBUG("%li megs (%li k, %li b)\n", i>>20, i>>10, i); PDEBUG("%li megs (%li k, %li b)\n", i>>20, i>>10, i);
allocator_buffer_size = i>>10; /* kilobytes */ allocator_buffer_size = i>>10; /* kilobytes */
@@ -273,7 +272,8 @@ int allocator_init(u_long *allocator_max)
tail->next = NULL; tail->next = NULL;
allocator_list = head; allocator_list = head;
*allocator_max = allocator_buffer_size; /* Back to the user code, in KB */ /* Back to the user code, in KB */
*allocator_max = allocator_buffer_size;
return 0; /* ok, ready */ return 0; /* ok, ready */
} }