aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc/8xx_io/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/ppc/8xx_io/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/ppc/8xx_io/commproc.c')
-rw-r--r--arch/ppc/8xx_io/commproc.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/arch/ppc/8xx_io/commproc.c b/arch/ppc/8xx_io/commproc.c
index 7a8722beac12..e2c6210f234b 100644
--- a/arch/ppc/8xx_io/commproc.c
+++ b/arch/ppc/8xx_io/commproc.c
@@ -402,7 +402,7 @@ void m8xx_cpm_dpinit(void)
402 * with the processor and the microcode patches applied / activated. 402 * with the processor and the microcode patches applied / activated.
403 * But the following should be at least safe. 403 * But the following should be at least safe.
404 */ 404 */
405 rh_attach_region(&cpm_dpmem_info, (void *)CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE); 405 rh_attach_region(&cpm_dpmem_info, CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE);
406} 406}
407 407
408/* 408/*
@@ -410,9 +410,9 @@ void m8xx_cpm_dpinit(void)
410 * This function returns an offset into the DPRAM area. 410 * This function returns an offset into the DPRAM area.
411 * Use cpm_dpram_addr() to get the virtual address of the area. 411 * Use cpm_dpram_addr() to get the virtual address of the area.
412 */ 412 */
413uint cpm_dpalloc(uint size, uint align) 413unsigned long cpm_dpalloc(uint size, uint align)
414{ 414{
415 void *start; 415 unsigned long start;
416 unsigned long flags; 416 unsigned long flags;
417 417
418 spin_lock_irqsave(&cpm_dpmem_lock, flags); 418 spin_lock_irqsave(&cpm_dpmem_lock, flags);
@@ -420,34 +420,34 @@ uint cpm_dpalloc(uint size, uint align)
420 start = rh_alloc(&cpm_dpmem_info, size, "commproc"); 420 start = rh_alloc(&cpm_dpmem_info, size, "commproc");
421 spin_unlock_irqrestore(&cpm_dpmem_lock, flags); 421 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
422 422
423 return (uint)start; 423 return start;
424} 424}
425EXPORT_SYMBOL(cpm_dpalloc); 425EXPORT_SYMBOL(cpm_dpalloc);
426 426
427int cpm_dpfree(uint offset) 427int cpm_dpfree(unsigned long offset)
428{ 428{
429 int ret; 429 int ret;
430 unsigned long flags; 430 unsigned long flags;
431 431
432 spin_lock_irqsave(&cpm_dpmem_lock, flags); 432 spin_lock_irqsave(&cpm_dpmem_lock, flags);
433 ret = rh_free(&cpm_dpmem_info, (void *)offset); 433 ret = rh_free(&cpm_dpmem_info, offset);
434 spin_unlock_irqrestore(&cpm_dpmem_lock, flags); 434 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
435 435
436 return ret; 436 return ret;
437} 437}
438EXPORT_SYMBOL(cpm_dpfree); 438EXPORT_SYMBOL(cpm_dpfree);
439 439
440uint cpm_dpalloc_fixed(uint offset, uint size, uint align) 440unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align)
441{ 441{
442 void *start; 442 unsigned long start;
443 unsigned long flags; 443 unsigned long flags;
444 444
445 spin_lock_irqsave(&cpm_dpmem_lock, flags); 445 spin_lock_irqsave(&cpm_dpmem_lock, flags);
446 cpm_dpmem_info.alignment = align; 446 cpm_dpmem_info.alignment = align;
447 start = rh_alloc_fixed(&cpm_dpmem_info, (void *)offset, size, "commproc"); 447 start = rh_alloc_fixed(&cpm_dpmem_info, offset, size, "commproc");
448 spin_unlock_irqrestore(&cpm_dpmem_lock, flags); 448 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
449 449
450 return (uint)start; 450 return start;
451} 451}
452EXPORT_SYMBOL(cpm_dpalloc_fixed); 452EXPORT_SYMBOL(cpm_dpalloc_fixed);
453 453
@@ -457,7 +457,7 @@ void cpm_dpdump(void)
457} 457}
458EXPORT_SYMBOL(cpm_dpdump); 458EXPORT_SYMBOL(cpm_dpdump);
459 459
460void *cpm_dpram_addr(uint offset) 460void *cpm_dpram_addr(unsigned long offset)
461{ 461{
462 return ((immap_t *)IMAP_ADDR)->im_cpm.cp_dpmem + offset; 462 return ((immap_t *)IMAP_ADDR)->im_cpm.cp_dpmem + offset;
463} 463}