printk cleanup
Hi all,
May I sugest following printk changes:
=========><=========
arch/parisc/kernel/pci-dma.c +6 -3
@@ -261,11 +261,13 @@ }else if (pages_needed <=32 ) {PCXL_FIND_FREE_MAPPING (res_idx, mask,32 ); }else { -panic (__FILE__": pcxl_alloc_range() Too many pages to map.\n" ); +panic ("%s: pcxl_alloc_range() Too many pages to map.\n" , + __FILE__); }dump_resmap (); -panic (__FILE__": pcxl_alloc_range() out of dma mapping resources\n" ); +panic ("%s: pcxl_alloc_range() out of dma mapping resources\n" , + __FILE__); resource_found:
@@ -319,7 +321,8 @@ }else if (pages_mapped <=32 ) {PCXL_FREE_MAPPINGS (res_idx, mask,32 ); }else { -panic (__FILE__": pcxl_free_range() Too many pages to unmap.\n" ); +panic ("%s: pcxl_free_range() Too many pages to unmap.\n" , + __FILE__); } pcxl_used_pages -= (pages_mapped ? pages_mapped :1 );
arch/parisc/math-emu/decode_exc.c +1 -1
@@ -347,7 +347,7 @@return SIGNALCODE (SIGFPE ,FPE_FLTRES );default :update_trap_counts (Fpu_register, aflags, bflags, trap_counts); -printk (__FILE__"(%d) Unknown FPU exception 0x%x\n" , +printk ("%s(%d) Unknown FPU exception 0x%x\n" , __FILE__, __LINE__,Excp_type (exception_index));return SIGNALCODE (SIGILL ,ILL_COPROC );case NOEXCEPTION :/* no exception */
drivers/parisc/ccio-dma.c +8 -6
@@ -364,11 +364,11 @@CCIO_FIND_FREE_MAPPING (ioc, res_idx, mask,64 );#endif }else { -panic (__FILE__": %s() Too many pages to map. pages_needed: %ld\n" , - __FUNCTION__, pages_needed); +panic ("%s: %s() Too many pages to map. pages_needed: %ld\n" , + __FILE__, __FUNCTION__, pages_needed); } -panic (__FILE__": %s() I/O MMU is out of mapping resources.\n" , +panic ("%s: %s() I/O MMU is out of mapping resources.\n" , __FILE__, __FUNCTION__); resource_found:
@@ -441,7 +441,7 @@CCIO_FREE_MAPPINGS (ioc, res_idx, mask,64 );#endif }else { -panic (__FILE__":%s() Too many pages to unmap.\n" , +panic ("%s:%s() Too many pages to unmap.\n" , __FILE__, __FUNCTION__); } }
@@ -1447,7 +1447,8 @@ ioc->pdir_base = (u64 *)__get_free_pages (GFP_KERNEL ,get_order (ioc->pdir_size));if (NULL == ioc->pdir_base) { -panic (__FILE__":%s() could not allocate I/O Page Table\n" , __FUNCTION__); +panic ("%s:%s() could not allocate I/O Page Table\n" , __FILE__, + __FUNCTION__); }memset (ioc->pdir_base,0 , ioc->pdir_size);
@@ -1461,7 +1462,8 @@ ioc->res_map = (u8 *)__get_free_pages (GFP_KERNEL ,get_order (ioc->res_size));if (NULL == ioc->res_map) { -panic (__FILE__":%s() could not allocate resource map\n" , __FUNCTION__); +panic ("%s:%s() could not allocate resource map\n" , __FILE__, + __FUNCTION__); }memset (ioc->res_map,0 , ioc->res_size);
drivers/parisc/sba_iommu.c +4 -2
@@ -579,7 +579,8 @@if (pide >= (ioc->res_size <<3 )) { pide =sba_search_bitmap (ioc, pages_needed);if (pide >= (ioc->res_size <<3 )) -panic (__FILE__": I/O MMU @ %lx is out of mapping resources\n" , ioc->ioc_hpa); +panic ("%s: I/O MMU @ %lx is out of mapping resources\n" , + __FILE__, ioc->ioc_hpa); }#ifdef ASSERT_PDIR_SANITY
@@ -1781,7 +1782,8 @@if (NULL == sba_dev->ioc[i].res_map) { -panic (__FILE__":%s() could not allocate resource map\n" , __FUNCTION__ ); +panic ("%s:%s() could not allocate resource map\n" , + __FILE__, __FUNCTION__ ); }memset (sba_dev->ioc[i].res_map,0 , res_size);
include/asm-parisc/pci.h +2 -1
@@ -29,7 +29,8 @@#ifdef PCI_DEBUG #define ASSERT (expr) \ if(!(expr)) { \ - printk( "\n" __FILE__ ":%d: Assertion " #expr " failed!\n",__LINE__); \ + printk("\n%s:%d: Assertion " #expr " failed!\n", __FILE__, + __LINE__); \ panic(#expr); \ }#else
=========><=========
hth,
Joel
PS: I also notice some printk("\n" KERNEL_... "..."); would it not be better to change in printk(KERNEL_... "\n...");
arch/parisc/kernel/pci-dma.c +6 -3
@@ -261,11 +261,13 @@ }else if (pages_needed <=32 ) {PCXL_FIND_FREE_MAPPING (res_idx, mask,32 ); }else { -panic (__FILE__": pcxl_alloc_range() Too many pages to map.\n" ); +panic ("%s: pcxl_alloc_range() Too many pages to map.\n" , + __FILE__); }dump_resmap (); -panic (__FILE__": pcxl_alloc_range() out of dma mapping resources\n" ); +panic ("%s: pcxl_alloc_range() out of dma mapping resources\n" , + __FILE__); resource_found:
@@ -319,7 +321,8 @@ }else if (pages_mapped <=32 ) {PCXL_FREE_MAPPINGS (res_idx, mask,32 ); }else { -panic (__FILE__": pcxl_free_range() Too many pages to unmap.\n" ); +panic ("%s: pcxl_free_range() Too many pages to unmap.\n" , + __FILE__); } pcxl_used_pages -= (pages_mapped ? pages_mapped :1 );
arch/parisc/math-emu/decode_exc.c +1 -1
@@ -347,7 +347,7 @@return SIGNALCODE (SIGFPE ,FPE_FLTRES );default :update_trap_counts (Fpu_register, aflags, bflags, trap_counts); -printk (__FILE__"(%d) Unknown FPU exception 0x%x\n" , +printk ("%s(%d) Unknown FPU exception 0x%x\n" , __FILE__, __LINE__,Excp_type (exception_index));return SIGNALCODE (SIGILL ,ILL_COPROC );case NOEXCEPTION :/* no exception */
drivers/parisc/ccio-dma.c +8 -6
@@ -364,11 +364,11 @@CCIO_FIND_FREE_MAPPING (ioc, res_idx, mask,64 );#endif }else { -panic (__FILE__": %s() Too many pages to map. pages_needed: %ld\n" , - __FUNCTION__, pages_needed); +panic ("%s: %s() Too many pages to map. pages_needed: %ld\n" , + __FILE__, __FUNCTION__, pages_needed); } -panic (__FILE__": %s() I/O MMU is out of mapping resources.\n" , +panic ("%s: %s() I/O MMU is out of mapping resources.\n" , __FILE__, __FUNCTION__); resource_found:
@@ -441,7 +441,7 @@CCIO_FREE_MAPPINGS (ioc, res_idx, mask,64 );#endif }else { -panic (__FILE__":%s() Too many pages to unmap.\n" , +panic ("%s:%s() Too many pages to unmap.\n" , __FILE__, __FUNCTION__); } }
@@ -1447,7 +1447,8 @@ ioc->pdir_base = (u64 *)__get_free_pages (GFP_KERNEL ,get_order (ioc->pdir_size));if (NULL == ioc->pdir_base) { -panic (__FILE__":%s() could not allocate I/O Page Table\n" , __FUNCTION__); +panic ("%s:%s() could not allocate I/O Page Table\n" , __FILE__, + __FUNCTION__); }memset (ioc->pdir_base,0 , ioc->pdir_size);
@@ -1461,7 +1462,8 @@ ioc->res_map = (u8 *)__get_free_pages (GFP_KERNEL ,get_order (ioc->res_size));if (NULL == ioc->res_map) { -panic (__FILE__":%s() could not allocate resource map\n" , __FUNCTION__); +panic ("%s:%s() could not allocate resource map\n" , __FILE__, + __FUNCTION__); }memset (ioc->res_map,0 , ioc->res_size);
drivers/parisc/sba_iommu.c +4 -2
@@ -579,7 +579,8 @@if (pide >= (ioc->res_size <<3 )) { pide =sba_search_bitmap (ioc, pages_needed);if (pide >= (ioc->res_size <<3 )) -panic (__FILE__": I/O MMU @ %lx is out of mapping resources\n" , ioc->ioc_hpa); +panic ("%s: I/O MMU @ %lx is out of mapping resources\n" , + __FILE__, ioc->ioc_hpa); }#ifdef ASSERT_PDIR_SANITY
@@ -1781,7 +1782,8 @@if (NULL == sba_dev->ioc[i].res_map) { -panic (__FILE__":%s() could not allocate resource map\n" , __FUNCTION__ ); +panic ("%s:%s() could not allocate resource map\n" , + __FILE__, __FUNCTION__ ); }memset (sba_dev->ioc[i].res_map,0 , res_size);
include/asm-parisc/pci.h +2 -1
@@ -29,7 +29,8 @@#ifdef PCI_DEBUG #define ASSERT (expr) \ if(!(expr)) { \ - printk( "\n" __FILE__ ":%d: Assertion " #expr " failed!\n",__LINE__); \ + printk("\n%s:%d: Assertion " #expr " failed!\n", __FILE__, + __LINE__); \ panic(#expr); \ }#else
oops sory,
Quoted 10 lines · Joel Soete
Hi all,
May I sugest following printk changes:
=========><=========
diff -Naurlinux-2.6.0-pa5/include/asm-parisc/pci.hlinux-2.6.0-pa5.new/include/asm-parisc/pci.h
---linux-2.6.0-pa5/include/asm-parisc/pci.h2003-12-27
16:36:55.000000000 +0100
+++linux-2.6.0-pa5.new/include/asm-parisc/pci.h2003-12-27
18:12:53.303140000 +0100
Review line 33
Quoted 6 lines
(quoted diff) +1
-1@@ -29,7 +29,8 @@ #ifdef PCI_DEBUG #define ASSERT(expr) \ if(!(expr)) { \ - printk( "\n" __FILE__ ":%d: Assertion " #expr " failed!\n",__LINE__); \ + printk("\n%s:%d: Assertion " #expr " failed!\n", __FILE__,
there is a typo ^^
should be better read __FILE__, \
Quoted 6 lines
(quoted diff) +1
-0+ __LINE__); \ panic(#expr); \ }#else
=========><=========
Appologies,
J.
arch/parisc/kernel/pci-dma.c +6 -3
@@ -261,11 +261,13 @@ }else if (pages_needed <=32 ) {PCXL_FIND_FREE_MAPPING (res_idx, mask,32 ); }else { -panic (__FILE__": pcxl_alloc_range() Too many pages to map.\n" ); +panic ("%s: pcxl_alloc_range() Too many pages to map.\n" , + __FILE__); }dump_resmap (); -panic (__FILE__": pcxl_alloc_range() out of dma mapping resources\n" ); +panic ("%s: pcxl_alloc_range() out of dma mapping resources\n" , + __FILE__); resource_found:
@@ -319,7 +321,8 @@ }else if (pages_mapped <=32 ) {PCXL_FREE_MAPPINGS (res_idx, mask,32 ); }else { -panic (__FILE__": pcxl_free_range() Too many pages to unmap.\n" ); +panic ("%s: pcxl_free_range() Too many pages to unmap.\n" , + __FILE__); } pcxl_used_pages -= (pages_mapped ? pages_mapped :1 );
arch/parisc/math-emu/decode_exc.c +1 -1
@@ -347,7 +347,7 @@return SIGNALCODE (SIGFPE ,FPE_FLTRES );default :update_trap_counts (Fpu_register, aflags, bflags, trap_counts); -printk (__FILE__"(%d) Unknown FPU exception 0x%x\n" , +printk ("%s(%d) Unknown FPU exception 0x%x\n" , __FILE__, __LINE__,Excp_type (exception_index));return SIGNALCODE (SIGILL ,ILL_COPROC );case NOEXCEPTION :/* no exception */
drivers/parisc/ccio-dma.c +8 -6
@@ -364,11 +364,11 @@CCIO_FIND_FREE_MAPPING (ioc, res_idx, mask,64 );#endif }else { -panic (__FILE__": %s() Too many pages to map. pages_needed: %ld\n" , - __FUNCTION__, pages_needed); +panic ("%s: %s() Too many pages to map. pages_needed: %ld\n" , + __FILE__, __FUNCTION__, pages_needed); } -panic (__FILE__": %s() I/O MMU is out of mapping resources.\n" , +panic ("%s: %s() I/O MMU is out of mapping resources.\n" , __FILE__, __FUNCTION__); resource_found:
@@ -441,7 +441,7 @@CCIO_FREE_MAPPINGS (ioc, res_idx, mask,64 );#endif }else { -panic (__FILE__":%s() Too many pages to unmap.\n" , +panic ("%s:%s() Too many pages to unmap.\n" , __FILE__, __FUNCTION__); } }
@@ -1447,7 +1447,8 @@ ioc->pdir_base = (u64 *)__get_free_pages (GFP_KERNEL ,get_order (ioc->pdir_size));if (NULL == ioc->pdir_base) { -panic (__FILE__":%s() could not allocate I/O Page Table\n" , __FUNCTION__); +panic ("%s:%s() could not allocate I/O Page Table\n" , __FILE__, + __FUNCTION__); }memset (ioc->pdir_base,0 , ioc->pdir_size);
@@ -1461,7 +1462,8 @@ ioc->res_map = (u8 *)__get_free_pages (GFP_KERNEL ,get_order (ioc->res_size));if (NULL == ioc->res_map) { -panic (__FILE__":%s() could not allocate resource map\n" , __FUNCTION__); +panic ("%s:%s() could not allocate resource map\n" , __FILE__, + __FUNCTION__); }memset (ioc->res_map,0 , ioc->res_size);
drivers/parisc/sba_iommu.c +4 -2
@@ -579,7 +579,8 @@if (pide >= (ioc->res_size <<3 )) { pide =sba_search_bitmap (ioc, pages_needed);if (pide >= (ioc->res_size <<3 )) -panic (__FILE__": I/O MMU @ %lx is out of mapping resources\n" , ioc->ioc_hpa); +panic ("%s: I/O MMU @ %lx is out of mapping resources\n" , + __FILE__, ioc->ioc_hpa); }#ifdef ASSERT_PDIR_SANITY
@@ -1781,7 +1782,8 @@if (NULL == sba_dev->ioc[i].res_map) { -panic (__FILE__":%s() could not allocate resource map\n" , __FUNCTION__ ); +panic ("%s:%s() could not allocate resource map\n" , + __FILE__, __FUNCTION__ ); }memset (sba_dev->ioc[i].res_map,0 , res_size);
include/asm-parisc/pci.h +2 -1
@@ -29,7 +29,8 @@#ifdef PCI_DEBUG #define ASSERT (expr) \ if(!(expr)) { \ - printk( "\n" __FILE__ ":%d: Assertion " #expr " failed!\n",__LINE__); \ + printk("\n%s:%d: Assertion " #expr " failed!\n", __FILE__, \ + __LINE__); \ panic(#expr); \ }#else
Helge Deller
maintainerQuoted 2 lines · Joel Soete
PS: I also notice some printk("\n"
KERNEL_... "..."); would it not be better to change in printk(KERNEL_... "\n...");
Mostly: No.
The "\n" is there to finish some previous printk()s and the KERNEL_xx in the middle of the strings is needed after a \n to put the printed string in the right context (e.g. this ensures the text to be prefixed correctly in the kernel syslog).
Helge
Review
Quoted 4 lines · Joel Soete
(quoted diff) +0
-1- panic(__FILE__ ": pcxl_alloc_range() Too many pages tomap.\n");
(quoted diff) +2
-0+ panic("%s: pcxl_alloc_range() Too many pages to map.\n", + __FILE__);
thanks - I applied this patch (plus correction in pci.h)
grant