Skip to content

Commit 56bbd86

Browse files
committed
m68k/sun3: Modernize printing of kernel messages
- Convert from printk() to pr_*(), - Add missing continuations, - Do not print nonexistent len variable, - Add missing sysname[] variable, - Correct printf()-style format specifiers. Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent 446926f commit 56bbd86

File tree

6 files changed

+54
-59
lines changed

6 files changed

+54
-59
lines changed

arch/m68k/sun3/config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void __init config_sun3(void)
134134
{
135135
unsigned long memory_start, memory_end;
136136

137-
printk("ARCH: SUN3\n");
137+
pr_info("ARCH: SUN3\n");
138138
idprom_init();
139139

140140
/* Subtract kernel memory from available memory */

arch/m68k/sun3/dvma.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ static unsigned long dvma_page(unsigned long kaddr, unsigned long vaddr)
3131

3232
ptep = pfn_pte(virt_to_pfn(kaddr), PAGE_KERNEL);
3333
pte = pte_val(ptep);
34-
// printk("dvma_remap: addr %lx -> %lx pte %08lx len %x\n",
35-
// kaddr, vaddr, pte, len);
34+
// pr_info("dvma_remap: addr %lx -> %lx pte %08lx\n", kaddr, vaddr, pte);
3635
if(ptelist[(vaddr & 0xff000) >> PAGE_SHIFT] != pte) {
3736
sun3_put_pte(vaddr, pte);
3837
ptelist[(vaddr & 0xff000) >> PAGE_SHIFT] = pte;

arch/m68k/sun3/idprom.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,14 @@ static void __init display_system_type(unsigned char machtype)
6464
for (i = 0; i < NUM_SUN_MACHINES; i++) {
6565
if(Sun_Machines[i].id_machtype == machtype) {
6666
if (machtype != (SM_SUN4M_OBP | 0x00))
67-
printk("TYPE: %s\n", Sun_Machines[i].name);
67+
pr_info("TYPE: %s\n", Sun_Machines[i].name);
6868
else {
6969
#if 0
70+
char sysname[128];
71+
7072
prom_getproperty(prom_root_node, "banner-name",
7173
sysname, sizeof(sysname));
72-
printk("TYPE: %s\n", sysname);
74+
pr_info("TYPE: %s\n", sysname);
7375
#endif
7476
}
7577
return;
@@ -125,5 +127,5 @@ void __init idprom_init(void)
125127

126128
display_system_type(idprom->id_machtype);
127129

128-
printk("Ethernet address: %pM\n", idprom->id_ethaddr);
130+
pr_info("Ethernet address: %pM\n", idprom->id_ethaddr);
129131
}

arch/m68k/sun3/mmu_emu.c

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,21 @@ void print_pte (pte_t pte)
7272
#if 0
7373
/* Verbose version. */
7474
unsigned long val = pte_val (pte);
75-
printk (" pte=%lx [addr=%lx",
75+
pr_cont(" pte=%lx [addr=%lx",
7676
val, (val & SUN3_PAGE_PGNUM_MASK) << PAGE_SHIFT);
77-
if (val & SUN3_PAGE_VALID) printk (" valid");
78-
if (val & SUN3_PAGE_WRITEABLE) printk (" write");
79-
if (val & SUN3_PAGE_SYSTEM) printk (" sys");
80-
if (val & SUN3_PAGE_NOCACHE) printk (" nocache");
81-
if (val & SUN3_PAGE_ACCESSED) printk (" accessed");
82-
if (val & SUN3_PAGE_MODIFIED) printk (" modified");
77+
if (val & SUN3_PAGE_VALID) pr_cont(" valid");
78+
if (val & SUN3_PAGE_WRITEABLE) pr_cont(" write");
79+
if (val & SUN3_PAGE_SYSTEM) pr_cont(" sys");
80+
if (val & SUN3_PAGE_NOCACHE) pr_cont(" nocache");
81+
if (val & SUN3_PAGE_ACCESSED) pr_cont(" accessed");
82+
if (val & SUN3_PAGE_MODIFIED) pr_cont(" modified");
8383
switch (val & SUN3_PAGE_TYPE_MASK) {
84-
case SUN3_PAGE_TYPE_MEMORY: printk (" memory"); break;
85-
case SUN3_PAGE_TYPE_IO: printk (" io"); break;
86-
case SUN3_PAGE_TYPE_VME16: printk (" vme16"); break;
87-
case SUN3_PAGE_TYPE_VME32: printk (" vme32"); break;
84+
case SUN3_PAGE_TYPE_MEMORY: pr_cont(" memory"); break;
85+
case SUN3_PAGE_TYPE_IO: pr_cont(" io"); break;
86+
case SUN3_PAGE_TYPE_VME16: pr_cont(" vme16"); break;
87+
case SUN3_PAGE_TYPE_VME32: pr_cont(" vme32"); break;
8888
}
89-
printk ("]\n");
89+
pr_cont("]\n");
9090
#else
9191
/* Terse version. More likely to fit on a line. */
9292
unsigned long val = pte_val (pte);
@@ -108,15 +108,15 @@ void print_pte (pte_t pte)
108108
default: type = "unknown?"; break;
109109
}
110110

111-
printk (" pte=%08lx [%07lx %s %s]\n",
111+
pr_cont(" pte=%08lx [%07lx %s %s]\n",
112112
val, (val & SUN3_PAGE_PGNUM_MASK) << PAGE_SHIFT, flags, type);
113113
#endif
114114
}
115115

116116
/* Print the PTE value for a given virtual address. For debugging. */
117117
void print_pte_vaddr (unsigned long vaddr)
118118
{
119-
printk (" vaddr=%lx [%02lx]", vaddr, sun3_get_segmap (vaddr));
119+
pr_cont(" vaddr=%lx [%02lx]", vaddr, sun3_get_segmap (vaddr));
120120
print_pte (__pte (sun3_get_pte (vaddr)));
121121
}
122122

@@ -153,7 +153,7 @@ void __init mmu_emu_init(unsigned long bootmem_end)
153153

154154
if(!pmeg_alloc[i]) {
155155
#ifdef DEBUG_MMU_EMU
156-
printk("freed: ");
156+
pr_info("freed:");
157157
print_pte_vaddr (seg);
158158
#endif
159159
sun3_put_segmap(seg, SUN3_INVALID_PMEG);
@@ -165,7 +165,7 @@ void __init mmu_emu_init(unsigned long bootmem_end)
165165
if (sun3_get_segmap (seg) != SUN3_INVALID_PMEG) {
166166
#ifdef DEBUG_PROM_MAPS
167167
for(i = 0; i < 16; i++) {
168-
printk ("mapped:");
168+
pr_info("mapped:");
169169
print_pte_vaddr (seg + (i*PAGE_SIZE));
170170
break;
171171
}
@@ -293,8 +293,8 @@ inline void mmu_emu_map_pmeg (int context, int vaddr)
293293

294294

295295
#ifdef DEBUG_MMU_EMU
296-
printk("mmu_emu_map_pmeg: pmeg %x to context %d vaddr %x\n",
297-
curr_pmeg, context, vaddr);
296+
pr_info("mmu_emu_map_pmeg: pmeg %x to context %d vaddr %x\n",
297+
curr_pmeg, context, vaddr);
298298
#endif
299299

300300
/* Invalidate old mapping for the pmeg, if any */
@@ -370,22 +370,23 @@ int mmu_emu_handle_fault (unsigned long vaddr, int read_flag, int kernel_fault)
370370
}
371371

372372
#ifdef DEBUG_MMU_EMU
373-
printk ("mmu_emu_handle_fault: vaddr=%lx type=%s crp=%p\n",
373+
pr_info("mmu_emu_handle_fault: vaddr=%lx type=%s crp=%p\n",
374374
vaddr, read_flag ? "read" : "write", crp);
375375
#endif
376376

377377
segment = (vaddr >> SUN3_PMEG_SIZE_BITS) & 0x7FF;
378378
offset = (vaddr >> SUN3_PTE_SIZE_BITS) & 0xF;
379379

380380
#ifdef DEBUG_MMU_EMU
381-
printk ("mmu_emu_handle_fault: segment=%lx offset=%lx\n", segment, offset);
381+
pr_info("mmu_emu_handle_fault: segment=%lx offset=%lx\n", segment,
382+
offset);
382383
#endif
383384

384385
pte = (pte_t *) pgd_val (*(crp + segment));
385386

386387
//todo: next line should check for valid pmd properly.
387388
if (!pte) {
388-
// printk ("mmu_emu_handle_fault: invalid pmd\n");
389+
// pr_info("mmu_emu_handle_fault: invalid pmd\n");
389390
return 0;
390391
}
391392

@@ -417,9 +418,9 @@ int mmu_emu_handle_fault (unsigned long vaddr, int read_flag, int kernel_fault)
417418
pte_val (*pte) |= SUN3_PAGE_ACCESSED;
418419

419420
#ifdef DEBUG_MMU_EMU
420-
printk ("seg:%d crp:%p ->", get_fs().seg, crp);
421+
pr_info("seg:%ld crp:%p ->", get_fs().seg, crp);
421422
print_pte_vaddr (vaddr);
422-
printk ("\n");
423+
pr_cont("\n");
423424
#endif
424425

425426
return 1;

arch/m68k/sun3/prom/printf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ prom_printf(char *fmt, ...)
3939

4040
#ifdef CONFIG_KGDB
4141
if (kgdb_initialized) {
42-
printk("kgdb_initialized = %d\n", kgdb_initialized);
42+
pr_info("kgdb_initialized = %d\n", kgdb_initialized);
4343
putpacket(bptr, 1);
4444
} else
4545
#else

arch/m68k/sun3/sun3dvma.c

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,23 @@ static void print_use(void)
6262
int i;
6363
int j = 0;
6464

65-
printk("dvma entry usage:\n");
65+
pr_info("dvma entry usage:\n");
6666

6767
for(i = 0; i < IOMMU_TOTAL_ENTRIES; i++) {
6868
if(!iommu_use[i])
6969
continue;
7070

7171
j++;
7272

73-
printk("dvma entry: %08lx len %08lx\n",
74-
( i << DVMA_PAGE_SHIFT) + DVMA_START,
75-
iommu_use[i]);
73+
pr_info("dvma entry: %08x len %08lx\n",
74+
(i << DVMA_PAGE_SHIFT) + DVMA_START, iommu_use[i]);
7675
}
7776

78-
printk("%d entries in use total\n", j);
77+
pr_info("%d entries in use total\n", j);
7978

80-
printk("allocation/free calls: %lu/%lu\n", dvma_allocs, dvma_frees);
81-
printk("allocation/free bytes: %Lx/%Lx\n", dvma_alloc_bytes,
82-
dvma_free_bytes);
79+
pr_info("allocation/free calls: %lu/%lu\n", dvma_allocs, dvma_frees);
80+
pr_info("allocation/free bytes: %Lx/%Lx\n", dvma_alloc_bytes,
81+
dvma_free_bytes);
8382
}
8483

8584
static void print_holes(struct list_head *holes)
@@ -88,18 +87,18 @@ static void print_holes(struct list_head *holes)
8887
struct list_head *cur;
8988
struct hole *hole;
9089

91-
printk("listing dvma holes\n");
90+
pr_info("listing dvma holes\n");
9291
list_for_each(cur, holes) {
9392
hole = list_entry(cur, struct hole, list);
9493

9594
if((hole->start == 0) && (hole->end == 0) && (hole->size == 0))
9695
continue;
9796

98-
printk("hole: start %08lx end %08lx size %08lx\n", hole->start, hole->end, hole->size);
97+
pr_info("hole: start %08lx end %08lx size %08lx\n",
98+
hole->start, hole->end, hole->size);
9999
}
100100

101-
printk("end of hole listing...\n");
102-
101+
pr_info("end of hole listing...\n");
103102
}
104103
#endif /* DVMA_DEBUG */
105104

@@ -137,7 +136,7 @@ static inline struct hole *rmcache(void)
137136

138137
if(list_empty(&hole_cache)) {
139138
if(!refill()) {
140-
printk("out of dvma hole cache!\n");
139+
pr_crit("out of dvma hole cache!\n");
141140
BUG();
142141
}
143142
}
@@ -157,7 +156,7 @@ static inline unsigned long get_baddr(int len, unsigned long align)
157156

158157
if(list_empty(&hole_list)) {
159158
#ifdef DVMA_DEBUG
160-
printk("out of dvma holes! (printing hole cache)\n");
159+
pr_crit("out of dvma holes! (printing hole cache)\n");
161160
print_holes(&hole_cache);
162161
print_use();
163162
#endif
@@ -195,7 +194,7 @@ static inline unsigned long get_baddr(int len, unsigned long align)
195194

196195
}
197196

198-
printk("unable to find dvma hole!\n");
197+
pr_crit("unable to find dvma hole!\n");
199198
BUG();
200199
return 0;
201200
}
@@ -287,15 +286,12 @@ unsigned long dvma_map_align(unsigned long kaddr, int len, int align)
287286
len = 0x800;
288287

289288
if(!kaddr || !len) {
290-
// printk("error: kaddr %lx len %x\n", kaddr, len);
289+
// pr_err("error: kaddr %lx len %x\n", kaddr, len);
291290
// *(int *)4 = 0;
292291
return 0;
293292
}
294293

295-
#ifdef DEBUG
296-
printk("dvma_map request %08lx bytes from %08lx\n",
297-
len, kaddr);
298-
#endif
294+
pr_debug("dvma_map request %08x bytes from %08lx\n", len, kaddr);
299295
off = kaddr & ~DVMA_PAGE_MASK;
300296
kaddr &= PAGE_MASK;
301297
len += off;
@@ -307,12 +303,13 @@ unsigned long dvma_map_align(unsigned long kaddr, int len, int align)
307303
align = ((align + (DVMA_PAGE_SIZE-1)) & DVMA_PAGE_MASK);
308304

309305
baddr = get_baddr(len, align);
310-
// printk("using baddr %lx\n", baddr);
306+
// pr_info("using baddr %lx\n", baddr);
311307

312308
if(!dvma_map_iommu(kaddr, baddr, len))
313309
return (baddr + off);
314310

315-
printk("dvma_map failed kaddr %lx baddr %lx len %x\n", kaddr, baddr, len);
311+
pr_crit("dvma_map failed kaddr %lx baddr %lx len %x\n", kaddr, baddr,
312+
len);
316313
BUG();
317314
return 0;
318315
}
@@ -343,9 +340,7 @@ void *dvma_malloc_align(unsigned long len, unsigned long align)
343340
if(!len)
344341
return NULL;
345342

346-
#ifdef DEBUG
347-
printk("dvma_malloc request %lx bytes\n", len);
348-
#endif
343+
pr_debug("dvma_malloc request %lx bytes\n", len);
349344
len = ((len + (DVMA_PAGE_SIZE-1)) & DVMA_PAGE_MASK);
350345

351346
if((kaddr = __get_free_pages(GFP_ATOMIC, get_order(len))) == 0)
@@ -364,10 +359,8 @@ void *dvma_malloc_align(unsigned long len, unsigned long align)
364359
return NULL;
365360
}
366361

367-
#ifdef DEBUG
368-
printk("mapped %08lx bytes %08lx kern -> %08lx bus\n",
369-
len, kaddr, baddr);
370-
#endif
362+
pr_debug("mapped %08lx bytes %08lx kern -> %08lx bus\n", len, kaddr,
363+
baddr);
371364

372365
return (void *)vaddr;
373366

0 commit comments

Comments
 (0)