aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/commproc.c
diff options
context:
space:
mode:
authorTimur Tabi <timur@freescale.com>2007-05-08 15:46:36 -0400
committerKumar Gala <galak@kernel.crashing.org>2007-05-10 00:01:43 -0400
commit4c35630ccda56ed494f6102d2e147fefe14b78d2 (patch)
tree4f04754fb0ec6978923b3c1e0318997e420f6551 /arch/powerpc/sysdev/commproc.c
parent742226c579c573c24386aaf41969a01ee058b97e (diff)
[POWERPC] Change rheap functions to use ulongs instead of pointers
The rheap allocation functions return a pointer, but the actual value is based on how the heap was initialized, and so it can be anything, e.g. an offset into a buffer. A ulong is a better representation of the value returned by the allocation functions. This patch changes all of the relevant rheap functions to use a unsigned long integers instead of a pointer. In case of an error, the value returned is a negative error code that has been cast to an unsigned long. The caller can use the IS_ERR_VALUE() macro to check for this. All code which calls the rheap functions is updated accordingly. Macros IS_MURAM_ERR() and IS_DPERR(), have been deleted in favor of IS_ERR_VALUE(). Also added error checking to rh_attach_region(). Signed-off-by: Timur Tabi <timur@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/sysdev/commproc.c')
-rw-r--r--arch/powerpc/sysdev/commproc.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/arch/powerpc/sysdev/commproc.c b/arch/powerpc/sysdev/commproc.c
index 9b4fafd9a840..4f67b89ba1d0 100644
--- a/arch/powerpc/sysdev/commproc.c
+++ b/arch/powerpc/sysdev/commproc.c
@@ -330,7 +330,7 @@ void m8xx_cpm_dpinit(void)
330 * with the processor and the microcode patches applied / activated. 330 * with the processor and the microcode patches applied / activated.
331 * But the following should be at least safe. 331 * But the following should be at least safe.
332 */ 332 */
333 rh_attach_region(&cpm_dpmem_info, (void *)CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE); 333 rh_attach_region(&cpm_dpmem_info, CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE);
334} 334}
335 335
336/* 336/*
@@ -338,9 +338,9 @@ void m8xx_cpm_dpinit(void)
338 * This function returns an offset into the DPRAM area. 338 * This function returns an offset into the DPRAM area.
339 * Use cpm_dpram_addr() to get the virtual address of the area. 339 * Use cpm_dpram_addr() to get the virtual address of the area.
340 */ 340 */
341uint cpm_dpalloc(uint size, uint align) 341unsigned long cpm_dpalloc(uint size, uint align)
342{ 342{
343 void *start; 343 unsigned long start;
344 unsigned long flags; 344 unsigned long flags;
345 345
346 spin_lock_irqsave(&cpm_dpmem_lock, flags); 346 spin_lock_irqsave(&cpm_dpmem_lock, flags);
@@ -352,30 +352,30 @@ uint cpm_dpalloc(uint size, uint align)
352} 352}
353EXPORT_SYMBOL(cpm_dpalloc); 353EXPORT_SYMBOL(cpm_dpalloc);
354 354
355int cpm_dpfree(uint offset) 355int cpm_dpfree(unsigned long offset)
356{ 356{
357 int ret; 357 int ret;
358 unsigned long flags; 358 unsigned long flags;
359 359
360 spin_lock_irqsave(&cpm_dpmem_lock, flags); 360 spin_lock_irqsave(&cpm_dpmem_lock, flags);
361 ret = rh_free(&cpm_dpmem_info, (void *)offset); 361 ret = rh_free(&cpm_dpmem_info, offset);
362 spin_unlock_irqrestore(&cpm_dpmem_lock, flags); 362 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
363 363
364 return ret; 364 return ret;
365} 365}
366EXPORT_SYMBOL(cpm_dpfree); 366EXPORT_SYMBOL(cpm_dpfree);
367 367
368uint cpm_dpalloc_fixed(uint offset, uint size, uint align) 368unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align)
369{ 369{
370 void *start; 370 unsigned long start;
371 unsigned long flags; 371 unsigned long flags;
372 372
373 spin_lock_irqsave(&cpm_dpmem_lock, flags); 373 spin_lock_irqsave(&cpm_dpmem_lock, flags);
374 cpm_dpmem_info.alignment = align; 374 cpm_dpmem_info.alignment = align;
375 start = rh_alloc_fixed(&cpm_dpmem_info, (void *)offset, size, "commproc"); 375 start = rh_alloc_fixed(&cpm_dpmem_info, offset, size, "commproc");
376 spin_unlock_irqrestore(&cpm_dpmem_lock, flags); 376 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
377 377
378 return (uint)start; 378 return start;
379} 379}
380EXPORT_SYMBOL(cpm_dpalloc_fixed); 380EXPORT_SYMBOL(cpm_dpalloc_fixed);
381 381
@@ -385,7 +385,7 @@ void cpm_dpdump(void)
385} 385}
386EXPORT_SYMBOL(cpm_dpdump); 386EXPORT_SYMBOL(cpm_dpdump);
387 387
388void *cpm_dpram_addr(uint offset) 388void *cpm_dpram_addr(unsigned long offset)
389{ 389{
390 return (void *)(dpram_vbase + offset); 390 return (void *)(dpram_vbase + offset);
391} 391}