2016-12-07 15:12:19

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 00/22] m68k: Modernize printing of kernel messages

Hi all,

This patch series modernizes the printing of kernel messages in the m68k
architecture core, which is mainly about converting from printk() to
pr_*().

The trigger for (finally) doing this was the user-visible breakage
caused by commit 4bcc595ccd80decb ("printk: reinstate KERN_CONT for
printing continuation lines").

I had hoped to sent this series much earlier, to be still included in
v4.9, but that didn't happen due to lack of time. Fortunately v4.9 will
be an LTS(I) kernel, so the first three patches (tagged with a "Fixes"
tag) will hopefully make it to v4.9.x later ;-)

Compile-tested with my standard set of configs.
Boot-tested on ARAnyM.

Thanks for your comments!

Geert Uytterhoeven (22):
m68k/atari: Modernize printing of kernel messages
m68k/mac: macints - Modernize printing of kernel messages
m68k/mac: via - Modernize printing of kernel messages
m68k/68000: Modernize printing of kernel messages
m68k/bvme6000: Modernize printing of kernel messages
m68k/coldfire: Modernize printing of kernel messages
m68k/mac: baboon - Modernize printing of kernel messages
m68k/mac: iop - Modernize printing of kernel messages
m68k/mac: oss - Modernize printing of kernel messages
m68k/mac: psc - Modernize printing of kernel messages
m68k/mac: Modernize printing of kernel messages
m68k/mvme147: Modernize printing of kernel messages
m68k/mvme16x: Modernize printing of kernel messages
m68k/q40: Modernize printing of kernel messages
m68k/sun3: Modernize printing of kernel messages
m68k/sun3x: Modernize printing of kernel messages
m68k/kernel: Modernize printing of kernel messages
m68k/mm: kmap - Modernize printing of kernel messages
m68k/mm: motorola - Modernize printing of kernel messages
m68k/mm: sun3 - Modernize printing of kernel messages
m68k/mm: Modernize printing of kernel messages
m68k/include: Modernize printing of kernel messages

arch/m68k/68000/m68328.c | 6 +-
arch/m68k/68000/m68EZ328.c | 6 +-
arch/m68k/68000/m68VZ328.c | 6 +-
arch/m68k/atari/atakeyb.c | 14 ++---
arch/m68k/atari/config.c | 56 +++++++++---------
arch/m68k/bvme6000/config.c | 8 +--
arch/m68k/bvme6000/rtc.c | 2 +-
arch/m68k/coldfire/m528x.c | 4 +-
arch/m68k/coldfire/sltimers.c | 4 +-
arch/m68k/coldfire/timers.c | 4 +-
arch/m68k/coldfire/vectors.c | 2 +-
arch/m68k/include/asm/bug.h | 4 +-
arch/m68k/include/asm/dma.h | 98 +++++++++++---------------------
arch/m68k/include/asm/floppy.h | 6 +-
arch/m68k/include/asm/math-emu.h | 10 ++--
arch/m68k/include/asm/mcf_pgtable.h | 9 +--
arch/m68k/include/asm/motorola_pgtable.h | 6 +-
arch/m68k/include/asm/sun3_pgtable.h | 6 +-
arch/m68k/include/asm/sun3xflop.h | 14 ++---
arch/m68k/kernel/dma.c | 4 +-
arch/m68k/kernel/module.c | 12 ++--
arch/m68k/kernel/process.c | 20 +++----
arch/m68k/kernel/signal.c | 24 +++-----
arch/m68k/kernel/uboot.c | 3 +-
arch/m68k/mac/baboon.c | 22 ++++---
arch/m68k/mac/config.c | 34 ++++++-----
arch/m68k/mac/iop.c | 69 ++++++++++------------
arch/m68k/mac/macints.c | 42 +++++++-------
arch/m68k/mac/misc.c | 8 +--
arch/m68k/mac/oss.c | 26 +++++----
arch/m68k/mac/psc.c | 32 +++++------
arch/m68k/mac/via.c | 54 +++++++++---------
arch/m68k/mm/init.c | 2 +-
arch/m68k/mm/kmap.c | 26 ++++-----
arch/m68k/mm/memory.c | 4 +-
arch/m68k/mm/motorola.c | 32 ++++-------
arch/m68k/mm/sun3kmap.c | 5 +-
arch/m68k/mvme147/config.c | 2 +-
arch/m68k/mvme16x/config.c | 32 +++++------
arch/m68k/mvme16x/rtc.c | 2 +-
arch/m68k/q40/config.c | 14 ++---
arch/m68k/q40/q40ints.c | 15 +++--
arch/m68k/sun3/config.c | 2 +-
arch/m68k/sun3/dvma.c | 3 +-
arch/m68k/sun3/idprom.c | 8 ++-
arch/m68k/sun3/mmu_emu.c | 47 +++++++--------
arch/m68k/sun3/prom/printf.c | 2 +-
arch/m68k/sun3/sun3dvma.c | 51 +++++++----------
arch/m68k/sun3x/dvma.c | 35 +++++-------
arch/m68k/sun3x/prom.c | 4 +-
50 files changed, 412 insertions(+), 489 deletions(-)

--
1.9.1

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


2016-12-07 15:11:03

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 12/22] m68k/mvme147: Modernize printing of kernel messages

Convert from printk() to pr_*().

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/mvme147/config.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/m68k/mvme147/config.c b/arch/m68k/mvme147/config.c
index c11d38dfad08faa1..8778612d1f312d5c 100644
--- a/arch/m68k/mvme147/config.c
+++ b/arch/m68k/mvme147/config.c
@@ -63,7 +63,7 @@ int __init mvme147_parse_bootinfo(const struct bi_record *bi)

void mvme147_reset(void)
{
- printk ("\r\n\nCalled mvme147_reset\r\n");
+ pr_info("\r\n\nCalled mvme147_reset\r\n");
m147_pcc->watchdog = 0x0a; /* Clear timer */
m147_pcc->watchdog = 0xa5; /* Enable watchdog - 100ms to reset */
while (1)
--
1.9.1

2016-12-07 15:11:05

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 09/22] m68k/mac: oss - Modernize printing of kernel messages

Convert from printk() to pr_*().

- Introduce helpers for printing debug messages, incl. dummies for
validating format strings when debugging is disabled,
- Convert from printk() to pr_*(),
- Drop superfluous casts,
- Add linebreaks before opening braces of function bodies.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/mac/oss.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/arch/m68k/mac/oss.c b/arch/m68k/mac/oss.c
index 55d6592783f55710..e3c22370e9c6ee0d 100644
--- a/arch/m68k/mac/oss.c
+++ b/arch/m68k/mac/oss.c
@@ -26,6 +26,12 @@
#include <asm/mac_via.h>
#include <asm/mac_oss.h>

+#ifdef DEBUG_IRQS
+#define pr_irq(fmt, ...) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#else
+#define pr_irq(fmt, ...) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#endif
+
int oss_present;
volatile struct mac_oss *oss;

@@ -72,8 +78,8 @@ static void oss_irq(struct irq_desc *desc)
if ((console_loglevel == 10) && !(events & OSS_IP_SCSI)) {
unsigned int irq = irq_desc_get_irq(desc);

- printk("oss_irq: irq %u events = 0x%04X\n", irq,
- (int) oss->irq_pending);
+ pr_irq("oss_irq: irq %u events = 0x%04X\n", irq,
+ oss->irq_pending);
}
#endif

@@ -109,7 +115,7 @@ static void oss_nubus_irq(struct irq_desc *desc)

#ifdef DEBUG_NUBUS_INT
if (console_loglevel > 7) {
- printk("oss_nubus_irq: events = 0x%04X\n", events);
+ pr_info("oss_nubus_irq: events = 0x%04X\n", events);
}
#endif
/* There are only six slots on the OSS, not seven */
@@ -162,10 +168,9 @@ void __init oss_register_interrupts(void)
* level for that source to nonzero, thus enabling the interrupt.
*/

-void oss_irq_enable(int irq) {
-#ifdef DEBUG_IRQUSE
- printk("oss_irq_enable(%d)\n", irq);
-#endif
+void oss_irq_enable(int irq)
+{
+ pr_irq("oss_irq_enable(%d)\n", irq);
switch(irq) {
case IRQ_MAC_SCC:
oss->irq_level[OSS_IOPSCC] = OSS_IRQLEV_IOPSCC;
@@ -198,10 +203,9 @@ void oss_irq_enable(int irq) {
* to disable the interrupt.
*/

-void oss_irq_disable(int irq) {
-#ifdef DEBUG_IRQUSE
- printk("oss_irq_disable(%d)\n", irq);
-#endif
+void oss_irq_disable(int irq)
+{
+ pr_irq("oss_irq_disable(%d)\n", irq);
switch(irq) {
case IRQ_MAC_SCC:
oss->irq_level[OSS_IOPSCC] = 0;
--
1.9.1

2016-12-07 15:11:04

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 03/22] m68k/mac: via - Modernize printing of kernel messages

- Introduce helpers for printing debug messages, incl. dummies for
validating format strings when debugging is disabled,
- Convert from printk() to pr_*(),
- Add missing continuations, to fix user-visible breakage,
- Drop superfluous casts.

Fixes: 4bcc595ccd80decb ("printk: reinstate KERN_CONT for printing continuation lines")
Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/mac/via.c | 54 ++++++++++++++++++++++++++---------------------------
1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/arch/m68k/mac/via.c b/arch/m68k/mac/via.c
index 920ff63d4a81d77a..7c53b10d93817d9c 100644
--- a/arch/m68k/mac/via.c
+++ b/arch/m68k/mac/via.c
@@ -36,6 +36,12 @@
#include <asm/mac_psc.h>
#include <asm/mac_oss.h>

+#ifdef DEBUG_IRQUSE
+#define pr_irq(fmt, ...) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#else
+#define pr_irq(fmt, ...) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#endif
+
volatile __u8 *via1, *via2;
int rbv_present;
int via_alt_mapping;
@@ -168,15 +174,15 @@ void __init via_init(void)
panic("UNKNOWN VIA TYPE");
}

- printk(KERN_INFO "VIA1 at %p is a 6522 or clone\n", via1);
+ pr_info("VIA1 at %p is a 6522 or clone\n", via1);

- printk(KERN_INFO "VIA2 at %p is ", via2);
+ pr_info("VIA2 at %p is ", via2);
if (rbv_present) {
- printk("an RBV\n");
+ pr_cont("an RBV\n");
} else if (oss_present) {
- printk("an OSS\n");
+ pr_cont("an OSS\n");
} else {
- printk("a 6522 or clone\n");
+ pr_cont("a 6522 or clone\n");
}

#ifdef DEBUG_VIA
@@ -299,24 +305,22 @@ void __init via_init_clock(irq_handler_t func)

void via_debug_dump(void)
{
- printk(KERN_DEBUG "VIA1: DDRA = 0x%02X DDRB = 0x%02X ACR = 0x%02X\n",
- (uint) via1[vDirA], (uint) via1[vDirB], (uint) via1[vACR]);
- printk(KERN_DEBUG " PCR = 0x%02X IFR = 0x%02X IER = 0x%02X\n",
- (uint) via1[vPCR], (uint) via1[vIFR], (uint) via1[vIER]);
+ pr_debug("VIA1: DDRA = 0x%02X DDRB = 0x%02X ACR = 0x%02X\n",
+ via1[vDirA], via1[vDirB], via1[vACR]);
+ pr_debug(" PCR = 0x%02X IFR = 0x%02X IER = 0x%02X\n",
+ via1[vPCR], via1[vIFR], via1[vIER]);
if (oss_present) {
- printk(KERN_DEBUG "VIA2: <OSS>\n");
+ pr_debug("VIA2: <OSS>\n");
} else if (rbv_present) {
- printk(KERN_DEBUG "VIA2: IFR = 0x%02X IER = 0x%02X\n",
- (uint) via2[rIFR], (uint) via2[rIER]);
- printk(KERN_DEBUG " SIFR = 0x%02X SIER = 0x%02X\n",
- (uint) via2[rSIFR], (uint) via2[rSIER]);
+ pr_debug("VIA2: IFR = 0x%02X IER = 0x%02X\n", via2[rIFR],
+ via2[rIER]);
+ pr_debug(" SIFR = 0x%02X SIER = 0x%02X\n", via2[rSIFR],
+ via2[rSIER]);
} else {
- printk(KERN_DEBUG "VIA2: DDRA = 0x%02X DDRB = 0x%02X ACR = 0x%02X\n",
- (uint) via2[vDirA], (uint) via2[vDirB],
- (uint) via2[vACR]);
- printk(KERN_DEBUG " PCR = 0x%02X IFR = 0x%02X IER = 0x%02X\n",
- (uint) via2[vPCR],
- (uint) via2[vIFR], (uint) via2[vIER]);
+ pr_debug("VIA2: DDRA = 0x%02X DDRB = 0x%02X ACR = 0x%02X\n",
+ via2[vDirA], via2[vDirB], via2[vACR]);
+ pr_debug(" PCR = 0x%02X IFR = 0x%02X IER = 0x%02X\n",
+ via2[vPCR], via2[vIFR], via2[vIER]);
}
}

@@ -362,7 +366,7 @@ int via_get_cache_disable(void)
{
/* Safeguard against being called accidentally */
if (!via2) {
- printk(KERN_ERR "via_get_cache_disable called on a non-VIA machine!\n");
+ pr_err("via_get_cache_disable called on a non-VIA machine!\n");
return 1;
}

@@ -550,9 +554,7 @@ void via_irq_enable(int irq) {
int irq_src = IRQ_SRC(irq);
int irq_idx = IRQ_IDX(irq);

-#ifdef DEBUG_IRQUSE
- printk(KERN_DEBUG "via_irq_enable(%d)\n", irq);
-#endif
+ pr_irq("via_irq_enable(%d)\n", irq);

if (irq_src == 1) {
via1[vIER] = IER_SET_BIT(irq_idx);
@@ -582,9 +584,7 @@ void via_irq_disable(int irq) {
int irq_src = IRQ_SRC(irq);
int irq_idx = IRQ_IDX(irq);

-#ifdef DEBUG_IRQUSE
- printk(KERN_DEBUG "via_irq_disable(%d)\n", irq);
-#endif
+ pr_irq("via_irq_disable(%d)\n", irq);

if (irq_src == 1) {
via1[vIER] = IER_CLR_BIT(irq_idx);
--
1.9.1

2016-12-07 15:11:44

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 19/22] m68k/mm: motorola - Modernize printing of kernel messages

- Convert from printk() to pr_*(),
- Remove #undef DEBUG,
- Add missing continuations.

Note that "#ifdef DEBUG" is sometimes retained because pr_cont() is not
optimized away when debugging is disabled.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/include/asm/motorola_pgtable.h | 6 +++---
arch/m68k/mm/motorola.c | 32 ++++++++++++--------------------
2 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/arch/m68k/include/asm/motorola_pgtable.h b/arch/m68k/include/asm/motorola_pgtable.h
index 0085aab80e5a76aa..df651bdd5f21f3b7 100644
--- a/arch/m68k/include/asm/motorola_pgtable.h
+++ b/arch/m68k/include/asm/motorola_pgtable.h
@@ -153,11 +153,11 @@ static inline void pgd_set(pgd_t *pgdp, pmd_t *pmdp)
#define pgd_page(pgd) (mem_map + ((unsigned long)(__va(pgd_val(pgd)) - PAGE_OFFSET) >> PAGE_SHIFT))

#define pte_ERROR(e) \
- printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
+ pr_err("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
#define pmd_ERROR(e) \
- printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e))
+ pr_err("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e))
#define pgd_ERROR(e) \
- printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
+ pr_err("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))


/*
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
index 8f37fdd80be9e9cc..9f83a70c796c3303 100644
--- a/arch/m68k/mm/motorola.c
+++ b/arch/m68k/mm/motorola.c
@@ -32,8 +32,6 @@
#endif
#include <asm/sections.h>

-#undef DEBUG
-
#ifndef mm_cachebits
/*
* Bits to add to page descriptors for "normal" caching mode.
@@ -86,9 +84,7 @@ static pmd_t * __init kernel_ptr_table(void)
}

last_pgtable = (pmd_t *)last;
-#ifdef DEBUG
- printk("kernel_ptr_init: %p\n", last_pgtable);
-#endif
+ pr_debug("kernel_ptr_init: %p\n", last_pgtable);
}

last_pgtable += PTRS_PER_PMD;
@@ -124,7 +120,7 @@ static void __init map_node(int node)
while (size > 0) {
#ifdef DEBUG
if (!(virtaddr & (PTRTREESIZE-1)))
- printk ("\npa=%#lx va=%#lx ", physaddr & PAGE_MASK,
+ pr_cont("\npa=%#lx va=%#lx ", physaddr & PAGE_MASK,
virtaddr);
#endif
pgd_dir = pgd_offset_k(virtaddr);
@@ -132,7 +128,7 @@ static void __init map_node(int node)
if (!(virtaddr & (ROOTTREESIZE-1)) &&
size >= ROOTTREESIZE) {
#ifdef DEBUG
- printk ("[very early term]");
+ pr_cont("[very early term]");
#endif
pgd_val(*pgd_dir) = physaddr;
size -= ROOTTREESIZE;
@@ -144,7 +140,7 @@ static void __init map_node(int node)
if (!pgd_present(*pgd_dir)) {
pmd_dir = kernel_ptr_table();
#ifdef DEBUG
- printk ("[new pointer %p]", pmd_dir);
+ pr_cont("[new pointer %p]", pmd_dir);
#endif
pgd_set(pgd_dir, pmd_dir);
} else
@@ -153,14 +149,14 @@ static void __init map_node(int node)
if (CPU_IS_020_OR_030) {
if (virtaddr) {
#ifdef DEBUG
- printk ("[early term]");
+ pr_cont("[early term]");
#endif
pmd_dir->pmd[(virtaddr/PTRTREESIZE) & 15] = physaddr;
physaddr += PTRTREESIZE;
} else {
int i;
#ifdef DEBUG
- printk ("[zero map]");
+ pr_cont("[zero map]");
#endif
zero_pgtable = kernel_ptr_table();
pte_dir = (pte_t *)zero_pgtable;
@@ -176,7 +172,7 @@ static void __init map_node(int node)
} else {
if (!pmd_present(*pmd_dir)) {
#ifdef DEBUG
- printk ("[new table]");
+ pr_cont("[new table]");
#endif
pte_dir = kernel_page_table();
pmd_set(pmd_dir, pte_dir);
@@ -195,7 +191,7 @@ static void __init map_node(int node)

}
#ifdef DEBUG
- printk("\n");
+ pr_cont("\n");
#endif
}

@@ -210,9 +206,7 @@ void __init paging_init(void)
unsigned long addr, size, end;
int i;

-#ifdef DEBUG
- printk ("start of paging_init (%p, %lx)\n", kernel_pg_dir, availmem);
-#endif
+ pr_debug("start of paging_init (%p, %lx)\n", kernel_pg_dir, availmem);

/* Fix the cache mode in the page descriptors for the 680[46]0. */
if (CPU_IS_040_OR_060) {
@@ -228,9 +222,9 @@ void __init paging_init(void)
max_addr = min_addr + m68k_memory[0].size;
for (i = 1; i < m68k_num_memory;) {
if (m68k_memory[i].addr < min_addr) {
- printk("Ignoring memory chunk at 0x%lx:0x%lx before the first chunk\n",
+ pr_warn("Ignoring memory chunk at 0x%lx:0x%lx before the first chunk\n",
m68k_memory[i].addr, m68k_memory[i].size);
- printk("Fix your bootloader or use a memfile to make use of this area!\n");
+ pr_warn("Fix your bootloader or use a memfile to make use of this area!\n");
m68k_num_memory--;
memmove(m68k_memory + i, m68k_memory + i + 1,
(m68k_num_memory - i) * sizeof(struct m68k_mem_info));
@@ -294,9 +288,7 @@ void __init paging_init(void)
*/
set_fs(KERNEL_DS);

-#ifdef DEBUG
- printk ("before free_area_init\n");
-#endif
+ pr_debug("before free_area_init\n");
for (i = 0; i < m68k_num_memory; i++) {
zones_size[ZONE_DMA] = m68k_memory[i].size >> PAGE_SHIFT;
free_area_init_node(i, zones_size,
--
1.9.1

2016-12-07 15:12:16

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 16/22] m68k/sun3x: Modernize printing of kernel messages

- Convert from printk() to pr_*(),
- Remove #undef DEBUG,
- Drop useless Warning prefix,
- Use TABs for indentation while at it.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/include/asm/sun3xflop.h | 14 +++++++-------
arch/m68k/sun3x/dvma.c | 35 +++++++++++++----------------------
arch/m68k/sun3x/prom.c | 4 ++--
3 files changed, 22 insertions(+), 31 deletions(-)

diff --git a/arch/m68k/include/asm/sun3xflop.h b/arch/m68k/include/asm/sun3xflop.h
index a02ea3a7bb20a029..159269b7f2e8d61e 100644
--- a/arch/m68k/include/asm/sun3xflop.h
+++ b/arch/m68k/include/asm/sun3xflop.h
@@ -48,7 +48,7 @@ static unsigned char sun3x_82072_fd_inb(int port)
// udelay(5);
switch(port & 7) {
default:
- printk("floppy: Asked to read unknown port %d\n", port);
+ pr_crit("floppy: Asked to read unknown port %d\n", port);
panic("floppy: Port bolixed.");
case 4: /* FD_STATUS */
return (*sun3x_fdc.status_r) & ~STATUS_DMA;
@@ -70,7 +70,7 @@ static void sun3x_82072_fd_outb(unsigned char value, int port)
// udelay(5);
switch(port & 7) {
default:
- printk("floppy: Asked to write to unknown port %d\n", port);
+ pr_crit("floppy: Asked to write to unknown port %d\n", port);
panic("floppy: Port bolixed.");
case 2: /* FD_DOR */
/* Oh geese, 82072 on the Sun has no DOR register,
@@ -127,7 +127,7 @@ asmlinkage irqreturn_t sun3xflop_hardint(int irq, void *dev_id)
return IRQ_HANDLED;
}

-// printk("doing pdma\n");// st %x\n", sun_fdc->status_82072);
+// pr_info("doing pdma\n");// st %x\n", sun_fdc->status_82072);

#ifdef TRACE_FLPY_INT
if(!calls)
@@ -171,7 +171,7 @@ asmlinkage irqreturn_t sun3xflop_hardint(int irq, void *dev_id)
#ifdef TRACE_FLPY_INT
calls++;
#endif
-// printk("st=%02x\n", st);
+// pr_info("st=%02x\n", st);
if(st == 0x20)
return IRQ_HANDLED;
if(!(st & 0x20)) {
@@ -180,9 +180,9 @@ asmlinkage irqreturn_t sun3xflop_hardint(int irq, void *dev_id)
doing_pdma = 0;

#ifdef TRACE_FLPY_INT
- printk("count=%x, residue=%x calls=%d bytes=%x dma_wait=%d\n",
- virtual_dma_count, virtual_dma_residue, calls, bytes,
- dma_wait);
+ pr_info("count=%x, residue=%x calls=%d bytes=%x dma_wait=%d\n",
+ virtual_dma_count, virtual_dma_residue, calls, bytes,
+ dma_wait);
calls = 0;
dma_wait=0;
#endif
diff --git a/arch/m68k/sun3x/dvma.c b/arch/m68k/sun3x/dvma.c
index d5ddcdaa23473561..9413c8724b0d3372 100644
--- a/arch/m68k/sun3x/dvma.c
+++ b/arch/m68k/sun3x/dvma.c
@@ -58,21 +58,17 @@
((addr & 0x03c00000) >> \
(DVMA_PAGE_SHIFT+4)))

-#undef DEBUG
-
#ifdef DEBUG
/* code to print out a dvma mapping for debugging purposes */
void dvma_print (unsigned long dvma_addr)
{

- unsigned long index;
-
- index = dvma_addr >> DVMA_PAGE_SHIFT;
-
- printk("idx %lx dvma_addr %08lx paddr %08lx\n", index, dvma_addr,
- dvma_entry_paddr(index));
+ unsigned long index;

+ index = dvma_addr >> DVMA_PAGE_SHIFT;

+ pr_info("idx %lx dvma_addr %08lx paddr %08lx\n", index, dvma_addr,
+ dvma_entry_paddr(index));
}
#endif

@@ -91,10 +87,7 @@ inline int dvma_map_cpu(unsigned long kaddr,

end = PAGE_ALIGN(vaddr + len);

-#ifdef DEBUG
- printk("dvma: mapping kern %08lx to virt %08lx\n",
- kaddr, vaddr);
-#endif
+ pr_debug("dvma: mapping kern %08lx to virt %08lx\n", kaddr, vaddr);
pgd = pgd_offset_k(vaddr);

do {
@@ -126,10 +119,8 @@ inline int dvma_map_cpu(unsigned long kaddr,
end3 = end2;

do {
-#ifdef DEBUG
- printk("mapping %08lx phys to %08lx\n",
- __pa(kaddr), vaddr);
-#endif
+ pr_debug("mapping %08lx phys to %08lx\n",
+ __pa(kaddr), vaddr);
set_pte(pte, pfn_pte(virt_to_pfn(kaddr),
PAGE_KERNEL));
pte++;
@@ -162,7 +153,8 @@ inline int dvma_map_iommu(unsigned long kaddr, unsigned long baddr,
for(; index < end ; index++) {
// if(dvma_entry_use(index))
// BUG();
-// printk("mapping pa %lx to ba %lx\n", __pa(kaddr), index << DVMA_PAGE_SHIFT);
+// pr_info("mapping pa %lx to ba %lx\n", __pa(kaddr),
+// index << DVMA_PAGE_SHIFT);

dvma_entry_set(index, __pa(kaddr));

@@ -190,13 +182,12 @@ void dvma_unmap_iommu(unsigned long baddr, int len)
end = (DVMA_PAGE_ALIGN(baddr+len) >> DVMA_PAGE_SHIFT);

for(; index < end ; index++) {
-#ifdef DEBUG
- printk("freeing bus mapping %08x\n", index << DVMA_PAGE_SHIFT);
-#endif
+ pr_debug("freeing bus mapping %08x\n",
+ index << DVMA_PAGE_SHIFT);
#if 0
if(!dvma_entry_use(index))
- printk("dvma_unmap freeing unused entry %04x\n",
- index);
+ pr_info("dvma_unmap freeing unused entry %04x\n",
+ index);
else
dvma_entry_dec(index);
#endif
diff --git a/arch/m68k/sun3x/prom.c b/arch/m68k/sun3x/prom.c
index 0898c3f8150851a3..5d60e65c1ee5274e 100644
--- a/arch/m68k/sun3x/prom.c
+++ b/arch/m68k/sun3x/prom.c
@@ -106,9 +106,9 @@ void __init sun3x_prom_init(void)
idprom_init();

if (!((idprom->id_machtype & SM_ARCH_MASK) == SM_SUN3X)) {
- printk("Warning: machine reports strange type %02x\n",
+ pr_warn("Machine reports strange type %02x\n",
idprom->id_machtype);
- printk("Pretending it's a 3/80, but very afraid...\n");
+ pr_warn("Pretending it's a 3/80, but very afraid...\n");
idprom->id_machtype = SM_SUN3X | SM_3_80;
}

--
1.9.1

2016-12-07 15:12:17

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 21/22] m68k/mm: Modernize printing of kernel messages

Convert from printk() to pr_*().

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/mm/init.c | 2 +-
arch/m68k/mm/memory.c | 4 +---
2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index b09a3cb29b68fda4..7f5dd339a311800e 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -66,7 +66,7 @@ void __init m68k_setup_node(int node)
end = (unsigned long)phys_to_virt(info->addr + info->size - 1) >> __virt_to_node_shift();
for (; i <= end; i++) {
if (pg_data_table[i])
- printk("overlap at %u for chunk %u\n", i, node);
+ pr_warn("overlap at %u for chunk %u\n", i, node);
pg_data_table[i] = pg_data_map + node;
}
#endif
diff --git a/arch/m68k/mm/memory.c b/arch/m68k/mm/memory.c
index 51bc9d258ede39b8..4902b681a9fccf3f 100644
--- a/arch/m68k/mm/memory.c
+++ b/arch/m68k/mm/memory.c
@@ -47,9 +47,7 @@ void __init init_pointer_table(unsigned long ptable)
}

PD_MARKBITS(dp) &= ~mask;
-#ifdef DEBUG
- printk("init_pointer_table: %lx, %x\n", ptable, PD_MARKBITS(dp));
-#endif
+ pr_debug("init_pointer_table: %lx, %x\n", ptable, PD_MARKBITS(dp));

/* unreserve the page so it's possible to free that page */
PD_PAGE(dp)->flags &= ~(1 << PG_reserved);
--
1.9.1

2016-12-07 15:12:15

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 22/22] m68k/include: Modernize printing of kernel messages

- Convert from printk() to pr_*(),
- Add dummies for validating format strings when debugging is
disabled.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/include/asm/bug.h | 4 ++--
arch/m68k/include/asm/floppy.h | 6 +++---
arch/m68k/include/asm/math-emu.h | 10 +++++-----
3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/m68k/include/asm/bug.h b/arch/m68k/include/asm/bug.h
index ef9a2e47352f0d8a..5bc8d91d68d42bf0 100644
--- a/arch/m68k/include/asm/bug.h
+++ b/arch/m68k/include/asm/bug.h
@@ -6,12 +6,12 @@
#ifdef CONFIG_DEBUG_BUGVERBOSE
#ifndef CONFIG_SUN3
#define BUG() do { \
- printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
+ pr_crit("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
__builtin_trap(); \
} while (0)
#else
#define BUG() do { \
- printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
+ pr_crit("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
panic("BUG!"); \
} while (0)
#endif
diff --git a/arch/m68k/include/asm/floppy.h b/arch/m68k/include/asm/floppy.h
index 47365b1ccbecfeb9..c3b9ad6732fc68cc 100644
--- a/arch/m68k/include/asm/floppy.h
+++ b/arch/m68k/include/asm/floppy.h
@@ -234,9 +234,9 @@ asmlinkage irqreturn_t floppy_hardint(int irq, void *dev_id)
virtual_dma_residue += virtual_dma_count;
virtual_dma_count=0;
#ifdef TRACE_FLPY_INT
- printk("count=%x, residue=%x calls=%d bytes=%d dma_wait=%d\n",
- virtual_dma_count, virtual_dma_residue, calls, bytes,
- dma_wait);
+ pr_info("count=%x, residue=%x calls=%d bytes=%d dma_wait=%d\n",
+ virtual_dma_count, virtual_dma_residue, calls, bytes,
+ dma_wait);
calls = 0;
dma_wait=0;
#endif
diff --git a/arch/m68k/include/asm/math-emu.h b/arch/m68k/include/asm/math-emu.h
index 5e9249b0014ca0fc..b062696d5a0d99aa 100644
--- a/arch/m68k/include/asm/math-emu.h
+++ b/arch/m68k/include/asm/math-emu.h
@@ -105,21 +105,21 @@ struct fp_data {
#ifdef FPU_EMU_DEBUG
extern unsigned int fp_debugprint;

-#define dprint(bit, fmt, args...) ({ \
+#define dprint(bit, fmt, ...) ({ \
if (fp_debugprint & (1 << (bit))) \
- printk(fmt, ## args); \
+ pr_info(fmt, ##__VA_ARGS__); \
})
#else
-#define dprint(bit, fmt, args...)
+#define dprint(bit, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
#endif

#define uprint(str) ({ \
static int __count = 3; \
\
if (__count > 0) { \
- printk("You just hit an unimplemented " \
+ pr_err("You just hit an unimplemented " \
"fpu instruction (%s)\n", str); \
- printk("Please report this to ....\n"); \
+ pr_err("Please report this to ....\n"); \
__count--; \
} \
})
--
1.9.1

2016-12-07 15:12:14

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 18/22] m68k/mm: kmap - Modernize printing of kernel messages

- Convert from printk() to pr_*(),
- Add missing continuations,
- Remove #undef DEBUG.

Note that "#ifdef DEBUG" is sometimes retained because pr_cont() is not
optimized away when debugging is disabled.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/mm/kmap.c | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/arch/m68k/mm/kmap.c b/arch/m68k/mm/kmap.c
index 6e4955bc542bfc59..ce4773461651656a 100644
--- a/arch/m68k/mm/kmap.c
+++ b/arch/m68k/mm/kmap.c
@@ -21,8 +21,6 @@
#include <asm/pgalloc.h>
#include <asm/io.h>

-#undef DEBUG
-
#define PTRTREESIZE (256*1024)

/*
@@ -125,9 +123,7 @@ void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cachefla
}
#endif

-#ifdef DEBUG
- printk("ioremap: 0x%lx,0x%lx(%d) - ", physaddr, size, cacheflag);
-#endif
+ pr_debug("ioremap: 0x%lx,0x%lx(%d) - ", physaddr, size, cacheflag);
/*
* Mappings have to be aligned
*/
@@ -145,7 +141,7 @@ void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cachefla
virtaddr = (unsigned long)area->addr;
retaddr = virtaddr + offset;
#ifdef DEBUG
- printk("0x%lx,0x%lx,0x%lx", physaddr, virtaddr, retaddr);
+ pr_cont("0x%lx,0x%lx,0x%lx", physaddr, virtaddr, retaddr);
#endif

/*
@@ -187,12 +183,12 @@ void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cachefla
while ((long)size > 0) {
#ifdef DEBUG
if (!(virtaddr & (PTRTREESIZE-1)))
- printk ("\npa=%#lx va=%#lx ", physaddr, virtaddr);
+ pr_info("\npa=%#lx va=%#lx ", physaddr, virtaddr);
#endif
pgd_dir = pgd_offset_k(virtaddr);
pmd_dir = pmd_alloc(&init_mm, pgd_dir, virtaddr);
if (!pmd_dir) {
- printk("ioremap: no mem for pmd_dir\n");
+ pr_err("ioremap: no mem for pmd_dir\n");
return NULL;
}

@@ -204,7 +200,7 @@ void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cachefla
} else {
pte_dir = pte_alloc_kernel(pmd_dir, virtaddr);
if (!pte_dir) {
- printk("ioremap: no mem for pte_dir\n");
+ pr_err("ioremap: no mem for pte_dir\n");
return NULL;
}

@@ -215,7 +211,7 @@ void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cachefla
}
}
#ifdef DEBUG
- printk("\n");
+ pr_cont("\n");
#endif
flush_tlb_all();

@@ -254,7 +250,7 @@ void __iounmap(void *addr, unsigned long size)
while ((long)size > 0) {
pgd_dir = pgd_offset_k(virtaddr);
if (pgd_bad(*pgd_dir)) {
- printk("iounmap: bad pgd(%08lx)\n", pgd_val(*pgd_dir));
+ pr_err("iounmap: bad pgd(%08lx)\n", pgd_val(*pgd_dir));
pgd_clear(pgd_dir);
return;
}
@@ -274,7 +270,7 @@ void __iounmap(void *addr, unsigned long size)
}

if (pmd_bad(*pmd_dir)) {
- printk("iounmap: bad pmd (%08lx)\n", pmd_val(*pmd_dir));
+ pr_err("iounmap: bad pmd (%08lx)\n", pmd_val(*pmd_dir));
pmd_clear(pmd_dir);
return;
}
@@ -332,7 +328,8 @@ void kernel_set_cachemode(void *addr, unsigned long size, int cmode)
while ((long)size > 0) {
pgd_dir = pgd_offset_k(virtaddr);
if (pgd_bad(*pgd_dir)) {
- printk("iocachemode: bad pgd(%08lx)\n", pgd_val(*pgd_dir));
+ pr_err("iocachemode: bad pgd(%08lx)\n",
+ pgd_val(*pgd_dir));
pgd_clear(pgd_dir);
return;
}
@@ -351,7 +348,8 @@ void kernel_set_cachemode(void *addr, unsigned long size, int cmode)
}

if (pmd_bad(*pmd_dir)) {
- printk("iocachemode: bad pmd (%08lx)\n", pmd_val(*pmd_dir));
+ pr_err("iocachemode: bad pmd (%08lx)\n",
+ pmd_val(*pmd_dir));
pmd_clear(pmd_dir);
return;
}
--
1.9.1

2016-12-07 15:13:26

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 17/22] m68k/kernel: Modernize printing of kernel messages

- Use pr_err_ratelimited() instead of deprecated printk_ratelimit(),
- Add dummies for validating format strings when debugging is
disabled,
- Convert from printk() to pr_*(),
- Correct printf()-style format specifiers.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/kernel/dma.c | 4 ++--
arch/m68k/kernel/module.c | 12 ++++++------
arch/m68k/kernel/process.c | 20 ++++++++++----------
arch/m68k/kernel/signal.c | 24 +++++++-----------------
arch/m68k/kernel/uboot.c | 3 +--
5 files changed, 26 insertions(+), 37 deletions(-)

diff --git a/arch/m68k/kernel/dma.c b/arch/m68k/kernel/dma.c
index 8cf97cbadc91a705..805c6ccb23ef1bd5 100644
--- a/arch/m68k/kernel/dma.c
+++ b/arch/m68k/kernel/dma.c
@@ -110,8 +110,8 @@ static void m68k_dma_sync_single_for_device(struct device *dev,
cache_clear(handle, size);
break;
default:
- if (printk_ratelimit())
- printk("dma_sync_single_for_device: unsupported dir %u\n", dir);
+ pr_err_ratelimited("dma_sync_single_for_device: unsupported dir %u\n",
+ dir);
break;
}
}
diff --git a/arch/m68k/kernel/module.c b/arch/m68k/kernel/module.c
index eb46fd6038cac73a..aaac2da318ffd377 100644
--- a/arch/m68k/kernel/module.c
+++ b/arch/m68k/kernel/module.c
@@ -12,9 +12,9 @@
#include <linux/kernel.h>

#if 0
-#define DEBUGP printk
+#define DEBUGP(fmt, ...) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
#else
-#define DEBUGP(fmt...)
+#define DEBUGP(fmt, ...) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
#endif

#ifdef CONFIG_MODULES
@@ -51,8 +51,8 @@ int apply_relocate(Elf32_Shdr *sechdrs,
*location += sym->st_value - (uint32_t)location;
break;
default:
- printk(KERN_ERR "module %s: Unknown relocation: %u\n",
- me->name, ELF32_R_TYPE(rel[i].r_info));
+ pr_err("module %s: Unknown relocation: %u\n", me->name,
+ ELF32_R_TYPE(rel[i].r_info));
return -ENOEXEC;
}
}
@@ -91,8 +91,8 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
*location = rel[i].r_addend + sym->st_value - (uint32_t)location;
break;
default:
- printk(KERN_ERR "module %s: Unknown relocation: %u\n",
- me->name, ELF32_R_TYPE(rel[i].r_info));
+ pr_err("module %s: Unknown relocation: %u\n", me->name,
+ ELF32_R_TYPE(rel[i].r_info));
return -ENOEXEC;
}
}
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index 4ba1ae7345c324c9..2be5720e649ff42e 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -87,17 +87,17 @@ void machine_power_off(void)

void show_regs(struct pt_regs * regs)
{
- printk("\n");
- printk("Format %02x Vector: %04x PC: %08lx Status: %04x %s\n",
- regs->format, regs->vector, regs->pc, regs->sr, print_tainted());
- printk("ORIG_D0: %08lx D0: %08lx A2: %08lx A1: %08lx\n",
- regs->orig_d0, regs->d0, regs->a2, regs->a1);
- printk("A0: %08lx D5: %08lx D4: %08lx\n",
- regs->a0, regs->d5, regs->d4);
- printk("D3: %08lx D2: %08lx D1: %08lx\n",
- regs->d3, regs->d2, regs->d1);
+ pr_info("Format %02x Vector: %04x PC: %08lx Status: %04x %s\n",
+ regs->format, regs->vector, regs->pc, regs->sr,
+ print_tainted());
+ pr_info("ORIG_D0: %08lx D0: %08lx A2: %08lx A1: %08lx\n",
+ regs->orig_d0, regs->d0, regs->a2, regs->a1);
+ pr_info("A0: %08lx D5: %08lx D4: %08lx\n", regs->a0, regs->d5,
+ regs->d4);
+ pr_info("D3: %08lx D2: %08lx D1: %08lx\n", regs->d3, regs->d2,
+ regs->d1);
if (!(regs->sr & PS_S))
- printk("USP: %08lx\n", rdusp());
+ pr_info("USP: %08lx\n", rdusp());
}

void flush_thread(void)
diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
index 58507edbdf1d5fa8..ef471c87776d92c7 100644
--- a/arch/m68k/kernel/signal.c
+++ b/arch/m68k/kernel/signal.c
@@ -598,9 +598,7 @@ static int mangle_kernel_stack(struct pt_regs *regs, int formatvec,
/*
* user process trying to return with weird frame format
*/
-#ifdef DEBUG
- printk("user process returning with weird frame format\n");
-#endif
+ pr_debug("user process returning with weird frame format\n");
return 1;
}
if (!fsize) {
@@ -846,10 +844,8 @@ static int setup_frame(struct ksignal *ksig, sigset_t *set,
int err = 0, sig = ksig->sig;

if (fsize < 0) {
-#ifdef DEBUG
- printk ("setup_frame: Unknown frame format %#x\n",
- regs->format);
-#endif
+ pr_debug("setup_frame: Unknown frame format %#x\n",
+ regs->format);
return -EFAULT;
}

@@ -905,9 +901,7 @@ static int setup_frame(struct ksignal *ksig, sigset_t *set,
if (regs->stkadj) {
struct pt_regs *tregs =
(struct pt_regs *)((ulong)regs + regs->stkadj);
-#ifdef DEBUG
- printk("Performing stackadjust=%04x\n", regs->stkadj);
-#endif
+ pr_debug("Performing stackadjust=%04lx\n", regs->stkadj);
/* This must be copied with decreasing addresses to
handle overlaps. */
tregs->vector = 0;
@@ -926,10 +920,8 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
int err = 0, sig = ksig->sig;

if (fsize < 0) {
-#ifdef DEBUG
- printk ("setup_frame: Unknown frame format %#x\n",
- regs->format);
-#endif
+ pr_debug("setup_frame: Unknown frame format %#x\n",
+ regs->format);
return -EFAULT;
}

@@ -993,9 +985,7 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
if (regs->stkadj) {
struct pt_regs *tregs =
(struct pt_regs *)((ulong)regs + regs->stkadj);
-#ifdef DEBUG
- printk("Performing stackadjust=%04x\n", regs->stkadj);
-#endif
+ pr_debug("Performing stackadjust=%04lx\n", regs->stkadj);
/* This must be copied with decreasing addresses to
handle overlaps. */
tregs->vector = 0;
diff --git a/arch/m68k/kernel/uboot.c b/arch/m68k/kernel/uboot.c
index b3536a82a26202b6..b29c3b241e1bb590 100644
--- a/arch/m68k/kernel/uboot.c
+++ b/arch/m68k/kernel/uboot.c
@@ -83,8 +83,7 @@ static void __init parse_uboot_commandline(char *commandp, int size)
initrd_start = uboot_initrd_start;
initrd_end = uboot_initrd_end;
ROOT_DEV = Root_RAM0;
- printk(KERN_INFO "initrd at 0x%lx:0x%lx\n",
- initrd_start, initrd_end);
+ pr_info("initrd at 0x%lx:0x%lx\n", initrd_start, initrd_end);
}
#endif /* if defined(CONFIG_BLK_DEV_INITRD) */
}
--
1.9.1

2016-12-07 15:11:00

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 11/22] m68k/mac: Modernize printing of kernel messages

Convert from printk() to pr_*().

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/mac/config.c | 34 ++++++++++++++++------------------
arch/m68k/mac/misc.c | 8 ++++----
2 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index e46895316eb0ef4d..1d7bc6ab3e7fe1b4 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -150,7 +150,7 @@ static void mac_cache_card_flush(int writeback)
void __init config_mac(void)
{
if (!MACH_IS_MAC)
- printk(KERN_ERR "ERROR: no Mac, but config_mac() called!!\n");
+ pr_err("ERROR: no Mac, but config_mac() called!!\n");

mach_sched_init = mac_sched_init;
mach_init_IRQ = mac_init_IRQ;
@@ -837,8 +837,7 @@ static void __init mac_identify(void)
/* no bootinfo model id -> NetBSD booter was used! */
/* XXX FIXME: breaks for model > 31 */
model = (mac_bi_data.cpuid >> 2) & 63;
- printk(KERN_WARNING "No bootinfo model ID, using cpuid instead "
- "(obsolete bootloader?)\n");
+ pr_warn("No bootinfo model ID, using cpuid instead (obsolete bootloader?)\n");
}

macintosh_config = mac_data_table;
@@ -880,24 +879,23 @@ static void __init mac_identify(void)
*/
iop_preinit();

- printk(KERN_INFO "Detected Macintosh model: %d\n", model);
+ pr_info("Detected Macintosh model: %d\n", model);

/*
* Report booter data:
*/
- printk(KERN_DEBUG " Penguin bootinfo data:\n");
- printk(KERN_DEBUG " Video: addr 0x%lx "
- "row 0x%lx depth %lx dimensions %ld x %ld\n",
- mac_bi_data.videoaddr, mac_bi_data.videorow,
- mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
- mac_bi_data.dimensions >> 16);
- printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
- mac_bi_data.videological, mac_orig_videoaddr,
- mac_bi_data.sccbase);
- printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n",
- mac_bi_data.boottime, mac_bi_data.gmtbias);
- printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
- mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
+ pr_debug(" Penguin bootinfo data:\n");
+ pr_debug(" Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
+ mac_bi_data.videoaddr, mac_bi_data.videorow,
+ mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
+ mac_bi_data.dimensions >> 16);
+ pr_debug(" Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
+ mac_bi_data.videological, mac_orig_videoaddr,
+ mac_bi_data.sccbase);
+ pr_debug(" Boottime: 0x%lx GMTBias: 0x%lx\n", mac_bi_data.boottime,
+ mac_bi_data.gmtbias);
+ pr_debug(" Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
+ mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);

iop_init();
via_init();
@@ -912,7 +910,7 @@ static void __init mac_identify(void)

static void __init mac_report_hardware(void)
{
- printk(KERN_INFO "Apple Macintosh %s\n", macintosh_config->name);
+ pr_info("Apple Macintosh %s\n", macintosh_config->name);
}

static void mac_get_model(char *str)
diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c
index 0fb54a90eac27305..676e0caaeaa670a0 100644
--- a/arch/m68k/mac/misc.c
+++ b/arch/m68k/mac/misc.c
@@ -520,7 +520,7 @@ void mac_poweroff(void)
#endif
}
local_irq_enable();
- printk("It is now safe to turn off your Macintosh.\n");
+ pr_info("It is now safe to turn off your Macintosh.\n");
while(1);
}

@@ -610,7 +610,7 @@ void mac_reset(void)

/* should never get here */
local_irq_enable();
- printk ("Restart failed. Please restart manually.\n");
+ pr_err("Restart failed. Please restart manually.\n");
while(1);
}

@@ -718,13 +718,13 @@ int mac_hwclk(int op, struct rtc_time *t)
&t->tm_year, &t->tm_mon, &t->tm_mday,
&t->tm_hour, &t->tm_min, &t->tm_sec);
#if 0
- printk("mac_hwclk: read %04d-%02d-%-2d %02d:%02d:%02d\n",
+ pr_info("mac_hwclk: read %04d-%02d-%-2d %02d:%02d:%02d\n",
t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
t->tm_hour, t->tm_min, t->tm_sec);
#endif
} else { /* write */
#if 0
- printk("mac_hwclk: tried to write %04d-%02d-%-2d %02d:%02d:%02d\n",
+ pr_info("mac_hwclk: tried to write %04d-%02d-%-2d %02d:%02d:%02d\n",
t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
t->tm_hour, t->tm_min, t->tm_sec);
#endif
--
1.9.1

2016-12-07 15:13:51

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 02/22] m68k/mac: macints - Modernize printing of kernel messages

- Introduce helpers for printing debug messages, incl. dummies for
validating format strings when debugging is disabled,
- Convert from printk() to pr_*(),
- Add missing continuations, to fix user-visible breakage.

Fixes: 4bcc595ccd80decb ("printk: reinstate KERN_CONT for printing continuation lines")
Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/mac/macints.c | 42 ++++++++++++++++++++++--------------------
1 file changed, 22 insertions(+), 20 deletions(-)

diff --git a/arch/m68k/mac/macints.c b/arch/m68k/mac/macints.c
index 9f98c08719010e27..8572290cb93b6679 100644
--- a/arch/m68k/mac/macints.c
+++ b/arch/m68k/mac/macints.c
@@ -135,6 +135,11 @@
irqreturn_t mac_debug_handler(int, void *);

/* #define DEBUG_MACINTS */
+#ifdef DEBUG_MACINTS
+#define pr_irq(fmt, ...) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#else
+#define pr_irq(fmt, ...) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#endif

static unsigned int mac_irq_startup(struct irq_data *);
static void mac_irq_shutdown(struct irq_data *);
@@ -149,20 +154,18 @@

void __init mac_init_IRQ(void)
{
-#ifdef DEBUG_MACINTS
- printk("mac_init_IRQ(): Setting things up...\n");
-#endif
+ pr_irq("mac_init_IRQ(): Setting things up...\n");
m68k_setup_irq_controller(&mac_irq_chip, handle_simple_irq, IRQ_USER,
NUM_MAC_SOURCES - IRQ_USER);
/* Make sure the SONIC interrupt is cleared or things get ugly */
#ifdef SHUTUP_SONIC
- printk("Killing onboard sonic... ");
+ pr_info("Killing onboard sonic... ");
/* This address should hopefully be mapped already */
if (hwreg_present((void*)(0x50f0a000))) {
*(long *)(0x50f0a014) = 0x7fffL;
*(long *)(0x50f0a010) = 0L;
}
- printk("Done.\n");
+ pr_cont("Done.\n");
#endif /* SHUTUP_SONIC */

/*
@@ -182,9 +185,7 @@ void __init mac_init_IRQ(void)
if (request_irq(IRQ_AUTO_7, mac_nmi_handler, 0, "NMI",
mac_nmi_handler))
pr_err("Couldn't register NMI\n");
-#ifdef DEBUG_MACINTS
- printk("mac_init_IRQ(): Done!\n");
-#endif
+ pr_irq("mac_init_IRQ(): Done!\n");
}

/*
@@ -281,7 +282,7 @@ static void mac_irq_shutdown(struct irq_data *data)
irqreturn_t mac_debug_handler(int irq, void *dev_id)
{
if (num_debug[irq] < 10) {
- printk("DEBUG: Unexpected IRQ %d\n", irq);
+ pr_info("DEBUG: Unexpected IRQ %d\n", irq);
num_debug[irq]++;
}
return IRQ_HANDLED;
@@ -304,9 +305,9 @@ irqreturn_t mac_nmi_handler(int irq, void *dev_id)

if (in_nmi == 1) {
nmi_hold = 1;
- printk("... pausing, press NMI to resume ...");
+ pr_info("... pausing, press NMI to resume ...");
} else {
- printk(" ok!\n");
+ pr_cont(" ok!\n");
nmi_hold = 0;
}

@@ -319,20 +320,21 @@ irqreturn_t mac_nmi_handler(int irq, void *dev_id)
#if 0
struct pt_regs *fp = get_irq_regs();
show_state();
- printk("PC: %08lx\nSR: %04x SP: %p\n", fp->pc, fp->sr, fp);
- printk("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
- fp->d0, fp->d1, fp->d2, fp->d3);
- printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
- fp->d4, fp->d5, fp->a0, fp->a1);
+ pr_info("PC: %08lx\nSR: %04x SP: %p\n", fp->pc, fp->sr, fp);
+ pr_info("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
+ fp->d0, fp->d1, fp->d2, fp->d3);
+ pr_info("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
+ fp->d4, fp->d5, fp->a0, fp->a1);

if (STACK_MAGIC != *(unsigned long *)current->kernel_stack_page)
- printk("Corrupted stack page\n");
- printk("Process %s (pid: %d, stackpage=%08lx)\n",
- current->comm, current->pid, current->kernel_stack_page);
+ pr_info("Corrupted stack page\n");
+ pr_info("Process %s (pid: %d, stackpage=%08lx)\n",
+ current->comm, current->pid,
+ current->kernel_stack_page);
if (intr_count == 1)
dump_stack((struct frame *)fp);
#else
- /* printk("NMI "); */
+ /* pr_info("NMI "); */
#endif
}
in_nmi--;
--
1.9.1

2016-12-07 15:13:50

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 08/22] m68k/mac: iop - Modernize printing of kernel messages

- Introduce helpers for printing debug messages, incl. dummies for
validating format strings when debugging is disabled,
- Convert from printk() to pr_*(),
- Add missing continuations,
- Drop superfluous casts.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/mac/iop.c | 69 ++++++++++++++++++++++-------------------------------
1 file changed, 29 insertions(+), 40 deletions(-)

diff --git a/arch/m68k/mac/iop.c b/arch/m68k/mac/iop.c
index 7990b6f50105b19b..bbfeded6b270f950 100644
--- a/arch/m68k/mac/iop.c
+++ b/arch/m68k/mac/iop.c
@@ -116,6 +116,13 @@
#include <asm/mac_iop.h>

/*#define DEBUG_IOP*/
+#ifdef DEBUG_IOP
+#define pr_iop(fmt, ...) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_iop_cont(fmt, ...) pr_cont(fmt, ##__VA_ARGS__)
+#else
+#define pr_iop(fmt, ...) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_iop_cont(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
+#endif

/* Non-zero if the IOPs are present */

@@ -268,10 +275,10 @@ void __init iop_init(void)
int i;

if (iop_scc_present) {
- printk("IOP: detected SCC IOP at %p\n", iop_base[IOP_NUM_SCC]);
+ pr_info("IOP: detected SCC IOP at %p\n", iop_base[IOP_NUM_SCC]);
}
if (iop_ism_present) {
- printk("IOP: detected ISM IOP at %p\n", iop_base[IOP_NUM_ISM]);
+ pr_info("IOP: detected ISM IOP at %p\n", iop_base[IOP_NUM_ISM]);
iop_start(iop_base[IOP_NUM_ISM]);
iop_alive(iop_base[IOP_NUM_ISM]); /* clears the alive flag */
}
@@ -310,9 +317,9 @@ void __init iop_register_interrupts(void)
pr_err("Couldn't register ISM IOP interrupt\n");
}
if (!iop_alive(iop_base[IOP_NUM_ISM])) {
- printk("IOP: oh my god, they killed the ISM IOP!\n");
+ pr_warn("IOP: oh my god, they killed the ISM IOP!\n");
} else {
- printk("IOP: the ISM IOP seems to be alive.\n");
+ pr_info("IOP: the ISM IOP seems to be alive.\n");
}
}
}
@@ -349,9 +356,8 @@ void iop_complete_message(struct iop_msg *msg)
int chan = msg->channel;
int i,offset;

-#ifdef DEBUG_IOP
- printk("iop_complete(%p): iop %d chan %d\n", msg, msg->iop_num, msg->channel);
-#endif
+ pr_iop("iop_complete(%p): iop %d chan %d\n", msg, msg->iop_num,
+ msg->channel);

offset = IOP_ADDR_RECV_MSG + (msg->channel * IOP_MSG_LEN);

@@ -397,9 +403,7 @@ static void iop_handle_send(uint iop_num, uint chan)
struct iop_msg *msg,*msg2;
int i,offset;

-#ifdef DEBUG_IOP
- printk("iop_handle_send: iop %d channel %d\n", iop_num, chan);
-#endif
+ pr_iop("iop_handle_send: iop %d channel %d\n", iop_num, chan);

iop_writeb(iop, IOP_ADDR_SEND_STATE + chan, IOP_MSG_IDLE);

@@ -430,9 +434,7 @@ static void iop_handle_recv(uint iop_num, uint chan)
int i,offset;
struct iop_msg *msg;

-#ifdef DEBUG_IOP
- printk("iop_handle_recv: iop %d channel %d\n", iop_num, chan);
-#endif
+ pr_iop("iop_handle_recv: iop %d channel %d\n", iop_num, chan);

msg = iop_alloc_msg();
msg->iop_num = iop_num;
@@ -454,13 +456,14 @@ static void iop_handle_recv(uint iop_num, uint chan)
if (msg->handler) {
(*msg->handler)(msg);
} else {
+ pr_iop("iop_handle_recv: unclaimed message on iop %d channel %d\n",
+ iop_num, chan);
#ifdef DEBUG_IOP
- printk("iop_handle_recv: unclaimed message on iop %d channel %d\n", iop_num, chan);
- printk("iop_handle_recv:");
+ pr_iop("iop_handle_recv:");
for (i = 0 ; i < IOP_MSG_LEN ; i++) {
- printk(" %02X", (uint) msg->message[i]);
+ pr_cont(" %02X", msg->message[i]);
}
- printk("\n");
+ pr_iop_cont("\n");
#endif
iop_complete_message(msg);
}
@@ -574,50 +577,36 @@ irqreturn_t iop_ism_irq(int irq, void *dev_id)
volatile struct mac_iop *iop = iop_base[iop_num];
int i,state;

-#ifdef DEBUG_IOP
- printk("iop_ism_irq: status = %02X\n", (uint) iop->status_ctrl);
-#endif
+ pr_iop("iop_ism_irq: status = %02X\n", iop->status_ctrl);

/* INT0 indicates a state change on an outgoing message channel */

if (iop->status_ctrl & IOP_INT0) {
iop->status_ctrl = IOP_INT0 | IOP_RUN | IOP_AUTOINC;
-#ifdef DEBUG_IOP
- printk("iop_ism_irq: new status = %02X, send states",
- (uint) iop->status_ctrl);
-#endif
+ pr_iop("iop_ism_irq: new status = %02X, send states",
+ iop->status_ctrl);
for (i = 0 ; i < NUM_IOP_CHAN ; i++) {
state = iop_readb(iop, IOP_ADDR_SEND_STATE + i);
-#ifdef DEBUG_IOP
- printk(" %02X", state);
-#endif
+ pr_iop_cont(" %02X", state);
if (state == IOP_MSG_COMPLETE) {
iop_handle_send(iop_num, i);
}
}
-#ifdef DEBUG_IOP
- printk("\n");
-#endif
+ pr_iop_cont("\n");
}

if (iop->status_ctrl & IOP_INT1) { /* INT1 for incoming msgs */
iop->status_ctrl = IOP_INT1 | IOP_RUN | IOP_AUTOINC;
-#ifdef DEBUG_IOP
- printk("iop_ism_irq: new status = %02X, recv states",
- (uint) iop->status_ctrl);
-#endif
+ pr_iop("iop_ism_irq: new status = %02X, recv states",
+ iop->status_ctrl);
for (i = 0 ; i < NUM_IOP_CHAN ; i++) {
state = iop_readb(iop, IOP_ADDR_RECV_STATE + i);
-#ifdef DEBUG_IOP
- printk(" %02X", state);
-#endif
+ pr_iop_cont(" %02X", state);
if (state == IOP_MSG_NEW) {
iop_handle_recv(iop_num, i);
}
}
-#ifdef DEBUG_IOP
- printk("\n");
-#endif
+ pr_iop_cont("\n");
}
return IRQ_HANDLED;
}
--
1.9.1

2016-12-07 15:16:42

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 01/22] m68k/atari: Modernize printing of kernel messages

- Convert from printk() to pr_*(),
- Add missing continuations, to fix user-visible breakage,
- Drop useless WARNING prefix,
- Move trailing spaces to start of continuations.

Fixes: 4bcc595ccd80decb ("printk: reinstate KERN_CONT for printing continuation lines")
Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/atari/atakeyb.c | 14 ++++++------
arch/m68k/atari/config.c | 56 +++++++++++++++++++++++------------------------
2 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c
index 264db11268039329..37091898adb3d3b5 100644
--- a/arch/m68k/atari/atakeyb.c
+++ b/arch/m68k/atari/atakeyb.c
@@ -149,7 +149,7 @@ static irqreturn_t atari_keyboard_interrupt(int irq, void *dummy)
if (acia_stat & ACIA_OVRN) {
/* a very fast typist or a slow system, give a warning */
/* ...happens often if interrupts were disabled for too long */
- printk(KERN_DEBUG "Keyboard overrun\n");
+ pr_debug("Keyboard overrun\n");
scancode = acia.key_data;
if (ikbd_self_test)
/* During self test, don't do resyncing, just process the code */
@@ -228,14 +228,14 @@ static irqreturn_t atari_keyboard_interrupt(int irq, void *dummy)
keytyp = KTYP(keyval) - 0xf0;
keyval = KVAL(keyval);

- printk(KERN_WARNING "Key with scancode %d ", scancode);
+ pr_warn("Key with scancode %d ", scancode);
if (keytyp == KT_LATIN || keytyp == KT_LETTER) {
if (keyval < ' ')
- printk("('^%c') ", keyval + '@');
+ pr_cont("('^%c') ", keyval + '@');
else
- printk("('%c') ", keyval);
+ pr_cont("('%c') ", keyval);
}
- printk("is broken -- will be ignored.\n");
+ pr_cont("is broken -- will be ignored.\n");
break;
} else if (test_bit(scancode, broken_keys))
break;
@@ -299,7 +299,7 @@ static irqreturn_t atari_keyboard_interrupt(int irq, void *dummy)
#endif

if (acia_stat & (ACIA_FE | ACIA_PE)) {
- printk("Error in keyboard communication\n");
+ pr_err("Error in keyboard communication\n");
}

/* handle_scancode() can take a lot of time, so check again if
@@ -553,7 +553,7 @@ int atari_keyb_init(void)
barrier();
/* if not incremented: no 0xf1 received */
if (ikbd_self_test == 1)
- printk(KERN_ERR "WARNING: keyboard self test failed!\n");
+ pr_err("Keyboard self test failed!\n");
ikbd_self_test = 0;

ikbd_mouse_disable();
diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index 97a3c38cd1f550cc..fdfc2c3cf1457f82 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -234,44 +234,44 @@ void __init config_atari(void)
* Determine hardware present
*/

- printk("Atari hardware found: ");
+ pr_info("Atari hardware found:");
if (MACH_IS_MEDUSA) {
/* There's no Atari video hardware on the Medusa, but all the
* addresses below generate a DTACK so no bus error occurs! */
} else if (hwreg_present(f030_xreg)) {
ATARIHW_SET(VIDEL_SHIFTER);
- printk("VIDEL ");
+ pr_cont(" VIDEL");
/* This is a temporary hack: If there is Falcon video
* hardware, we assume that the ST-DMA serves SCSI instead of
* ACSI. In the future, there should be a better method for
* this...
*/
ATARIHW_SET(ST_SCSI);
- printk("STDMA-SCSI ");
+ pr_cont(" STDMA-SCSI");
} else if (hwreg_present(tt_palette)) {
ATARIHW_SET(TT_SHIFTER);
- printk("TT_SHIFTER ");
+ pr_cont(" TT_SHIFTER");
} else if (hwreg_present(&shifter.bas_hi)) {
if (hwreg_present(&shifter.bas_lo) &&
(shifter.bas_lo = 0x0aau, shifter.bas_lo == 0x0aau)) {
ATARIHW_SET(EXTD_SHIFTER);
- printk("EXTD_SHIFTER ");
+ pr_cont(" EXTD_SHIFTER");
} else {
ATARIHW_SET(STND_SHIFTER);
- printk("STND_SHIFTER ");
+ pr_cont(" STND_SHIFTER");
}
}
if (hwreg_present(&st_mfp.par_dt_reg)) {
ATARIHW_SET(ST_MFP);
- printk("ST_MFP ");
+ pr_cont(" ST_MFP");
}
if (hwreg_present(&tt_mfp.par_dt_reg)) {
ATARIHW_SET(TT_MFP);
- printk("TT_MFP ");
+ pr_cont(" TT_MFP");
}
if (hwreg_present(&tt_scsi_dma.dma_addr_hi)) {
ATARIHW_SET(SCSI_DMA);
- printk("TT_SCSI_DMA ");
+ pr_cont(" TT_SCSI_DMA");
}
/*
* The ST-DMA address registers aren't readable
@@ -284,27 +284,27 @@ void __init config_atari(void)
(st_dma.dma_vhi = 0xaa) && (st_dma.dma_hi = 0x55) &&
st_dma.dma_vhi == 0xaa && st_dma.dma_hi == 0x55)) {
ATARIHW_SET(EXTD_DMA);
- printk("EXTD_DMA ");
+ pr_cont(" EXTD_DMA");
}
if (hwreg_present(&tt_scsi.scsi_data)) {
ATARIHW_SET(TT_SCSI);
- printk("TT_SCSI ");
+ pr_cont(" TT_SCSI");
}
if (hwreg_present(&sound_ym.rd_data_reg_sel)) {
ATARIHW_SET(YM_2149);
- printk("YM2149 ");
+ pr_cont(" YM2149");
}
if (!MACH_IS_MEDUSA && hwreg_present(&tt_dmasnd.ctrl)) {
ATARIHW_SET(PCM_8BIT);
- printk("PCM ");
+ pr_cont(" PCM");
}
if (hwreg_present(&falcon_codec.unused5)) {
ATARIHW_SET(CODEC);
- printk("CODEC ");
+ pr_cont(" CODEC");
}
if (hwreg_present(&dsp56k_host_interface.icr)) {
ATARIHW_SET(DSP56K);
- printk("DSP56K ");
+ pr_cont(" DSP56K");
}
if (hwreg_present(&tt_scc_dma.dma_ctrl) &&
#if 0
@@ -316,33 +316,33 @@ void __init config_atari(void)
#endif
) {
ATARIHW_SET(SCC_DMA);
- printk("SCC_DMA ");
+ pr_cont(" SCC_DMA");
}
if (scc_test(&atari_scc.cha_a_ctrl)) {
ATARIHW_SET(SCC);
- printk("SCC ");
+ pr_cont(" SCC");
}
if (scc_test(&st_escc.cha_b_ctrl)) {
ATARIHW_SET(ST_ESCC);
- printk("ST_ESCC ");
+ pr_cont(" ST_ESCC");
}
if (hwreg_present(&tt_scu.sys_mask)) {
ATARIHW_SET(SCU);
/* Assume a VME bus if there's a SCU */
ATARIHW_SET(VME);
- printk("VME SCU ");
+ pr_cont(" VME SCU");
}
if (hwreg_present((void *)(0xffff9210))) {
ATARIHW_SET(ANALOG_JOY);
- printk("ANALOG_JOY ");
+ pr_cont(" ANALOG_JOY");
}
if (hwreg_present(blitter.halftone)) {
ATARIHW_SET(BLITTER);
- printk("BLITTER ");
+ pr_cont(" BLITTER");
}
if (hwreg_present((void *)0xfff00039)) {
ATARIHW_SET(IDE);
- printk("IDE ");
+ pr_cont(" IDE");
}
#if 1 /* This maybe wrong */
if (!MACH_IS_MEDUSA && hwreg_present(&tt_microwire.data) &&
@@ -355,31 +355,31 @@ void __init config_atari(void)
ATARIHW_SET(MICROWIRE);
while (tt_microwire.mask != 0x7ff)
;
- printk("MICROWIRE ");
+ pr_cont(" MICROWIRE");
}
#endif
if (hwreg_present(&tt_rtc.regsel)) {
ATARIHW_SET(TT_CLK);
- printk("TT_CLK ");
+ pr_cont(" TT_CLK");
mach_hwclk = atari_tt_hwclk;
mach_set_clock_mmss = atari_tt_set_clock_mmss;
}
if (hwreg_present(&mste_rtc.sec_ones)) {
ATARIHW_SET(MSTE_CLK);
- printk("MSTE_CLK ");
+ pr_cont(" MSTE_CLK");
mach_hwclk = atari_mste_hwclk;
mach_set_clock_mmss = atari_mste_set_clock_mmss;
}
if (!MACH_IS_MEDUSA && hwreg_present(&dma_wd.fdc_speed) &&
hwreg_write(&dma_wd.fdc_speed, 0)) {
ATARIHW_SET(FDCSPEED);
- printk("FDC_SPEED ");
+ pr_cont(" FDC_SPEED");
}
if (!ATARIHW_PRESENT(ST_SCSI)) {
ATARIHW_SET(ACSI);
- printk("ACSI ");
+ pr_cont(" ACSI");
}
- printk("\n");
+ pr_cont("\n");

if (CPU_IS_040_OR_060)
/* Now it seems to be safe to turn of the tt0 transparent
--
1.9.1

2016-12-07 15:16:51

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 04/22] m68k/68000: Modernize printing of kernel messages

Convert from printk() to pr_*().

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/68000/m68328.c | 6 +++---
arch/m68k/68000/m68EZ328.c | 6 +++---
arch/m68k/68000/m68VZ328.c | 6 +++---
3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/m68k/68000/m68328.c b/arch/m68k/68000/m68328.c
index e53caf4c3bfbf9d1..419751b15ec8b5f1 100644
--- a/arch/m68k/68000/m68328.c
+++ b/arch/m68k/68000/m68328.c
@@ -45,9 +45,9 @@ void m68328_reset (void)

void __init config_BSP(char *command, int len)
{
- printk(KERN_INFO "\n68328 support D. Jeff Dionne <[email protected]>\n");
- printk(KERN_INFO "68328 support Kenneth Albanowski <[email protected]>\n");
- printk(KERN_INFO "68328/Pilot support Bernhard Kuhn <[email protected]>\n");
+ pr_info("68328 support D. Jeff Dionne <[email protected]>\n");
+ pr_info("68328 support Kenneth Albanowski <[email protected]>\n");
+ pr_info("68328/Pilot support Bernhard Kuhn <[email protected]>\n");

mach_hwclk = m68328_hwclk;
mach_reset = m68328_reset;
diff --git a/arch/m68k/68000/m68EZ328.c b/arch/m68k/68000/m68EZ328.c
index e6ab321f93f832e9..6a309a3cfbfc1953 100644
--- a/arch/m68k/68000/m68EZ328.c
+++ b/arch/m68k/68000/m68EZ328.c
@@ -57,12 +57,12 @@ void __init config_BSP(char *command, int len)
{
unsigned char *p;

- printk(KERN_INFO "\n68EZ328 DragonBallEZ support (C) 1999 Rt-Control, Inc\n");
+ pr_info("68EZ328 DragonBallEZ support (C) 1999 Rt-Control, Inc\n");

#ifdef CONFIG_UCSIMM
- printk(KERN_INFO "uCsimm serial string [%s]\n",getserialnum());
+ pr_info("uCsimm serial string [%s]\n", getserialnum());
p = cs8900a_hwaddr = gethwaddr(0);
- printk(KERN_INFO "uCsimm hwaddr %pM\n", p);
+ pr_info("uCsimm hwaddr %pM\n", p);

p = getbenv("APPEND");
if (p) strcpy(p,command);
diff --git a/arch/m68k/68000/m68VZ328.c b/arch/m68k/68000/m68VZ328.c
index 1154bdb220a022cd..81b5491685a4a2ab 100644
--- a/arch/m68k/68000/m68VZ328.c
+++ b/arch/m68k/68000/m68VZ328.c
@@ -150,9 +150,9 @@ static void __init init_hardware(char *command, int size)
{
char *p;

- printk(KERN_INFO "uCdimm serial string [%s]\n", getserialnum());
+ pr_info("uCdimm serial string [%s]\n", getserialnum());
p = cs8900a_hwaddr = gethwaddr(0);
- printk(KERN_INFO "uCdimm hwaddr %pM\n", p);
+ pr_info("uCdimm hwaddr %pM\n", p);
p = getbenv("APPEND");
if (p)
strcpy(p, command);
@@ -177,7 +177,7 @@ static void __init init_hardware(char *command, int size)

void __init config_BSP(char *command, int size)
{
- printk(KERN_INFO "68VZ328 DragonBallVZ support (c) 2001 Lineo, Inc.\n");
+ pr_info("68VZ328 DragonBallVZ support (c) 2001 Lineo, Inc.\n");

init_hardware(command, size);

--
1.9.1

2016-12-07 15:17:04

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 07/22] m68k/mac: baboon - Modernize printing of kernel messages

- Introduce helpers for printing debug messages, incl. dummies for
validating format strings when debugging is disabled,
- Convert from printk() to pr_*(),
- Drop superfluous casts.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/mac/baboon.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/arch/m68k/mac/baboon.c b/arch/m68k/mac/baboon.c
index f6f7d42713ec8b95..5dac92227654419b 100644
--- a/arch/m68k/mac/baboon.c
+++ b/arch/m68k/mac/baboon.c
@@ -15,6 +15,11 @@
#include <asm/mac_baboon.h>

/* #define DEBUG_IRQS */
+#ifdef DEBUG_IRQS
+#define pr_irq(fmt, ...) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#else
+#define pr_irq(fmt, ...) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#endif

int baboon_present;
static volatile struct baboon *baboon;
@@ -38,7 +43,7 @@ void __init baboon_init(void)
baboon = (struct baboon *) BABOON_BASE;
baboon_present = 1;

- printk("Baboon detected at %p\n", baboon);
+ pr_info("Baboon detected at %p\n", baboon);
}

/*
@@ -50,11 +55,8 @@ static void baboon_irq(struct irq_desc *desc)
int irq_bit, irq_num;
unsigned char events;

-#ifdef DEBUG_IRQS
- printk("baboon_irq: mb_control %02X mb_ifr %02X mb_status %02X\n",
- (uint) baboon->mb_control, (uint) baboon->mb_ifr,
- (uint) baboon->mb_status);
-#endif
+ pr_irq("baboon_irq: mb_control %02X mb_ifr %02X mb_status %02X\n",
+ baboon->mb_control, baboon->mb_ifr, baboon->mb_status);

events = baboon->mb_ifr & 0x07;
if (!events)
@@ -97,18 +99,14 @@ void __init baboon_register_interrupts(void)

void baboon_irq_enable(int irq)
{
-#ifdef DEBUG_IRQUSE
- printk("baboon_irq_enable(%d)\n", irq);
-#endif
+ pr_irq("baboon_irq_enable(%d)\n", irq);

mac_irq_enable(irq_get_irq_data(IRQ_NUBUS_C));
}

void baboon_irq_disable(int irq)
{
-#ifdef DEBUG_IRQUSE
- printk("baboon_irq_disable(%d)\n", irq);
-#endif
+ pr_irq("baboon_irq_disable(%d)\n", irq);

mac_irq_disable(irq_get_irq_data(IRQ_NUBUS_C));
}
--
1.9.1

2016-12-07 15:17:10

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 13/22] m68k/mvme16x: Modernize printing of kernel messages

Convert from printk() to pr_*().

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/mvme16x/config.c | 32 ++++++++++++++++----------------
arch/m68k/mvme16x/rtc.c | 2 +-
2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/arch/m68k/mvme16x/config.c b/arch/m68k/mvme16x/config.c
index 58e240939d265f69..6fa06d4d16bf08d4 100644
--- a/arch/m68k/mvme16x/config.c
+++ b/arch/m68k/mvme16x/config.c
@@ -72,8 +72,8 @@ int __init mvme16x_parse_bootinfo(const struct bi_record *bi)

void mvme16x_reset(void)
{
- printk ("\r\n\nCalled mvme16x_reset\r\n"
- "\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r");
+ pr_info("\r\n\nCalled mvme16x_reset\r\n"
+ "\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r");
/* The string of returns is to delay the reset until the whole
* message is output. Assert reset bit in GCSR */
*(volatile char *)0xfff40107 = 0x80;
@@ -289,7 +289,7 @@ void __init config_mvme16x(void)

if (strncmp("BDID", p->bdid, 4))
{
- printk ("\n\nBug call .BRD_ID returned garbage - giving up\n\n");
+ pr_crit("Bug call .BRD_ID returned garbage - giving up\n");
while (1)
;
}
@@ -298,25 +298,25 @@ void __init config_mvme16x(void)
vme_brdtype = brdno;

mvme16x_get_model(id);
- printk ("\nBRD_ID: %s BUG %x.%x %02x/%02x/%02x\n", id, p->rev>>4,
- p->rev&0xf, p->yr, p->mth, p->day);
+ pr_info("BRD_ID: %s BUG %x.%x %02x/%02x/%02x\n", id, p->rev >> 4,
+ p->rev & 0xf, p->yr, p->mth, p->day);
if (brdno == 0x0162 || brdno == 0x172)
{
unsigned char rev = *(unsigned char *)MVME162_VERSION_REG;

mvme16x_config = rev | MVME16x_CONFIG_GOT_SCCA;

- printk ("MVME%x Hardware status:\n", brdno);
- printk (" CPU Type 68%s040\n",
- rev & MVME16x_CONFIG_GOT_FPU ? "" : "LC");
- printk (" CPU clock %dMHz\n",
- rev & MVME16x_CONFIG_SPEED_32 ? 32 : 25);
- printk (" VMEchip2 %spresent\n",
- rev & MVME16x_CONFIG_NO_VMECHIP2 ? "NOT " : "");
- printk (" SCSI interface %spresent\n",
- rev & MVME16x_CONFIG_NO_SCSICHIP ? "NOT " : "");
- printk (" Ethernet interface %spresent\n",
- rev & MVME16x_CONFIG_NO_ETHERNET ? "NOT " : "");
+ pr_info("MVME%x Hardware status:\n", brdno);
+ pr_info(" CPU Type 68%s040\n",
+ rev & MVME16x_CONFIG_GOT_FPU ? "" : "LC");
+ pr_info(" CPU clock %dMHz\n",
+ rev & MVME16x_CONFIG_SPEED_32 ? 32 : 25);
+ pr_info(" VMEchip2 %spresent\n",
+ rev & MVME16x_CONFIG_NO_VMECHIP2 ? "NOT " : "");
+ pr_info(" SCSI interface %spresent\n",
+ rev & MVME16x_CONFIG_NO_SCSICHIP ? "NOT " : "");
+ pr_info(" Ethernet interface %spresent\n",
+ rev & MVME16x_CONFIG_NO_ETHERNET ? "NOT " : "");
}
else
{
diff --git a/arch/m68k/mvme16x/rtc.c b/arch/m68k/mvme16x/rtc.c
index 1cdc732681885e9a..e37ecb7e69284a83 100644
--- a/arch/m68k/mvme16x/rtc.c
+++ b/arch/m68k/mvme16x/rtc.c
@@ -158,7 +158,7 @@ static int __init rtc_MK48T08_init(void)
if (!MACH_IS_MVME16x)
return -ENODEV;

- printk(KERN_INFO "MK48T08 Real Time Clock Driver v%s\n", RTC_VERSION);
+ pr_info("MK48T08 Real Time Clock Driver v%s\n", RTC_VERSION);
return misc_register(&rtc_dev);
}
device_initcall(rtc_MK48T08_init);
--
1.9.1

2016-12-07 15:17:02

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 14/22] m68k/q40: Modernize printing of kernel messages

- Convert from printk() to pr_*(),
- Use TABs for indentation while at it.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/q40/config.c | 14 +++++++-------
arch/m68k/q40/q40ints.c | 15 +++++++++------
2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c
index ea89a24f46000e4f..71c0867ecf20f201 100644
--- a/arch/m68k/q40/config.c
+++ b/arch/m68k/q40/config.c
@@ -84,7 +84,7 @@ static int __init q40_debug_setup(char *arg)
{
/* useful for early debugging stages - writes kernel messages into SRAM */
if (MACH_IS_Q40 && !strncmp(arg, "mem", 3)) {
- /*printk("using NVRAM debug, q40_mem_cptr=%p\n",q40_mem_cptr);*/
+ /*pr_info("using NVRAM debug, q40_mem_cptr=%p\n",q40_mem_cptr);*/
_cpleft = 2000 - ((long)q40_mem_cptr-0xff020000) / 4;
register_console(&q40_console_driver);
}
@@ -124,8 +124,8 @@ static void q40_heartbeat(int on)

static void q40_reset(void)
{
- halted = 1;
- printk("\n\n*******************************************\n"
+ halted = 1;
+ pr_info("*******************************************\n"
"Called q40_reset : press the RESET button!!\n"
"*******************************************\n");
Q40_LED_ON();
@@ -135,10 +135,10 @@ static void q40_reset(void)

static void q40_halt(void)
{
- halted = 1;
- printk("\n\n*******************\n"
- " Called q40_halt\n"
- "*******************\n");
+ halted = 1;
+ pr_info("*******************\n"
+ " Called q40_halt\n"
+ "*******************\n");
Q40_LED_ON();
while (1)
;
diff --git a/arch/m68k/q40/q40ints.c b/arch/m68k/q40/q40ints.c
index 513f9bb17b9cffe6..3e7603202977e715 100644
--- a/arch/m68k/q40/q40ints.c
+++ b/arch/m68k/q40/q40ints.c
@@ -48,7 +48,8 @@ static unsigned int q40_irq_startup(struct irq_data *data)
switch (irq) {
case 1: case 2: case 8: case 9:
case 11: case 12: case 13:
- printk("%s: ISA IRQ %d not implemented by HW\n", __func__, irq);
+ pr_warn("%s: ISA IRQ %d not implemented by HW\n", __func__,
+ irq);
/* FIXME return -ENXIO; */
}
return 0;
@@ -250,7 +251,7 @@ static void q40_irq_handler(unsigned int irq, struct pt_regs *fp)
disable_irq(irq);
disabled = 1;
#else
- /*printk("IRQ_INPROGRESS detected for irq %d, disabling - %s disabled\n",
+ /*pr_warn("IRQ_INPROGRESS detected for irq %d, disabling - %s disabled\n",
irq, disabled ? "already" : "not yet"); */
fp->sr = (((fp->sr) & (~0x700))+0x200);
disabled = 1;
@@ -273,7 +274,7 @@ static void q40_irq_handler(unsigned int irq, struct pt_regs *fp)
}
#else
disabled = 0;
- /*printk("reenabling irq %d\n", irq); */
+ /*pr_info("reenabling irq %d\n", irq); */
#endif
}
// used to do 'goto repeat;' here, this delayed bh processing too long
@@ -281,7 +282,8 @@ static void q40_irq_handler(unsigned int irq, struct pt_regs *fp)
}
}
if (mer && ccleirq > 0 && !aliased_irq) {
- printk("ISA interrupt from unknown source? EIRQ_REG = %x\n",mer);
+ pr_warn("ISA interrupt from unknown source? EIRQ_REG = %x\n",
+ mer);
ccleirq--;
}
}
@@ -301,7 +303,7 @@ void q40_irq_enable(struct irq_data *data)
if (irq >= 5 && irq <= 15) {
mext_disabled--;
if (mext_disabled > 0)
- printk("q40_irq_enable : nested disable/enable\n");
+ pr_warn("q40_irq_enable : nested disable/enable\n");
if (mext_disabled == 0)
master_outb(1, EXT_ENABLE_REG);
}
@@ -321,6 +323,7 @@ void q40_irq_disable(struct irq_data *data)
master_outb(0, EXT_ENABLE_REG);
mext_disabled++;
if (mext_disabled > 1)
- printk("disable_irq nesting count %d\n",mext_disabled);
+ pr_info("disable_irq nesting count %d\n",
+ mext_disabled);
}
}
--
1.9.1

2016-12-07 15:16:40

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 20/22] m68k/mm: sun3 - Modernize printing of kernel messages

- Convert from printk() to pr_*(),
- Add missing print to do_page_mapin(), as print_pte_vaddr() calls
pr_cont().

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/include/asm/sun3_pgtable.h | 6 +++---
arch/m68k/mm/sun3kmap.c | 5 +++--
2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/m68k/include/asm/sun3_pgtable.h b/arch/m68k/include/asm/sun3_pgtable.h
index 48657f9fdeceac19..d5104a7b5388535f 100644
--- a/arch/m68k/include/asm/sun3_pgtable.h
+++ b/arch/m68k/include/asm/sun3_pgtable.h
@@ -151,11 +151,11 @@ static inline void pgd_clear (pgd_t *pgdp) {}


#define pte_ERROR(e) \
- printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
+ pr_err("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
#define pmd_ERROR(e) \
- printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e))
+ pr_err("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e))
#define pgd_ERROR(e) \
- printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
+ pr_err("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))


/*
diff --git a/arch/m68k/mm/sun3kmap.c b/arch/m68k/mm/sun3kmap.c
index 3dc41158c05e973a..ae03555449b85d0e 100644
--- a/arch/m68k/mm/sun3kmap.c
+++ b/arch/m68k/mm/sun3kmap.c
@@ -40,6 +40,7 @@ static inline void do_page_mapin(unsigned long phys, unsigned long virt,
sun3_put_pte(virt, pte);

#ifdef SUN3_KMAP_DEBUG
+ pr_info("mapin:");
print_pte_vaddr(virt);
#endif

@@ -80,8 +81,8 @@ void __iomem *sun3_ioremap(unsigned long phys, unsigned long size,
return NULL;

#ifdef SUN3_KMAP_DEBUG
- printk("ioremap: got virt %p size %lx(%lx)\n",
- area->addr, size, area->size);
+ pr_info("ioremap: got virt %p size %lx(%lx)\n", area->addr, size,
+ area->size);
#endif

pages = size / PAGE_SIZE;
--
1.9.1

2016-12-07 15:17:53

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 05/22] m68k/bvme6000: Modernize printing of kernel messages

Convert from printk() to pr_*().

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/bvme6000/config.c | 8 ++++----
arch/m68k/bvme6000/rtc.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/m68k/bvme6000/config.c b/arch/m68k/bvme6000/config.c
index 611d4d9ea2bd80ac..2cfff47650407479 100644
--- a/arch/m68k/bvme6000/config.c
+++ b/arch/m68k/bvme6000/config.c
@@ -63,8 +63,8 @@ void bvme6000_reset(void)
{
volatile PitRegsPtr pit = (PitRegsPtr)BVME_PIT_BASE;

- printk ("\r\n\nCalled bvme6000_reset\r\n"
- "\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r");
+ pr_info("\r\n\nCalled bvme6000_reset\r\n"
+ "\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r");
/* The string of returns is to delay the reset until the whole
* message is output. */
/* Enable the watchdog, via PIT port C bit 4 */
@@ -117,8 +117,8 @@ void __init config_bvme6000(void)
mach_reset = bvme6000_reset;
mach_get_model = bvme6000_get_model;

- printk ("Board is %sconfigured as a System Controller\n",
- *config_reg_ptr & BVME_CONFIG_SW1 ? "" : "not ");
+ pr_info("Board is %sconfigured as a System Controller\n",
+ *config_reg_ptr & BVME_CONFIG_SW1 ? "" : "not ");

/* Now do the PIT configuration */

diff --git a/arch/m68k/bvme6000/rtc.c b/arch/m68k/bvme6000/rtc.c
index f7984f44ff0f8072..43f483f3149ada31 100644
--- a/arch/m68k/bvme6000/rtc.c
+++ b/arch/m68k/bvme6000/rtc.c
@@ -168,7 +168,7 @@ static int __init rtc_DP8570A_init(void)
if (!MACH_IS_BVME6000)
return -ENODEV;

- printk(KERN_INFO "DP8570A Real Time Clock Driver v%s\n", RTC_VERSION);
+ pr_info("DP8570A Real Time Clock Driver v%s\n", RTC_VERSION);
return misc_register(&rtc_dev);
}
module_init(rtc_DP8570A_init);
--
1.9.1

2016-12-07 15:18:17

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 10/22] m68k/mac: psc - Modernize printing of kernel messages

- Introduce helpers for printing debug messages, incl. dummies for
validating format strings when debugging is disabled,
- Convert from printk() to pr_*(),
- Add missing continuations,
- Drop superfluous casts.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/mac/psc.c | 32 +++++++++++++++-----------------
1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/arch/m68k/mac/psc.c b/arch/m68k/mac/psc.c
index cb2b1a3a2b62d97f..83f81790c9eba80a 100644
--- a/arch/m68k/mac/psc.c
+++ b/arch/m68k/mac/psc.c
@@ -26,6 +26,11 @@
#include <asm/mac_psc.h>

#define DEBUG_PSC
+#ifdef DEBUG_IRQS
+#define pr_irq(fmt, ...) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#else
+#define pr_irq(fmt, ...) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#endif

volatile __u8 *psc;
EXPORT_SYMBOL_GPL(psc);
@@ -42,10 +47,9 @@ static void psc_debug_dump(void)
return;

for (i = 0x30 ; i < 0x70 ; i += 0x10) {
- printk("PSC #%d: IFR = 0x%02X IER = 0x%02X\n",
- i >> 4,
- (int) psc_read_byte(pIFRbase + i),
- (int) psc_read_byte(pIERbase + i));
+ pr_info("PSC #%d: IFR = 0x%02X IER = 0x%02X\n", i >> 4,
+ psc_read_byte(pIFRbase + i),
+ psc_read_byte(pIERbase + i));
}
}

@@ -59,14 +63,14 @@ static __init void psc_dma_die_die_die(void)
{
int i;

- printk("Killing all PSC DMA channels...");
+ pr_info("Killing all PSC DMA channels...");
for (i = 0 ; i < 9 ; i++) {
psc_write_word(PSC_CTL_BASE + (i << 4), 0x8800);
psc_write_word(PSC_CTL_BASE + (i << 4), 0x1000);
psc_write_word(PSC_CMD_BASE + (i << 5), 0x1100);
psc_write_word(PSC_CMD_BASE + (i << 5) + 0x10, 0x1100);
}
- printk("done!\n");
+ pr_cont("done!\n");
}

/*
@@ -92,7 +96,7 @@ void __init psc_init(void)

psc = (void *) PSC_BASE;

- printk("PSC detected at %p\n", psc);
+ pr_info("PSC detected at %p\n", psc);

psc_dma_die_die_die();

@@ -122,10 +126,8 @@ static void psc_irq(struct irq_desc *desc)
int irq_num;
unsigned char irq_bit, events;

-#ifdef DEBUG_IRQS
- printk("psc_irq: irq %u pIFR = 0x%02X pIER = 0x%02X\n",
- irq, (int) psc_read_byte(pIFR), (int) psc_read_byte(pIER));
-#endif
+ pr_irq("psc_irq: irq %u pIFR = 0x%02X pIER = 0x%02X\n", irq,
+ psc_read_byte(pIFR), psc_read_byte(pIER));

events = psc_read_byte(pIFR) & psc_read_byte(pIER) & 0xF;
if (!events)
@@ -160,9 +162,7 @@ void psc_irq_enable(int irq) {
int irq_idx = IRQ_IDX(irq);
int pIER = pIERbase + (irq_src << 4);

-#ifdef DEBUG_IRQUSE
- printk("psc_irq_enable(%d)\n", irq);
-#endif
+ pr_irq("psc_irq_enable(%d)\n", irq);
psc_write_byte(pIER, (1 << irq_idx) | 0x80);
}

@@ -171,8 +171,6 @@ void psc_irq_disable(int irq) {
int irq_idx = IRQ_IDX(irq);
int pIER = pIERbase + (irq_src << 4);

-#ifdef DEBUG_IRQUSE
- printk("psc_irq_disable(%d)\n", irq);
-#endif
+ pr_irq("psc_irq_disable(%d)\n", irq);
psc_write_byte(pIER, 1 << irq_idx);
}
--
1.9.1

2016-12-07 15:18:16

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 06/22] m68k/coldfire: Modernize printing of kernel messages

- Introduce helpers for printing debug messages, incl. dummies for
validating format strings when debugging is disabled,
- Convert from printk() to pr_*(),
- Correct printf()-style format specifiers,
- Drop superfluous casts,

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/coldfire/m528x.c | 4 +-
arch/m68k/coldfire/sltimers.c | 4 +-
arch/m68k/coldfire/timers.c | 4 +-
arch/m68k/coldfire/vectors.c | 2 +-
arch/m68k/include/asm/dma.h | 98 +++++++++++++------------------------
arch/m68k/include/asm/mcf_pgtable.h | 9 ++--
6 files changed, 44 insertions(+), 77 deletions(-)

diff --git a/arch/m68k/coldfire/m528x.c b/arch/m68k/coldfire/m528x.c
index 12f9e370d8dde8d8..fcdf6b3d427c3ca0 100644
--- a/arch/m68k/coldfire/m528x.c
+++ b/arch/m68k/coldfire/m528x.c
@@ -99,7 +99,7 @@ void wildfire_halt(void)
#ifdef CONFIG_WILDFIREMOD
void wildfiremod_halt(void)
{
- printk(KERN_INFO "WildFireMod hibernating...\n");
+ pr_info("WildFireMod hibernating...\n");

/* Set portE.5 to Digital IO */
writew(readw(MCFGPIO_PEPAR) & ~(1 << (5 * 2)), MCFGPIO_PEPAR);
@@ -111,7 +111,7 @@ void wildfiremod_halt(void)
writeb(readb(MCFGPIO_PODR_E) & ~(1 << 5), MCFGPIO_PODR_E);
writeb(readb(MCFGPIO_PODR_E) | (1 << 5), MCFGPIO_PODR_E);

- printk(KERN_EMERG "Failed to hibernate. Halting!\n");
+ pr_emerg("Failed to hibernate. Halting!\n");
}
#endif

diff --git a/arch/m68k/coldfire/sltimers.c b/arch/m68k/coldfire/sltimers.c
index 831a08cf6f40d7e6..e1c66a4a53d2d285 100644
--- a/arch/m68k/coldfire/sltimers.c
+++ b/arch/m68k/coldfire/sltimers.c
@@ -57,8 +57,8 @@ irqreturn_t mcfslt_profile_tick(int irq, void *dummy)

void mcfslt_profile_init(void)
{
- printk(KERN_INFO "PROFILE: lodging TIMER 1 @ %dHz as profile timer\n",
- PROFILEHZ);
+ pr_info("PROFILE: lodging TIMER 1 @ %dHz as profile timer\n",
+ PROFILEHZ);

setup_irq(MCF_IRQ_PROFILER, &mcfslt_profile_irq);

diff --git a/arch/m68k/coldfire/timers.c b/arch/m68k/coldfire/timers.c
index cd496a20fcc7ced7..b849e40c97b1a408 100644
--- a/arch/m68k/coldfire/timers.c
+++ b/arch/m68k/coldfire/timers.c
@@ -177,8 +177,8 @@ irqreturn_t coldfire_profile_tick(int irq, void *dummy)

void coldfire_profile_init(void)
{
- printk(KERN_INFO "PROFILE: lodging TIMER2 @ %dHz as profile timer\n",
- PROFILEHZ);
+ pr_info("PROFILE: lodging TIMER2 @ %dHz as profile timer\n",
+ PROFILEHZ);

/* Set up TIMER 2 as high speed profile clock */
__raw_writew(MCFTIMER_TMR_DISABLE, PA(MCFTIMER_TMR));
diff --git a/arch/m68k/coldfire/vectors.c b/arch/m68k/coldfire/vectors.c
index 08923fe600e013d9..a185df5963d4ae50 100644
--- a/arch/m68k/coldfire/vectors.c
+++ b/arch/m68k/coldfire/vectors.c
@@ -24,7 +24,7 @@
asmlinkage void dbginterrupt_c(struct frame *fp)
{
extern void dump(struct pt_regs *fp);
- printk(KERN_DEBUG "%s(%d): BUS ERROR TRAP\n", __FILE__, __LINE__);
+ pr_debug("%s(%d): BUS ERROR TRAP\n", __FILE__, __LINE__);
dump((struct pt_regs *) fp);
asm("halt");
}
diff --git a/arch/m68k/include/asm/dma.h b/arch/m68k/include/asm/dma.h
index 208b4daa14b334f4..c20ed384da6520dd 100644
--- a/arch/m68k/include/asm/dma.h
+++ b/arch/m68k/include/asm/dma.h
@@ -1,6 +1,12 @@
#ifndef _M68K_DMA_H
#define _M68K_DMA_H 1

+#ifdef DMA_DEBUG
+#define pr_dma(fmt, ...) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#else
+#define pr_dma(fmt, ...) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#endif
+
#ifdef CONFIG_COLDFIRE
/*
* ColdFire DMA Model:
@@ -126,9 +132,7 @@ static __inline__ void enable_dma(unsigned int dmanr)
{
volatile unsigned short *dmawp;

-#ifdef DMA_DEBUG
- printk("enable_dma(dmanr=%d)\n", dmanr);
-#endif
+ pr_dma("enable_dma(dmanr=%d)\n", dmanr);

dmawp = (unsigned short *) dma_base_addr[dmanr];
dmawp[MCFDMA_DCR] |= MCFDMA_DCR_EEXT;
@@ -139,9 +143,7 @@ static __inline__ void disable_dma(unsigned int dmanr)
volatile unsigned short *dmawp;
volatile unsigned char *dmapb;

-#ifdef DMA_DEBUG
- printk("disable_dma(dmanr=%d)\n", dmanr);
-#endif
+ pr_dma("disable_dma(dmanr=%d)\n", dmanr);

dmawp = (unsigned short *) dma_base_addr[dmanr];
dmapb = (unsigned char *) dma_base_addr[dmanr];
@@ -172,9 +174,7 @@ static __inline__ void set_dma_mode(unsigned int dmanr, char mode)
volatile unsigned char *dmabp;
volatile unsigned short *dmawp;

-#ifdef DMA_DEBUG
- printk("set_dma_mode(dmanr=%d,mode=%d)\n", dmanr, mode);
-#endif
+ pr_dma("set_dma_mode(dmanr=%d,mode=%d)\n", dmanr, mode);

dmabp = (unsigned char *) dma_base_addr[dmanr];
dmawp = (unsigned short *) dma_base_addr[dmanr];
@@ -201,11 +201,9 @@ static __inline__ void set_dma_mode(unsigned int dmanr, char mode)
((mode & DMA_MODE_LONG_BIT) ? MCFDMA_DCR_DSIZE_LONG :
MCFDMA_DCR_DSIZE_BYTE));

-#ifdef DEBUG_DMA
- printk("%s(%d): dmanr=%d DSR[%x]=%x DCR[%x]=%x\n", __FILE__, __LINE__,
- dmanr, (int) &dmabp[MCFDMA_DSR], dmabp[MCFDMA_DSR],
- (int) &dmawp[MCFDMA_DCR], dmawp[MCFDMA_DCR]);
-#endif
+ pr_dma("%s(%u): dmanr=%d DSR[%p]=%x DCR[%p]=%x\n", __FILE__, __LINE__, dmanr,
+ &dmabp[MCFDMA_DSR], dmabp[MCFDMA_DSR], &dmawp[MCFDMA_DCR],
+ dmawp[MCFDMA_DCR]);
}

/* Set transfer address for specific DMA channel */
@@ -214,9 +212,7 @@ static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a)
volatile unsigned short *dmawp;
volatile unsigned int *dmalp;

-#ifdef DMA_DEBUG
- printk("set_dma_addr(dmanr=%d,a=%x)\n", dmanr, a);
-#endif
+ pr_dma("set_dma_addr(dmanr=%d,a=%x)\n", dmanr, a);

dmawp = (unsigned short *) dma_base_addr[dmanr];
dmalp = (unsigned int *) dma_base_addr[dmanr];
@@ -234,12 +230,10 @@ static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a)
dmalp[MCFDMA_SAR] = dma_device_address[dmanr];
}

-#ifdef DEBUG_DMA
- printk("%s(%d): dmanr=%d DCR[%x]=%x SAR[%x]=%08x DAR[%x]=%08x\n",
- __FILE__, __LINE__, dmanr, (int) &dmawp[MCFDMA_DCR], dmawp[MCFDMA_DCR],
- (int) &dmalp[MCFDMA_SAR], dmalp[MCFDMA_SAR],
- (int) &dmalp[MCFDMA_DAR], dmalp[MCFDMA_DAR]);
-#endif
+ pr_dma("%s(%u): dmanr=%d DCR[%p]=%x SAR[%p]=%08x DAR[%p]=%08x\n", __FILE__,
+ __LINE__, dmanr, &dmawp[MCFDMA_DCR], dmawp[MCFDMA_DCR],
+ &dmalp[MCFDMA_SAR], dmalp[MCFDMA_SAR], &dmalp[MCFDMA_DAR],
+ dmalp[MCFDMA_DAR]);
}

/*
@@ -248,9 +242,7 @@ static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a)
*/
static __inline__ void set_dma_device_addr(unsigned int dmanr, unsigned int a)
{
-#ifdef DMA_DEBUG
- printk("set_dma_device_addr(dmanr=%d,a=%x)\n", dmanr, a);
-#endif
+ pr_dma("set_dma_device_addr(dmanr=%d,a=%x)\n", dmanr, a);

dma_device_address[dmanr] = a;
}
@@ -262,9 +254,7 @@ static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count)
{
volatile unsigned short *dmawp;

-#ifdef DMA_DEBUG
- printk("set_dma_count(dmanr=%d,count=%d)\n", dmanr, count);
-#endif
+ pr_dma("set_dma_count(dmanr=%d,count=%d)\n", dmanr, count);

dmawp = (unsigned short *) dma_base_addr[dmanr];
dmawp[MCFDMA_BCR] = (unsigned short)count;
@@ -281,9 +271,7 @@ static __inline__ int get_dma_residue(unsigned int dmanr)
volatile unsigned short *dmawp;
unsigned short count;

-#ifdef DMA_DEBUG
- printk("get_dma_residue(dmanr=%d)\n", dmanr);
-#endif
+ pr_dma("get_dma_residue(dmanr=%d)\n", dmanr);

dmawp = (unsigned short *) dma_base_addr[dmanr];
count = dmawp[MCFDMA_BCR];
@@ -319,9 +307,7 @@ static __inline__ void enable_dma(unsigned int dmanr)
{
volatile unsigned int *dmalp;

-#ifdef DMA_DEBUG
- printk("enable_dma(dmanr=%d)\n", dmanr);
-#endif
+ pr_dma("enable_dma(dmanr=%d)\n", dmanr);

dmalp = (unsigned int *) dma_base_addr[dmanr];
dmalp[MCFDMA_DMR] |= MCFDMA_DMR_EN;
@@ -331,9 +317,7 @@ static __inline__ void disable_dma(unsigned int dmanr)
{
volatile unsigned int *dmalp;

-#ifdef DMA_DEBUG
- printk("disable_dma(dmanr=%d)\n", dmanr);
-#endif
+ pr_dma("disable_dma(dmanr=%d)\n", dmanr);

dmalp = (unsigned int *) dma_base_addr[dmanr];

@@ -363,9 +347,7 @@ static __inline__ void set_dma_mode(unsigned int dmanr, char mode)
volatile unsigned int *dmalp;
volatile unsigned short *dmawp;

-#ifdef DMA_DEBUG
- printk("set_dma_mode(dmanr=%d,mode=%d)\n", dmanr, mode);
-#endif
+ pr_dma("set_dma_mode(dmanr=%d,mode=%d)\n", dmanr, mode);
dmalp = (unsigned int *) dma_base_addr[dmanr];
dmawp = (unsigned short *) dma_base_addr[dmanr];

@@ -387,11 +369,9 @@ static __inline__ void set_dma_mode(unsigned int dmanr, char mode)

dmawp[MCFDMA_DIR] |= MCFDMA_DIR_ASCEN; /* Enable completion interrupts */

-#ifdef DEBUG_DMA
- printk("%s(%d): dmanr=%d DMR[%x]=%x DIR[%x]=%x\n", __FILE__, __LINE__,
- dmanr, (int) &dmalp[MCFDMA_DMR], dmabp[MCFDMA_DMR],
- (int) &dmawp[MCFDMA_DIR], dmawp[MCFDMA_DIR]);
-#endif
+ pr_dma("%s(%u): dmanr=%d DMR[%p]=%x DIR[%p]=%x\n", __FILE__, __LINE__, dmanr,
+ &dmalp[MCFDMA_DMR], dmabp[MCFDMA_DMR], &dmawp[MCFDMA_DIR],
+ dmawp[MCFDMA_DIR]);
}

/* Set transfer address for specific DMA channel */
@@ -399,9 +379,7 @@ static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a)
{
volatile unsigned int *dmalp;

-#ifdef DMA_DEBUG
- printk("set_dma_addr(dmanr=%d,a=%x)\n", dmanr, a);
-#endif
+ pr_dma("set_dma_addr(dmanr=%d,a=%x)\n", dmanr, a);

dmalp = (unsigned int *) dma_base_addr[dmanr];

@@ -418,12 +396,10 @@ static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a)
dmalp[MCFDMA_DSAR] = dma_device_address[dmanr];
}

-#ifdef DEBUG_DMA
- printk("%s(%d): dmanr=%d DMR[%x]=%x SAR[%x]=%08x DAR[%x]=%08x\n",
- __FILE__, __LINE__, dmanr, (int) &dmawp[MCFDMA_DMR], dmawp[MCFDMA_DMR],
- (int) &dmalp[MCFDMA_DSAR], dmalp[MCFDMA_DSAR],
- (int) &dmalp[MCFDMA_DDAR], dmalp[MCFDMA_DDAR]);
-#endif
+ pr_dma("%s(%u): dmanr=%d DMR[%p]=%x SAR[%p]=%08x DAR[%p]=%08x\n", __FILE__,
+ __LINE__, dmanr, &dmawp[MCFDMA_DMR], dmawp[MCFDMA_DMR],
+ &dmalp[MCFDMA_DSAR], dmalp[MCFDMA_DSAR], &dmalp[MCFDMA_DDAR],
+ dmalp[MCFDMA_DDAR]);
}

/*
@@ -432,9 +408,7 @@ static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a)
*/
static __inline__ void set_dma_device_addr(unsigned int dmanr, unsigned int a)
{
-#ifdef DMA_DEBUG
- printk("set_dma_device_addr(dmanr=%d,a=%x)\n", dmanr, a);
-#endif
+ pr_dma("set_dma_device_addr(dmanr=%d,a=%x)\n", dmanr, a);

dma_device_address[dmanr] = a;
}
@@ -448,9 +422,7 @@ static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count)
{
volatile unsigned int *dmalp;

-#ifdef DMA_DEBUG
- printk("set_dma_count(dmanr=%d,count=%d)\n", dmanr, count);
-#endif
+ pr_dma("set_dma_count(dmanr=%d,count=%d)\n", dmanr, count);

dmalp = (unsigned int *) dma_base_addr[dmanr];
dmalp[MCFDMA_DBCR] = count;
@@ -467,9 +439,7 @@ static __inline__ int get_dma_residue(unsigned int dmanr)
volatile unsigned int *dmalp;
unsigned int count;

-#ifdef DMA_DEBUG
- printk("get_dma_residue(dmanr=%d)\n", dmanr);
-#endif
+ pr_dma("get_dma_residue(dmanr=%d)\n", dmanr);

dmalp = (unsigned int *) dma_base_addr[dmanr];
count = dmalp[MCFDMA_DBCR];
diff --git a/arch/m68k/include/asm/mcf_pgtable.h b/arch/m68k/include/asm/mcf_pgtable.h
index 2500ce04fcc412ea..43a8b7a1cba4b2c1 100644
--- a/arch/m68k/include/asm/mcf_pgtable.h
+++ b/arch/m68k/include/asm/mcf_pgtable.h
@@ -203,14 +203,11 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr,
static inline void pgd_clear(pgd_t *pgdp) {}

#define pte_ERROR(e) \
- printk(KERN_ERR "%s:%d: bad pte %08lx.\n", \
- __FILE__, __LINE__, pte_val(e))
+ pr_err("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
#define pmd_ERROR(e) \
- printk(KERN_ERR "%s:%d: bad pmd %08lx.\n", \
- __FILE__, __LINE__, pmd_val(e))
+ pr_err("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e))
#define pgd_ERROR(e) \
- printk(KERN_ERR "%s:%d: bad pgd %08lx.\n", \
- __FILE__, __LINE__, pgd_val(e))
+ pr_err("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))

/*
* The following only work if pte_present() is true.
--
1.9.1

2016-12-07 15:18:14

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 15/22] 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]>
---
arch/m68k/sun3/config.c | 2 +-
arch/m68k/sun3/dvma.c | 3 +--
arch/m68k/sun3/idprom.c | 8 ++++---
arch/m68k/sun3/mmu_emu.c | 47 ++++++++++++++++++++--------------------
arch/m68k/sun3/prom/printf.c | 2 +-
arch/m68k/sun3/sun3dvma.c | 51 +++++++++++++++++++-------------------------
6 files changed, 54 insertions(+), 59 deletions(-)

diff --git a/arch/m68k/sun3/config.c b/arch/m68k/sun3/config.c
index 3af34fa3a344ba85..1d28d380e8cc1037 100644
--- a/arch/m68k/sun3/config.c
+++ b/arch/m68k/sun3/config.c
@@ -134,7 +134,7 @@ void __init config_sun3(void)
{
unsigned long memory_start, memory_end;

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

/* Subtract kernel memory from available memory */
diff --git a/arch/m68k/sun3/dvma.c b/arch/m68k/sun3/dvma.c
index d95506e06c2ac42b..ca02ee25894cc4a5 100644
--- a/arch/m68k/sun3/dvma.c
+++ b/arch/m68k/sun3/dvma.c
@@ -31,8 +31,7 @@ static unsigned long dvma_page(unsigned long kaddr, unsigned long vaddr)

ptep = pfn_pte(virt_to_pfn(kaddr), PAGE_KERNEL);
pte = pte_val(ptep);
-// printk("dvma_remap: addr %lx -> %lx pte %08lx len %x\n",
-// kaddr, vaddr, pte, len);
+// pr_info("dvma_remap: addr %lx -> %lx pte %08lx\n", kaddr, vaddr, pte);
if(ptelist[(vaddr & 0xff000) >> PAGE_SHIFT] != pte) {
sun3_put_pte(vaddr, pte);
ptelist[(vaddr & 0xff000) >> PAGE_SHIFT] = pte;
diff --git a/arch/m68k/sun3/idprom.c b/arch/m68k/sun3/idprom.c
index cfe9aa4223431764..9c23f506d60df450 100644
--- a/arch/m68k/sun3/idprom.c
+++ b/arch/m68k/sun3/idprom.c
@@ -64,12 +64,14 @@ static void __init display_system_type(unsigned char machtype)
for (i = 0; i < NUM_SUN_MACHINES; i++) {
if(Sun_Machines[i].id_machtype == machtype) {
if (machtype != (SM_SUN4M_OBP | 0x00))
- printk("TYPE: %s\n", Sun_Machines[i].name);
+ pr_info("TYPE: %s\n", Sun_Machines[i].name);
else {
#if 0
+ char sysname[128];
+
prom_getproperty(prom_root_node, "banner-name",
sysname, sizeof(sysname));
- printk("TYPE: %s\n", sysname);
+ pr_info("TYPE: %s\n", sysname);
#endif
}
return;
@@ -125,5 +127,5 @@ void __init idprom_init(void)

display_system_type(idprom->id_machtype);

- printk("Ethernet address: %pM\n", idprom->id_ethaddr);
+ pr_info("Ethernet address: %pM\n", idprom->id_ethaddr);
}
diff --git a/arch/m68k/sun3/mmu_emu.c b/arch/m68k/sun3/mmu_emu.c
index 3f258e230ba5d0c9..fc672c74ede7b155 100644
--- a/arch/m68k/sun3/mmu_emu.c
+++ b/arch/m68k/sun3/mmu_emu.c
@@ -72,21 +72,21 @@ void print_pte (pte_t pte)
#if 0
/* Verbose version. */
unsigned long val = pte_val (pte);
- printk (" pte=%lx [addr=%lx",
+ pr_cont(" pte=%lx [addr=%lx",
val, (val & SUN3_PAGE_PGNUM_MASK) << PAGE_SHIFT);
- if (val & SUN3_PAGE_VALID) printk (" valid");
- if (val & SUN3_PAGE_WRITEABLE) printk (" write");
- if (val & SUN3_PAGE_SYSTEM) printk (" sys");
- if (val & SUN3_PAGE_NOCACHE) printk (" nocache");
- if (val & SUN3_PAGE_ACCESSED) printk (" accessed");
- if (val & SUN3_PAGE_MODIFIED) printk (" modified");
+ if (val & SUN3_PAGE_VALID) pr_cont(" valid");
+ if (val & SUN3_PAGE_WRITEABLE) pr_cont(" write");
+ if (val & SUN3_PAGE_SYSTEM) pr_cont(" sys");
+ if (val & SUN3_PAGE_NOCACHE) pr_cont(" nocache");
+ if (val & SUN3_PAGE_ACCESSED) pr_cont(" accessed");
+ if (val & SUN3_PAGE_MODIFIED) pr_cont(" modified");
switch (val & SUN3_PAGE_TYPE_MASK) {
- case SUN3_PAGE_TYPE_MEMORY: printk (" memory"); break;
- case SUN3_PAGE_TYPE_IO: printk (" io"); break;
- case SUN3_PAGE_TYPE_VME16: printk (" vme16"); break;
- case SUN3_PAGE_TYPE_VME32: printk (" vme32"); break;
+ case SUN3_PAGE_TYPE_MEMORY: pr_cont(" memory"); break;
+ case SUN3_PAGE_TYPE_IO: pr_cont(" io"); break;
+ case SUN3_PAGE_TYPE_VME16: pr_cont(" vme16"); break;
+ case SUN3_PAGE_TYPE_VME32: pr_cont(" vme32"); break;
}
- printk ("]\n");
+ pr_cont("]\n");
#else
/* Terse version. More likely to fit on a line. */
unsigned long val = pte_val (pte);
@@ -108,7 +108,7 @@ void print_pte (pte_t pte)
default: type = "unknown?"; break;
}

- printk (" pte=%08lx [%07lx %s %s]\n",
+ pr_cont(" pte=%08lx [%07lx %s %s]\n",
val, (val & SUN3_PAGE_PGNUM_MASK) << PAGE_SHIFT, flags, type);
#endif
}
@@ -116,7 +116,7 @@ void print_pte (pte_t pte)
/* Print the PTE value for a given virtual address. For debugging. */
void print_pte_vaddr (unsigned long vaddr)
{
- printk (" vaddr=%lx [%02lx]", vaddr, sun3_get_segmap (vaddr));
+ pr_cont(" vaddr=%lx [%02lx]", vaddr, sun3_get_segmap (vaddr));
print_pte (__pte (sun3_get_pte (vaddr)));
}

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

if(!pmeg_alloc[i]) {
#ifdef DEBUG_MMU_EMU
- printk("freed: ");
+ pr_info("freed:");
print_pte_vaddr (seg);
#endif
sun3_put_segmap(seg, SUN3_INVALID_PMEG);
@@ -165,7 +165,7 @@ void __init mmu_emu_init(unsigned long bootmem_end)
if (sun3_get_segmap (seg) != SUN3_INVALID_PMEG) {
#ifdef DEBUG_PROM_MAPS
for(i = 0; i < 16; i++) {
- printk ("mapped:");
+ pr_info("mapped:");
print_pte_vaddr (seg + (i*PAGE_SIZE));
break;
}
@@ -293,8 +293,8 @@ inline void mmu_emu_map_pmeg (int context, int vaddr)


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

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

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

@@ -378,14 +378,15 @@ int mmu_emu_handle_fault (unsigned long vaddr, int read_flag, int kernel_fault)
offset = (vaddr >> SUN3_PTE_SIZE_BITS) & 0xF;

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

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

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

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

#ifdef DEBUG_MMU_EMU
- printk ("seg:%d crp:%p ->", get_fs().seg, crp);
+ pr_info("seg:%ld crp:%p ->", get_fs().seg, crp);
print_pte_vaddr (vaddr);
- printk ("\n");
+ pr_cont("\n");
#endif

return 1;
diff --git a/arch/m68k/sun3/prom/printf.c b/arch/m68k/sun3/prom/printf.c
index df85018f487ac1a5..5b82bea03493e8e3 100644
--- a/arch/m68k/sun3/prom/printf.c
+++ b/arch/m68k/sun3/prom/printf.c
@@ -39,7 +39,7 @@

#ifdef CONFIG_KGDB
if (kgdb_initialized) {
- printk("kgdb_initialized = %d\n", kgdb_initialized);
+ pr_info("kgdb_initialized = %d\n", kgdb_initialized);
putpacket(bptr, 1);
} else
#else
diff --git a/arch/m68k/sun3/sun3dvma.c b/arch/m68k/sun3/sun3dvma.c
index b37521a5259ddb7a..d36bd15f9fdcda46 100644
--- a/arch/m68k/sun3/sun3dvma.c
+++ b/arch/m68k/sun3/sun3dvma.c
@@ -62,7 +62,7 @@ static void print_use(void)
int i;
int j = 0;

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

for(i = 0; i < IOMMU_TOTAL_ENTRIES; i++) {
if(!iommu_use[i])
@@ -70,16 +70,15 @@ static void print_use(void)

j++;

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

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

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

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

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

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

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

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

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

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

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

}

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

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

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

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

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

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

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

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)
return NULL;
}

-#ifdef DEBUG
- printk("mapped %08lx bytes %08lx kern -> %08lx bus\n",
- len, kaddr, baddr);
-#endif
+ pr_debug("mapped %08lx bytes %08lx kern -> %08lx bus\n", len, kaddr,
+ baddr);

return (void *)vaddr;

--
1.9.1

2016-12-07 22:36:45

by Finn Thain

[permalink] [raw]
Subject: Re: [PATCH 01/22] m68k/atari: Modernize printing of kernel messages


On Wed, 7 Dec 2016, Geert Uytterhoeven wrote:

> - Convert from printk() to pr_*(),
> - Add missing continuations, to fix user-visible breakage,
> - Drop useless WARNING prefix,
> - Move trailing spaces to start of continuations.
>
> Fixes: 4bcc595ccd80decb ("printk: reinstate KERN_CONT for printing continuation lines")
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> ---
> arch/m68k/atari/atakeyb.c | 14 ++++++------
> arch/m68k/atari/config.c | 56 +++++++++++++++++++++++------------------------
> 2 files changed, 35 insertions(+), 35 deletions(-)
>
> diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c
> index 264db11268039329..37091898adb3d3b5 100644
> --- a/arch/m68k/atari/atakeyb.c
> +++ b/arch/m68k/atari/atakeyb.c
> @@ -149,7 +149,7 @@ static irqreturn_t atari_keyboard_interrupt(int irq, void *dummy)
> if (acia_stat & ACIA_OVRN) {
> /* a very fast typist or a slow system, give a warning */
> /* ...happens often if interrupts were disabled for too long */
> - printk(KERN_DEBUG "Keyboard overrun\n");
> + pr_debug("Keyboard overrun\n");
> scancode = acia.key_data;
> if (ikbd_self_test)
> /* During self test, don't do resyncing, just process the code */

This is not equivalent (unless there is a DEBUG macro definition hinding
in a header file somewhere). Since the changelog doesn't mention
suppressing any output, perhaps you were deceived by the questionable API,
as I have been in the past (see 16b9d870a0 and d61c5427f6).

--

2016-12-07 22:46:14

by Finn Thain

[permalink] [raw]
Subject: Re: [PATCH 02/22] m68k/mac: macints - Modernize printing of kernel messages


On Wed, 7 Dec 2016, Geert Uytterhoeven wrote:

> - Introduce helpers for printing debug messages, incl. dummies for
> validating format strings when debugging is disabled,
> - Convert from printk() to pr_*(),
> - Add missing continuations, to fix user-visible breakage.
>
> Fixes: 4bcc595ccd80decb ("printk: reinstate KERN_CONT for printing continuation lines")
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> ---
> arch/m68k/mac/macints.c | 42 ++++++++++++++++++++++--------------------
> 1 file changed, 22 insertions(+), 20 deletions(-)
>
> diff --git a/arch/m68k/mac/macints.c b/arch/m68k/mac/macints.c
> index 9f98c08719010e27..8572290cb93b6679 100644
> --- a/arch/m68k/mac/macints.c
> +++ b/arch/m68k/mac/macints.c
> @@ -135,6 +135,11 @@
> irqreturn_t mac_debug_handler(int, void *);
>
> /* #define DEBUG_MACINTS */
> +#ifdef DEBUG_MACINTS
> +#define pr_irq(fmt, ...) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> +#else
> +#define pr_irq(fmt, ...) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> +#endif
>
> static unsigned int mac_irq_startup(struct irq_data *);
> static void mac_irq_shutdown(struct irq_data *);

I would prefer to delete all the DEBUG_MACINTS clutter.


> @@ -149,20 +154,18 @@
>
> void __init mac_init_IRQ(void)
> {
> -#ifdef DEBUG_MACINTS
> - printk("mac_init_IRQ(): Setting things up...\n");
> -#endif
> + pr_irq("mac_init_IRQ(): Setting things up...\n");
> m68k_setup_irq_controller(&mac_irq_chip, handle_simple_irq, IRQ_USER,
> NUM_MAC_SOURCES - IRQ_USER);
> /* Make sure the SONIC interrupt is cleared or things get ugly */
> #ifdef SHUTUP_SONIC
> - printk("Killing onboard sonic... ");
> + pr_info("Killing onboard sonic... ");
> /* This address should hopefully be mapped already */
> if (hwreg_present((void*)(0x50f0a000))) {
> *(long *)(0x50f0a014) = 0x7fffL;
> *(long *)(0x50f0a010) = 0L;
> }
> - printk("Done.\n");
> + pr_cont("Done.\n");
> #endif /* SHUTUP_SONIC */
>
> /*
> @@ -182,9 +185,7 @@ void __init mac_init_IRQ(void)
> if (request_irq(IRQ_AUTO_7, mac_nmi_handler, 0, "NMI",
> mac_nmi_handler))
> pr_err("Couldn't register NMI\n");
> -#ifdef DEBUG_MACINTS
> - printk("mac_init_IRQ(): Done!\n");
> -#endif
> + pr_irq("mac_init_IRQ(): Done!\n");
> }
>
> /*
> @@ -281,7 +282,7 @@ static void mac_irq_shutdown(struct irq_data *data)
> irqreturn_t mac_debug_handler(int irq, void *dev_id)
> {
> if (num_debug[irq] < 10) {
> - printk("DEBUG: Unexpected IRQ %d\n", irq);
> + pr_info("DEBUG: Unexpected IRQ %d\n", irq);
> num_debug[irq]++;
> }
> return IRQ_HANDLED;

Is this dead code?


> @@ -304,9 +305,9 @@ irqreturn_t mac_nmi_handler(int irq, void *dev_id)
>
> if (in_nmi == 1) {
> nmi_hold = 1;
> - printk("... pausing, press NMI to resume ...");
> + pr_info("... pausing, press NMI to resume ...");
> } else {
> - printk(" ok!\n");
> + pr_cont(" ok!\n");
> nmi_hold = 0;
> }
>
> @@ -319,20 +320,21 @@ irqreturn_t mac_nmi_handler(int irq, void *dev_id)
> #if 0
> struct pt_regs *fp = get_irq_regs();
> show_state();
> - printk("PC: %08lx\nSR: %04x SP: %p\n", fp->pc, fp->sr, fp);
> - printk("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
> - fp->d0, fp->d1, fp->d2, fp->d3);
> - printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
> - fp->d4, fp->d5, fp->a0, fp->a1);
> + pr_info("PC: %08lx\nSR: %04x SP: %p\n", fp->pc, fp->sr, fp);
> + pr_info("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
> + fp->d0, fp->d1, fp->d2, fp->d3);
> + pr_info("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
> + fp->d4, fp->d5, fp->a0, fp->a1);
>
> if (STACK_MAGIC != *(unsigned long *)current->kernel_stack_page)
> - printk("Corrupted stack page\n");
> - printk("Process %s (pid: %d, stackpage=%08lx)\n",
> - current->comm, current->pid, current->kernel_stack_page);
> + pr_info("Corrupted stack page\n");
> + pr_info("Process %s (pid: %d, stackpage=%08lx)\n",
> + current->comm, current->pid,
> + current->kernel_stack_page);
> if (intr_count == 1)
> dump_stack((struct frame *)fp);
> #else
> - /* printk("NMI "); */
> + /* pr_info("NMI "); */
> #endif
> }
> in_nmi--;
>

I think it would be good to use pr_debug here instead of #if 0. But that
will probably break the build... better ignore the #if 0 section for this
series, until I put together a different patch?

--

2016-12-07 22:48:26

by Finn Thain

[permalink] [raw]
Subject: Re: [PATCH 03/22] m68k/mac: via - Modernize printing of kernel messages


On Wed, 7 Dec 2016, Geert Uytterhoeven wrote:

> - Introduce helpers for printing debug messages, incl. dummies for
> validating format strings when debugging is disabled,
> - Convert from printk() to pr_*(),
> - Add missing continuations, to fix user-visible breakage,
> - Drop superfluous casts.
>
> Fixes: 4bcc595ccd80decb ("printk: reinstate KERN_CONT for printing continuation lines")
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> ---
> arch/m68k/mac/via.c | 54 ++++++++++++++++++++++++++---------------------------
> 1 file changed, 27 insertions(+), 27 deletions(-)
>
> diff --git a/arch/m68k/mac/via.c b/arch/m68k/mac/via.c
> index 920ff63d4a81d77a..7c53b10d93817d9c 100644
> --- a/arch/m68k/mac/via.c
> +++ b/arch/m68k/mac/via.c
> @@ -36,6 +36,12 @@
> #include <asm/mac_psc.h>
> #include <asm/mac_oss.h>
>
> +#ifdef DEBUG_IRQUSE
> +#define pr_irq(fmt, ...) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> +#else
> +#define pr_irq(fmt, ...) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> +#endif
> +
> volatile __u8 *via1, *via2;
> int rbv_present;
> int via_alt_mapping;

I'd prefer to drop the DEBUG_IRQUSE macro and the debug output it
controls.

> @@ -168,15 +174,15 @@ void __init via_init(void)
> panic("UNKNOWN VIA TYPE");
> }
>
> - printk(KERN_INFO "VIA1 at %p is a 6522 or clone\n", via1);
> + pr_info("VIA1 at %p is a 6522 or clone\n", via1);
>
> - printk(KERN_INFO "VIA2 at %p is ", via2);
> + pr_info("VIA2 at %p is ", via2);
> if (rbv_present) {
> - printk("an RBV\n");
> + pr_cont("an RBV\n");
> } else if (oss_present) {
> - printk("an OSS\n");
> + pr_cont("an OSS\n");
> } else {
> - printk("a 6522 or clone\n");
> + pr_cont("a 6522 or clone\n");
> }
>
> #ifdef DEBUG_VIA
> @@ -299,24 +305,22 @@ void __init via_init_clock(irq_handler_t func)
>
> void via_debug_dump(void)
> {
> - printk(KERN_DEBUG "VIA1: DDRA = 0x%02X DDRB = 0x%02X ACR = 0x%02X\n",
> - (uint) via1[vDirA], (uint) via1[vDirB], (uint) via1[vACR]);
> - printk(KERN_DEBUG " PCR = 0x%02X IFR = 0x%02X IER = 0x%02X\n",
> - (uint) via1[vPCR], (uint) via1[vIFR], (uint) via1[vIER]);
> + pr_debug("VIA1: DDRA = 0x%02X DDRB = 0x%02X ACR = 0x%02X\n",
> + via1[vDirA], via1[vDirB], via1[vACR]);
> + pr_debug(" PCR = 0x%02X IFR = 0x%02X IER = 0x%02X\n",
> + via1[vPCR], via1[vIFR], via1[vIER]);
> if (oss_present) {
> - printk(KERN_DEBUG "VIA2: <OSS>\n");
> + pr_debug("VIA2: <OSS>\n");
> } else if (rbv_present) {
> - printk(KERN_DEBUG "VIA2: IFR = 0x%02X IER = 0x%02X\n",
> - (uint) via2[rIFR], (uint) via2[rIER]);
> - printk(KERN_DEBUG " SIFR = 0x%02X SIER = 0x%02X\n",
> - (uint) via2[rSIFR], (uint) via2[rSIER]);
> + pr_debug("VIA2: IFR = 0x%02X IER = 0x%02X\n", via2[rIFR],
> + via2[rIER]);
> + pr_debug(" SIFR = 0x%02X SIER = 0x%02X\n", via2[rSIFR],
> + via2[rSIER]);
> } else {
> - printk(KERN_DEBUG "VIA2: DDRA = 0x%02X DDRB = 0x%02X ACR = 0x%02X\n",
> - (uint) via2[vDirA], (uint) via2[vDirB],
> - (uint) via2[vACR]);
> - printk(KERN_DEBUG " PCR = 0x%02X IFR = 0x%02X IER = 0x%02X\n",
> - (uint) via2[vPCR],
> - (uint) via2[vIFR], (uint) via2[vIER]);
> + pr_debug("VIA2: DDRA = 0x%02X DDRB = 0x%02X ACR = 0x%02X\n",
> + via2[vDirA], via2[vDirB], via2[vACR]);
> + pr_debug(" PCR = 0x%02X IFR = 0x%02X IER = 0x%02X\n",
> + via2[vPCR], via2[vIFR], via2[vIER]);
> }
> }
>

I think these should remain printk(KERN_DEBUG, ...).

> @@ -362,7 +366,7 @@ int via_get_cache_disable(void)
> {
> /* Safeguard against being called accidentally */
> if (!via2) {
> - printk(KERN_ERR "via_get_cache_disable called on a non-VIA machine!\n");
> + pr_err("via_get_cache_disable called on a non-VIA machine!\n");
> return 1;
> }
>
> @@ -550,9 +554,7 @@ void via_irq_enable(int irq) {
> int irq_src = IRQ_SRC(irq);
> int irq_idx = IRQ_IDX(irq);
>
> -#ifdef DEBUG_IRQUSE
> - printk(KERN_DEBUG "via_irq_enable(%d)\n", irq);
> -#endif
> + pr_irq("via_irq_enable(%d)\n", irq);
>
> if (irq_src == 1) {
> via1[vIER] = IER_SET_BIT(irq_idx);
> @@ -582,9 +584,7 @@ void via_irq_disable(int irq) {
> int irq_src = IRQ_SRC(irq);
> int irq_idx = IRQ_IDX(irq);
>
> -#ifdef DEBUG_IRQUSE
> - printk(KERN_DEBUG "via_irq_disable(%d)\n", irq);
> -#endif
> + pr_irq("via_irq_disable(%d)\n", irq);
>
> if (irq_src == 1) {
> via1[vIER] = IER_CLR_BIT(irq_idx);
>

--

2016-12-07 22:53:08

by Finn Thain

[permalink] [raw]
Subject: Re: [PATCH 06/22] m68k/coldfire: Modernize printing of kernel messages


On Wed, 7 Dec 2016, Geert Uytterhoeven wrote:

> - Introduce helpers for printing debug messages, incl. dummies for
> validating format strings when debugging is disabled,
> - Convert from printk() to pr_*(),
> - Correct printf()-style format specifiers,
> - Drop superfluous casts,
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> ---
> arch/m68k/coldfire/m528x.c | 4 +-
> arch/m68k/coldfire/sltimers.c | 4 +-
> arch/m68k/coldfire/timers.c | 4 +-
> arch/m68k/coldfire/vectors.c | 2 +-
> arch/m68k/include/asm/dma.h | 98 +++++++++++++------------------------
> arch/m68k/include/asm/mcf_pgtable.h | 9 ++--
> 6 files changed, 44 insertions(+), 77 deletions(-)
>
> diff --git a/arch/m68k/coldfire/m528x.c b/arch/m68k/coldfire/m528x.c
> index 12f9e370d8dde8d8..fcdf6b3d427c3ca0 100644
> --- a/arch/m68k/coldfire/m528x.c
> +++ b/arch/m68k/coldfire/m528x.c
> @@ -99,7 +99,7 @@ void wildfire_halt(void)
> #ifdef CONFIG_WILDFIREMOD
> void wildfiremod_halt(void)
> {
> - printk(KERN_INFO "WildFireMod hibernating...\n");
> + pr_info("WildFireMod hibernating...\n");
>
> /* Set portE.5 to Digital IO */
> writew(readw(MCFGPIO_PEPAR) & ~(1 << (5 * 2)), MCFGPIO_PEPAR);
> @@ -111,7 +111,7 @@ void wildfiremod_halt(void)
> writeb(readb(MCFGPIO_PODR_E) & ~(1 << 5), MCFGPIO_PODR_E);
> writeb(readb(MCFGPIO_PODR_E) | (1 << 5), MCFGPIO_PODR_E);
>
> - printk(KERN_EMERG "Failed to hibernate. Halting!\n");
> + pr_emerg("Failed to hibernate. Halting!\n");
> }
> #endif
>
> diff --git a/arch/m68k/coldfire/sltimers.c b/arch/m68k/coldfire/sltimers.c
> index 831a08cf6f40d7e6..e1c66a4a53d2d285 100644
> --- a/arch/m68k/coldfire/sltimers.c
> +++ b/arch/m68k/coldfire/sltimers.c
> @@ -57,8 +57,8 @@ irqreturn_t mcfslt_profile_tick(int irq, void *dummy)
>
> void mcfslt_profile_init(void)
> {
> - printk(KERN_INFO "PROFILE: lodging TIMER 1 @ %dHz as profile timer\n",
> - PROFILEHZ);
> + pr_info("PROFILE: lodging TIMER 1 @ %dHz as profile timer\n",
> + PROFILEHZ);
>
> setup_irq(MCF_IRQ_PROFILER, &mcfslt_profile_irq);
>
> diff --git a/arch/m68k/coldfire/timers.c b/arch/m68k/coldfire/timers.c
> index cd496a20fcc7ced7..b849e40c97b1a408 100644
> --- a/arch/m68k/coldfire/timers.c
> +++ b/arch/m68k/coldfire/timers.c
> @@ -177,8 +177,8 @@ irqreturn_t coldfire_profile_tick(int irq, void *dummy)
>
> void coldfire_profile_init(void)
> {
> - printk(KERN_INFO "PROFILE: lodging TIMER2 @ %dHz as profile timer\n",
> - PROFILEHZ);
> + pr_info("PROFILE: lodging TIMER2 @ %dHz as profile timer\n",
> + PROFILEHZ);
>
> /* Set up TIMER 2 as high speed profile clock */
> __raw_writew(MCFTIMER_TMR_DISABLE, PA(MCFTIMER_TMR));
> diff --git a/arch/m68k/coldfire/vectors.c b/arch/m68k/coldfire/vectors.c
> index 08923fe600e013d9..a185df5963d4ae50 100644
> --- a/arch/m68k/coldfire/vectors.c
> +++ b/arch/m68k/coldfire/vectors.c
> @@ -24,7 +24,7 @@
> asmlinkage void dbginterrupt_c(struct frame *fp)
> {
> extern void dump(struct pt_regs *fp);
> - printk(KERN_DEBUG "%s(%d): BUS ERROR TRAP\n", __FILE__, __LINE__);
> + pr_debug("%s(%d): BUS ERROR TRAP\n", __FILE__, __LINE__);
> dump((struct pt_regs *) fp);
> asm("halt");
> }

This file also seems to lack #define DEBUG, so you and Greg might want to
check this change.

--

2016-12-07 22:54:34

by Finn Thain

[permalink] [raw]
Subject: Re: [PATCH 07/22] m68k/mac: baboon - Modernize printing of kernel messages


On Wed, 7 Dec 2016, Geert Uytterhoeven wrote:

> - Introduce helpers for printing debug messages, incl. dummies for
> validating format strings when debugging is disabled,
> - Convert from printk() to pr_*(),
> - Drop superfluous casts.
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> ---
> arch/m68k/mac/baboon.c | 22 ++++++++++------------
> 1 file changed, 10 insertions(+), 12 deletions(-)
>
> diff --git a/arch/m68k/mac/baboon.c b/arch/m68k/mac/baboon.c
> index f6f7d42713ec8b95..5dac92227654419b 100644
> --- a/arch/m68k/mac/baboon.c
> +++ b/arch/m68k/mac/baboon.c
> @@ -15,6 +15,11 @@
> #include <asm/mac_baboon.h>
>
> /* #define DEBUG_IRQS */
> +#ifdef DEBUG_IRQS
> +#define pr_irq(fmt, ...) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> +#else
> +#define pr_irq(fmt, ...) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> +#endif
>

I'd prefer to drop the DEBUG_IRQS printk messages in this file.

Thanks.

> int baboon_present;
> static volatile struct baboon *baboon;
> @@ -38,7 +43,7 @@ void __init baboon_init(void)
> baboon = (struct baboon *) BABOON_BASE;
> baboon_present = 1;
>
> - printk("Baboon detected at %p\n", baboon);
> + pr_info("Baboon detected at %p\n", baboon);
> }
>
> /*
> @@ -50,11 +55,8 @@ static void baboon_irq(struct irq_desc *desc)
> int irq_bit, irq_num;
> unsigned char events;
>
> -#ifdef DEBUG_IRQS
> - printk("baboon_irq: mb_control %02X mb_ifr %02X mb_status %02X\n",
> - (uint) baboon->mb_control, (uint) baboon->mb_ifr,
> - (uint) baboon->mb_status);
> -#endif
> + pr_irq("baboon_irq: mb_control %02X mb_ifr %02X mb_status %02X\n",
> + baboon->mb_control, baboon->mb_ifr, baboon->mb_status);
>
> events = baboon->mb_ifr & 0x07;
> if (!events)
> @@ -97,18 +99,14 @@ void __init baboon_register_interrupts(void)
>
> void baboon_irq_enable(int irq)
> {
> -#ifdef DEBUG_IRQUSE
> - printk("baboon_irq_enable(%d)\n", irq);
> -#endif
> + pr_irq("baboon_irq_enable(%d)\n", irq);
>
> mac_irq_enable(irq_get_irq_data(IRQ_NUBUS_C));
> }
>
> void baboon_irq_disable(int irq)
> {
> -#ifdef DEBUG_IRQUSE
> - printk("baboon_irq_disable(%d)\n", irq);
> -#endif
> + pr_irq("baboon_irq_disable(%d)\n", irq);
>
> mac_irq_disable(irq_get_irq_data(IRQ_NUBUS_C));
> }
>

--

2016-12-07 23:06:07

by Finn Thain

[permalink] [raw]
Subject: Re: [PATCH 08/22] m68k/mac: iop - Modernize printing of kernel messages


On Wed, 7 Dec 2016, Geert Uytterhoeven wrote:

> - Introduce helpers for printing debug messages, incl. dummies for
> validating format strings when debugging is disabled,
> - Convert from printk() to pr_*(),
> - Add missing continuations,
> - Drop superfluous casts.
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> ---
> arch/m68k/mac/iop.c | 69 ++++++++++++++++++++++-------------------------------
> 1 file changed, 29 insertions(+), 40 deletions(-)
>
> diff --git a/arch/m68k/mac/iop.c b/arch/m68k/mac/iop.c
> index 7990b6f50105b19b..bbfeded6b270f950 100644
> --- a/arch/m68k/mac/iop.c
> +++ b/arch/m68k/mac/iop.c
> @@ -116,6 +116,13 @@
> #include <asm/mac_iop.h>
>
> /*#define DEBUG_IOP*/
> +#ifdef DEBUG_IOP

We can use #if 0 here, since the macro can be avoided later...

> +#define pr_iop(fmt, ...) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> +#define pr_iop_cont(fmt, ...) pr_cont(fmt, ##__VA_ARGS__)
> +#else
> +#define pr_iop(fmt, ...) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> +#define pr_iop_cont(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
> +#endif
>
> /* Non-zero if the IOPs are present */
>
> @@ -268,10 +275,10 @@ void __init iop_init(void)
> int i;
>
> if (iop_scc_present) {
> - printk("IOP: detected SCC IOP at %p\n", iop_base[IOP_NUM_SCC]);
> + pr_info("IOP: detected SCC IOP at %p\n", iop_base[IOP_NUM_SCC]);
> }
> if (iop_ism_present) {
> - printk("IOP: detected ISM IOP at %p\n", iop_base[IOP_NUM_ISM]);
> + pr_info("IOP: detected ISM IOP at %p\n", iop_base[IOP_NUM_ISM]);
> iop_start(iop_base[IOP_NUM_ISM]);
> iop_alive(iop_base[IOP_NUM_ISM]); /* clears the alive flag */
> }
> @@ -310,9 +317,9 @@ void __init iop_register_interrupts(void)
> pr_err("Couldn't register ISM IOP interrupt\n");
> }
> if (!iop_alive(iop_base[IOP_NUM_ISM])) {
> - printk("IOP: oh my god, they killed the ISM IOP!\n");
> + pr_warn("IOP: oh my god, they killed the ISM IOP!\n");
> } else {
> - printk("IOP: the ISM IOP seems to be alive.\n");
> + pr_info("IOP: the ISM IOP seems to be alive.\n");
> }
> }
> }
> @@ -349,9 +356,8 @@ void iop_complete_message(struct iop_msg *msg)
> int chan = msg->channel;
> int i,offset;
>
> -#ifdef DEBUG_IOP
> - printk("iop_complete(%p): iop %d chan %d\n", msg, msg->iop_num, msg->channel);
> -#endif
> + pr_iop("iop_complete(%p): iop %d chan %d\n", msg, msg->iop_num,
> + msg->channel);
>
> offset = IOP_ADDR_RECV_MSG + (msg->channel * IOP_MSG_LEN);
>
> @@ -397,9 +403,7 @@ static void iop_handle_send(uint iop_num, uint chan)
> struct iop_msg *msg,*msg2;
> int i,offset;
>
> -#ifdef DEBUG_IOP
> - printk("iop_handle_send: iop %d channel %d\n", iop_num, chan);
> -#endif
> + pr_iop("iop_handle_send: iop %d channel %d\n", iop_num, chan);
>
> iop_writeb(iop, IOP_ADDR_SEND_STATE + chan, IOP_MSG_IDLE);
>
> @@ -430,9 +434,7 @@ static void iop_handle_recv(uint iop_num, uint chan)
> int i,offset;
> struct iop_msg *msg;
>
> -#ifdef DEBUG_IOP
> - printk("iop_handle_recv: iop %d channel %d\n", iop_num, chan);
> -#endif
> + pr_iop("iop_handle_recv: iop %d channel %d\n", iop_num, chan);
>
> msg = iop_alloc_msg();
> msg->iop_num = iop_num;
> @@ -454,13 +456,14 @@ static void iop_handle_recv(uint iop_num, uint chan)
> if (msg->handler) {
> (*msg->handler)(msg);
> } else {
> + pr_iop("iop_handle_recv: unclaimed message on iop %d channel %d\n",
> + iop_num, chan);
> #ifdef DEBUG_IOP
> - printk("iop_handle_recv: unclaimed message on iop %d channel %d\n", iop_num, chan);
> - printk("iop_handle_recv:");
> + pr_iop("iop_handle_recv:");
> for (i = 0 ; i < IOP_MSG_LEN ; i++) {
> - printk(" %02X", (uint) msg->message[i]);
> + pr_cont(" %02X", msg->message[i]);
> }
> - printk("\n");
> + pr_iop_cont("\n");
> #endif
> iop_complete_message(msg);
> }

I think you can avoid the DEBUG_IOP macro entirely, by using

pr_iop("iop_handle_recv: %*ph\n", IOP_MSG_LEN, msg->message);

Thanks.

> @@ -574,50 +577,36 @@ irqreturn_t iop_ism_irq(int irq, void *dev_id)
> volatile struct mac_iop *iop = iop_base[iop_num];
> int i,state;
>
> -#ifdef DEBUG_IOP
> - printk("iop_ism_irq: status = %02X\n", (uint) iop->status_ctrl);
> -#endif
> + pr_iop("iop_ism_irq: status = %02X\n", iop->status_ctrl);
>
> /* INT0 indicates a state change on an outgoing message channel */
>
> if (iop->status_ctrl & IOP_INT0) {
> iop->status_ctrl = IOP_INT0 | IOP_RUN | IOP_AUTOINC;
> -#ifdef DEBUG_IOP
> - printk("iop_ism_irq: new status = %02X, send states",
> - (uint) iop->status_ctrl);
> -#endif
> + pr_iop("iop_ism_irq: new status = %02X, send states",
> + iop->status_ctrl);
> for (i = 0 ; i < NUM_IOP_CHAN ; i++) {
> state = iop_readb(iop, IOP_ADDR_SEND_STATE + i);
> -#ifdef DEBUG_IOP
> - printk(" %02X", state);
> -#endif
> + pr_iop_cont(" %02X", state);
> if (state == IOP_MSG_COMPLETE) {
> iop_handle_send(iop_num, i);
> }
> }
> -#ifdef DEBUG_IOP
> - printk("\n");
> -#endif
> + pr_iop_cont("\n");
> }
>
> if (iop->status_ctrl & IOP_INT1) { /* INT1 for incoming msgs */
> iop->status_ctrl = IOP_INT1 | IOP_RUN | IOP_AUTOINC;
> -#ifdef DEBUG_IOP
> - printk("iop_ism_irq: new status = %02X, recv states",
> - (uint) iop->status_ctrl);
> -#endif
> + pr_iop("iop_ism_irq: new status = %02X, recv states",
> + iop->status_ctrl);
> for (i = 0 ; i < NUM_IOP_CHAN ; i++) {
> state = iop_readb(iop, IOP_ADDR_RECV_STATE + i);
> -#ifdef DEBUG_IOP
> - printk(" %02X", state);
> -#endif
> + pr_iop_cont(" %02X", state);
> if (state == IOP_MSG_NEW) {
> iop_handle_recv(iop_num, i);
> }
> }
> -#ifdef DEBUG_IOP
> - printk("\n");
> -#endif
> + pr_iop_cont("\n");
> }
> return IRQ_HANDLED;
> }
>

--

2016-12-07 23:09:21

by Finn Thain

[permalink] [raw]
Subject: Re: [PATCH 09/22] m68k/mac: oss - Modernize printing of kernel messages


On Wed, 7 Dec 2016, Geert Uytterhoeven wrote:

> Convert from printk() to pr_*().
>
> - Introduce helpers for printing debug messages, incl. dummies for
> validating format strings when debugging is disabled,
> - Convert from printk() to pr_*(),
> - Drop superfluous casts,
> - Add linebreaks before opening braces of function bodies.
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> ---
> arch/m68k/mac/oss.c | 26 +++++++++++++++-----------
> 1 file changed, 15 insertions(+), 11 deletions(-)
>
> diff --git a/arch/m68k/mac/oss.c b/arch/m68k/mac/oss.c
> index 55d6592783f55710..e3c22370e9c6ee0d 100644
> --- a/arch/m68k/mac/oss.c
> +++ b/arch/m68k/mac/oss.c
> @@ -26,6 +26,12 @@
> #include <asm/mac_via.h>
> #include <asm/mac_oss.h>
>
> +#ifdef DEBUG_IRQS
> +#define pr_irq(fmt, ...) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> +#else
> +#define pr_irq(fmt, ...) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> +#endif
> +
> int oss_present;
> volatile struct mac_oss *oss;
>

Please just remove the DEBUG_IRQS macro and the related output.

> @@ -72,8 +78,8 @@ static void oss_irq(struct irq_desc *desc)
> if ((console_loglevel == 10) && !(events & OSS_IP_SCSI)) {
> unsigned int irq = irq_desc_get_irq(desc);
>
> - printk("oss_irq: irq %u events = 0x%04X\n", irq,
> - (int) oss->irq_pending);
> + pr_irq("oss_irq: irq %u events = 0x%04X\n", irq,
> + oss->irq_pending);
> }
> #endif
>
> @@ -109,7 +115,7 @@ static void oss_nubus_irq(struct irq_desc *desc)
>
> #ifdef DEBUG_NUBUS_INT
> if (console_loglevel > 7) {
> - printk("oss_nubus_irq: events = 0x%04X\n", events);
> + pr_info("oss_nubus_irq: events = 0x%04X\n", events);
> }
> #endif
> /* There are only six slots on the OSS, not seven */

Same with DEBUG_NUBUS_INT.

Thanks.

> @@ -162,10 +168,9 @@ void __init oss_register_interrupts(void)
> * level for that source to nonzero, thus enabling the interrupt.
> */
>
> -void oss_irq_enable(int irq) {
> -#ifdef DEBUG_IRQUSE
> - printk("oss_irq_enable(%d)\n", irq);
> -#endif
> +void oss_irq_enable(int irq)
> +{
> + pr_irq("oss_irq_enable(%d)\n", irq);
> switch(irq) {
> case IRQ_MAC_SCC:
> oss->irq_level[OSS_IOPSCC] = OSS_IRQLEV_IOPSCC;
> @@ -198,10 +203,9 @@ void oss_irq_enable(int irq) {
> * to disable the interrupt.
> */
>
> -void oss_irq_disable(int irq) {
> -#ifdef DEBUG_IRQUSE
> - printk("oss_irq_disable(%d)\n", irq);
> -#endif
> +void oss_irq_disable(int irq)
> +{
> + pr_irq("oss_irq_disable(%d)\n", irq);
> switch(irq) {
> case IRQ_MAC_SCC:
> oss->irq_level[OSS_IOPSCC] = 0;
>

--

2016-12-07 23:10:32

by Finn Thain

[permalink] [raw]
Subject: Re: [PATCH 10/22] m68k/mac: psc - Modernize printing of kernel messages


On Wed, 7 Dec 2016, Geert Uytterhoeven wrote:

> - Introduce helpers for printing debug messages, incl. dummies for
> validating format strings when debugging is disabled,
> - Convert from printk() to pr_*(),
> - Add missing continuations,
> - Drop superfluous casts.
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> ---
> arch/m68k/mac/psc.c | 32 +++++++++++++++-----------------
> 1 file changed, 15 insertions(+), 17 deletions(-)
>
> diff --git a/arch/m68k/mac/psc.c b/arch/m68k/mac/psc.c
> index cb2b1a3a2b62d97f..83f81790c9eba80a 100644
> --- a/arch/m68k/mac/psc.c
> +++ b/arch/m68k/mac/psc.c
> @@ -26,6 +26,11 @@
> #include <asm/mac_psc.h>
>
> #define DEBUG_PSC
> +#ifdef DEBUG_IRQS
> +#define pr_irq(fmt, ...) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> +#else
> +#define pr_irq(fmt, ...) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> +#endif
>
> volatile __u8 *psc;
> EXPORT_SYMBOL_GPL(psc);

Please remove the DEBUG_IRQS messages and macro.

> @@ -42,10 +47,9 @@ static void psc_debug_dump(void)
> return;
>
> for (i = 0x30 ; i < 0x70 ; i += 0x10) {
> - printk("PSC #%d: IFR = 0x%02X IER = 0x%02X\n",
> - i >> 4,
> - (int) psc_read_byte(pIFRbase + i),
> - (int) psc_read_byte(pIERbase + i));
> + pr_info("PSC #%d: IFR = 0x%02X IER = 0x%02X\n", i >> 4,
> + psc_read_byte(pIFRbase + i),
> + psc_read_byte(pIERbase + i));
> }
> }
>
> @@ -59,14 +63,14 @@ static __init void psc_dma_die_die_die(void)
> {
> int i;
>
> - printk("Killing all PSC DMA channels...");
> + pr_info("Killing all PSC DMA channels...");
> for (i = 0 ; i < 9 ; i++) {
> psc_write_word(PSC_CTL_BASE + (i << 4), 0x8800);
> psc_write_word(PSC_CTL_BASE + (i << 4), 0x1000);
> psc_write_word(PSC_CMD_BASE + (i << 5), 0x1100);
> psc_write_word(PSC_CMD_BASE + (i << 5) + 0x10, 0x1100);
> }
> - printk("done!\n");
> + pr_cont("done!\n");
> }
>
> /*
> @@ -92,7 +96,7 @@ void __init psc_init(void)
>
> psc = (void *) PSC_BASE;
>
> - printk("PSC detected at %p\n", psc);
> + pr_info("PSC detected at %p\n", psc);
>
> psc_dma_die_die_die();
>
> @@ -122,10 +126,8 @@ static void psc_irq(struct irq_desc *desc)
> int irq_num;
> unsigned char irq_bit, events;
>
> -#ifdef DEBUG_IRQS
> - printk("psc_irq: irq %u pIFR = 0x%02X pIER = 0x%02X\n",
> - irq, (int) psc_read_byte(pIFR), (int) psc_read_byte(pIER));
> -#endif
> + pr_irq("psc_irq: irq %u pIFR = 0x%02X pIER = 0x%02X\n", irq,
> + psc_read_byte(pIFR), psc_read_byte(pIER));
>
> events = psc_read_byte(pIFR) & psc_read_byte(pIER) & 0xF;
> if (!events)
> @@ -160,9 +162,7 @@ void psc_irq_enable(int irq) {
> int irq_idx = IRQ_IDX(irq);
> int pIER = pIERbase + (irq_src << 4);
>
> -#ifdef DEBUG_IRQUSE
> - printk("psc_irq_enable(%d)\n", irq);
> -#endif
> + pr_irq("psc_irq_enable(%d)\n", irq);
> psc_write_byte(pIER, (1 << irq_idx) | 0x80);
> }
>
> @@ -171,8 +171,6 @@ void psc_irq_disable(int irq) {
> int irq_idx = IRQ_IDX(irq);
> int pIER = pIERbase + (irq_src << 4);
>
> -#ifdef DEBUG_IRQUSE
> - printk("psc_irq_disable(%d)\n", irq);
> -#endif
> + pr_irq("psc_irq_disable(%d)\n", irq);
> psc_write_byte(pIER, 1 << irq_idx);
> }
>

Same for DEBUG_IRQUSE.

Thanks.

--

2016-12-07 23:19:18

by Finn Thain

[permalink] [raw]
Subject: Re: [PATCH 11/22] m68k/mac: Modernize printing of kernel messages


On Wed, 7 Dec 2016, Geert Uytterhoeven wrote:

> Convert from printk() to pr_*().
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> ---
> arch/m68k/mac/config.c | 34 ++++++++++++++++------------------
> arch/m68k/mac/misc.c | 8 ++++----
> 2 files changed, 20 insertions(+), 22 deletions(-)
>
> diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
> index e46895316eb0ef4d..1d7bc6ab3e7fe1b4 100644
> --- a/arch/m68k/mac/config.c
> +++ b/arch/m68k/mac/config.c
> @@ -150,7 +150,7 @@ static void mac_cache_card_flush(int writeback)
> void __init config_mac(void)
> {
> if (!MACH_IS_MAC)
> - printk(KERN_ERR "ERROR: no Mac, but config_mac() called!!\n");
> + pr_err("ERROR: no Mac, but config_mac() called!!\n");
>
> mach_sched_init = mac_sched_init;
> mach_init_IRQ = mac_init_IRQ;

I think this printk is impossible to reach.


> @@ -837,8 +837,7 @@ static void __init mac_identify(void)
> /* no bootinfo model id -> NetBSD booter was used! */
> /* XXX FIXME: breaks for model > 31 */
> model = (mac_bi_data.cpuid >> 2) & 63;
> - printk(KERN_WARNING "No bootinfo model ID, using cpuid instead "
> - "(obsolete bootloader?)\n");
> + pr_warn("No bootinfo model ID, using cpuid instead (obsolete bootloader?)\n");
> }
>
> macintosh_config = mac_data_table;
> @@ -880,24 +879,23 @@ static void __init mac_identify(void)
> */
> iop_preinit();
>
> - printk(KERN_INFO "Detected Macintosh model: %d\n", model);
> + pr_info("Detected Macintosh model: %d\n", model);
>
> /*
> * Report booter data:
> */
> - printk(KERN_DEBUG " Penguin bootinfo data:\n");
> - printk(KERN_DEBUG " Video: addr 0x%lx "
> - "row 0x%lx depth %lx dimensions %ld x %ld\n",
> - mac_bi_data.videoaddr, mac_bi_data.videorow,
> - mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
> - mac_bi_data.dimensions >> 16);
> - printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
> - mac_bi_data.videological, mac_orig_videoaddr,
> - mac_bi_data.sccbase);
> - printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n",
> - mac_bi_data.boottime, mac_bi_data.gmtbias);
> - printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
> - mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
> + pr_debug(" Penguin bootinfo data:\n");
> + pr_debug(" Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
> + mac_bi_data.videoaddr, mac_bi_data.videorow,
> + mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
> + mac_bi_data.dimensions >> 16);
> + pr_debug(" Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
> + mac_bi_data.videological, mac_orig_videoaddr,
> + mac_bi_data.sccbase);
> + pr_debug(" Boottime: 0x%lx GMTBias: 0x%lx\n", mac_bi_data.boottime,
> + mac_bi_data.gmtbias);
> + pr_debug(" Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
> + mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
>
> iop_init();
> via_init();

I'd prefer that these remained printk(KERN_DEBUG ...).


> @@ -912,7 +910,7 @@ static void __init mac_identify(void)
>
> static void __init mac_report_hardware(void)
> {
> - printk(KERN_INFO "Apple Macintosh %s\n", macintosh_config->name);
> + pr_info("Apple Macintosh %s\n", macintosh_config->name);
> }
>
> static void mac_get_model(char *str)
> diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c
> index 0fb54a90eac27305..676e0caaeaa670a0 100644
> --- a/arch/m68k/mac/misc.c
> +++ b/arch/m68k/mac/misc.c
> @@ -520,7 +520,7 @@ void mac_poweroff(void)
> #endif
> }
> local_irq_enable();
> - printk("It is now safe to turn off your Macintosh.\n");
> + pr_info("It is now safe to turn off your Macintosh.\n");
> while(1);
> }
>
> @@ -610,7 +610,7 @@ void mac_reset(void)
>
> /* should never get here */
> local_irq_enable();
> - printk ("Restart failed. Please restart manually.\n");
> + pr_err("Restart failed. Please restart manually.\n");
> while(1);
> }
>
> @@ -718,13 +718,13 @@ int mac_hwclk(int op, struct rtc_time *t)
> &t->tm_year, &t->tm_mon, &t->tm_mday,
> &t->tm_hour, &t->tm_min, &t->tm_sec);
> #if 0
> - printk("mac_hwclk: read %04d-%02d-%-2d %02d:%02d:%02d\n",
> + pr_info("mac_hwclk: read %04d-%02d-%-2d %02d:%02d:%02d\n",
> t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
> t->tm_hour, t->tm_min, t->tm_sec);
> #endif
> } else { /* write */
> #if 0
> - printk("mac_hwclk: tried to write %04d-%02d-%-2d %02d:%02d:%02d\n",
> + pr_info("mac_hwclk: tried to write %04d-%02d-%-2d %02d:%02d:%02d\n",
> t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
> t->tm_hour, t->tm_min, t->tm_sec);
> #endif
>

These two can be changed to pr_debug() and the #if 0 removed. Since there
is no DEBUG macro definition here, I believe they will become no_printk()
and get checked by the compiler.

Thanks.

--

2016-12-07 23:26:11

by Finn Thain

[permalink] [raw]
Subject: Re: [PATCH 18/22] m68k/mm: kmap - Modernize printing of kernel messages


On Wed, 7 Dec 2016, Geert Uytterhoeven wrote:

> - Convert from printk() to pr_*(),
> - Add missing continuations,
> - Remove #undef DEBUG.
>
> Note that "#ifdef DEBUG" is sometimes retained because pr_cont() is not
> optimized away when debugging is disabled.
>

I think that argues for using printk(KERN_DEBUG ...) and print(KERN_CONT
...) inside #ifdef DEBUG, which would need no explanation.

If instead you use a combination of pr_debug and pr_cont and #ifdef DEBUG,
perhaps the explanation should be moved from the commit log to a comment
in the code?

--

> Signed-off-by: Geert Uytterhoeven <[email protected]>
> ---
> arch/m68k/mm/kmap.c | 26 ++++++++++++--------------
> 1 file changed, 12 insertions(+), 14 deletions(-)
>
> diff --git a/arch/m68k/mm/kmap.c b/arch/m68k/mm/kmap.c
> index 6e4955bc542bfc59..ce4773461651656a 100644
> --- a/arch/m68k/mm/kmap.c
> +++ b/arch/m68k/mm/kmap.c
> @@ -21,8 +21,6 @@
> #include <asm/pgalloc.h>
> #include <asm/io.h>
>
> -#undef DEBUG
> -
> #define PTRTREESIZE (256*1024)
>
> /*
> @@ -125,9 +123,7 @@ void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cachefla
> }
> #endif
>
> -#ifdef DEBUG
> - printk("ioremap: 0x%lx,0x%lx(%d) - ", physaddr, size, cacheflag);
> -#endif
> + pr_debug("ioremap: 0x%lx,0x%lx(%d) - ", physaddr, size, cacheflag);
> /*
> * Mappings have to be aligned
> */
> @@ -145,7 +141,7 @@ void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cachefla
> virtaddr = (unsigned long)area->addr;
> retaddr = virtaddr + offset;
> #ifdef DEBUG
> - printk("0x%lx,0x%lx,0x%lx", physaddr, virtaddr, retaddr);
> + pr_cont("0x%lx,0x%lx,0x%lx", physaddr, virtaddr, retaddr);
> #endif
>
> /*
> @@ -187,12 +183,12 @@ void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cachefla
> while ((long)size > 0) {
> #ifdef DEBUG
> if (!(virtaddr & (PTRTREESIZE-1)))
> - printk ("\npa=%#lx va=%#lx ", physaddr, virtaddr);
> + pr_info("\npa=%#lx va=%#lx ", physaddr, virtaddr);
> #endif
> pgd_dir = pgd_offset_k(virtaddr);
> pmd_dir = pmd_alloc(&init_mm, pgd_dir, virtaddr);
> if (!pmd_dir) {
> - printk("ioremap: no mem for pmd_dir\n");
> + pr_err("ioremap: no mem for pmd_dir\n");
> return NULL;
> }
>
> @@ -204,7 +200,7 @@ void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cachefla
> } else {
> pte_dir = pte_alloc_kernel(pmd_dir, virtaddr);
> if (!pte_dir) {
> - printk("ioremap: no mem for pte_dir\n");
> + pr_err("ioremap: no mem for pte_dir\n");
> return NULL;
> }
>
> @@ -215,7 +211,7 @@ void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cachefla
> }
> }
> #ifdef DEBUG
> - printk("\n");
> + pr_cont("\n");
> #endif
> flush_tlb_all();
>
> @@ -254,7 +250,7 @@ void __iounmap(void *addr, unsigned long size)
> while ((long)size > 0) {
> pgd_dir = pgd_offset_k(virtaddr);
> if (pgd_bad(*pgd_dir)) {
> - printk("iounmap: bad pgd(%08lx)\n", pgd_val(*pgd_dir));
> + pr_err("iounmap: bad pgd(%08lx)\n", pgd_val(*pgd_dir));
> pgd_clear(pgd_dir);
> return;
> }
> @@ -274,7 +270,7 @@ void __iounmap(void *addr, unsigned long size)
> }
>
> if (pmd_bad(*pmd_dir)) {
> - printk("iounmap: bad pmd (%08lx)\n", pmd_val(*pmd_dir));
> + pr_err("iounmap: bad pmd (%08lx)\n", pmd_val(*pmd_dir));
> pmd_clear(pmd_dir);
> return;
> }
> @@ -332,7 +328,8 @@ void kernel_set_cachemode(void *addr, unsigned long size, int cmode)
> while ((long)size > 0) {
> pgd_dir = pgd_offset_k(virtaddr);
> if (pgd_bad(*pgd_dir)) {
> - printk("iocachemode: bad pgd(%08lx)\n", pgd_val(*pgd_dir));
> + pr_err("iocachemode: bad pgd(%08lx)\n",
> + pgd_val(*pgd_dir));
> pgd_clear(pgd_dir);
> return;
> }
> @@ -351,7 +348,8 @@ void kernel_set_cachemode(void *addr, unsigned long size, int cmode)
> }
>
> if (pmd_bad(*pmd_dir)) {
> - printk("iocachemode: bad pmd (%08lx)\n", pmd_val(*pmd_dir));
> + pr_err("iocachemode: bad pmd (%08lx)\n",
> + pmd_val(*pmd_dir));
> pmd_clear(pmd_dir);
> return;
> }
>

2016-12-08 12:25:58

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 02/22] m68k/mac: macints - Modernize printing of kernel messages

On Wed, Dec 7, 2016 at 11:45 PM, Finn Thain <[email protected]> wrote:
> On Wed, 7 Dec 2016, Geert Uytterhoeven wrote:
>
>> - Introduce helpers for printing debug messages, incl. dummies for
>> validating format strings when debugging is disabled,
>> - Convert from printk() to pr_*(),
>> - Add missing continuations, to fix user-visible breakage.
>>
>> Fixes: 4bcc595ccd80decb ("printk: reinstate KERN_CONT for printing continuation lines")
>> Signed-off-by: Geert Uytterhoeven <[email protected]>
>> ---
>> arch/m68k/mac/macints.c | 42 ++++++++++++++++++++++--------------------
>> 1 file changed, 22 insertions(+), 20 deletions(-)
>>
>> diff --git a/arch/m68k/mac/macints.c b/arch/m68k/mac/macints.c
>> index 9f98c08719010e27..8572290cb93b6679 100644
>> --- a/arch/m68k/mac/macints.c
>> +++ b/arch/m68k/mac/macints.c
>> @@ -135,6 +135,11 @@
>> irqreturn_t mac_debug_handler(int, void *);
>>
>> /* #define DEBUG_MACINTS */
>> +#ifdef DEBUG_MACINTS
>> +#define pr_irq(fmt, ...) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
>> +#else
>> +#define pr_irq(fmt, ...) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
>> +#endif
>>
>> static unsigned int mac_irq_startup(struct irq_data *);
>> static void mac_irq_shutdown(struct irq_data *);
>
> I would prefer to delete all the DEBUG_MACINTS clutter.

OK, can do that.

>> @@ -281,7 +282,7 @@ static void mac_irq_shutdown(struct irq_data *data)
>> irqreturn_t mac_debug_handler(int irq, void *dev_id)
>> {
>> if (num_debug[irq] < 10) {
>> - printk("DEBUG: Unexpected IRQ %d\n", irq);
>> + pr_info("DEBUG: Unexpected IRQ %d\n", irq);
>> num_debug[irq]++;
>> }
>> return IRQ_HANDLED;
>
> Is this dead code?

Yes, mac_debug_handler() is unused.

Removing that can be done in a separate patch (this is one of the
patches I'd like
to send upstream ASAP).

>> @@ -319,20 +320,21 @@ irqreturn_t mac_nmi_handler(int irq, void *dev_id)
>> #if 0
>> struct pt_regs *fp = get_irq_regs();
>> show_state();
>> - printk("PC: %08lx\nSR: %04x SP: %p\n", fp->pc, fp->sr, fp);
>> - printk("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
>> - fp->d0, fp->d1, fp->d2, fp->d3);
>> - printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
>> - fp->d4, fp->d5, fp->a0, fp->a1);
>> + pr_info("PC: %08lx\nSR: %04x SP: %p\n", fp->pc, fp->sr, fp);
>> + pr_info("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
>> + fp->d0, fp->d1, fp->d2, fp->d3);
>> + pr_info("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
>> + fp->d4, fp->d5, fp->a0, fp->a1);
>>
>> if (STACK_MAGIC != *(unsigned long *)current->kernel_stack_page)
>> - printk("Corrupted stack page\n");
>> - printk("Process %s (pid: %d, stackpage=%08lx)\n",
>> - current->comm, current->pid, current->kernel_stack_page);
>> + pr_info("Corrupted stack page\n");
>> + pr_info("Process %s (pid: %d, stackpage=%08lx)\n",
>> + current->comm, current->pid,
>> + current->kernel_stack_page);
>> if (intr_count == 1)
>> dump_stack((struct frame *)fp);
>> #else
>> - /* printk("NMI "); */
>> + /* pr_info("NMI "); */
>> #endif
>> }
>> in_nmi--;
>>
>
> I think it would be good to use pr_debug here instead of #if 0. But that
> will probably break the build... better ignore the #if 0 section for this
> series, until I put together a different patch?

Or worse, break at runtime. There's also non-printing code in that block.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2016-12-08 12:41:30

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 01/22] m68k/atari: Modernize printing of kernel messages

On Wed, Dec 7, 2016 at 11:36 PM, Finn Thain <[email protected]> wrote:
> On Wed, 7 Dec 2016, Geert Uytterhoeven wrote:
>> - Convert from printk() to pr_*(),
>> - Add missing continuations, to fix user-visible breakage,
>> - Drop useless WARNING prefix,
>> - Move trailing spaces to start of continuations.
>>
>> Fixes: 4bcc595ccd80decb ("printk: reinstate KERN_CONT for printing continuation lines")
>> Signed-off-by: Geert Uytterhoeven <[email protected]>
>> ---
>> arch/m68k/atari/atakeyb.c | 14 ++++++------
>> arch/m68k/atari/config.c | 56 +++++++++++++++++++++++------------------------
>> 2 files changed, 35 insertions(+), 35 deletions(-)
>>
>> diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c
>> index 264db11268039329..37091898adb3d3b5 100644
>> --- a/arch/m68k/atari/atakeyb.c
>> +++ b/arch/m68k/atari/atakeyb.c
>> @@ -149,7 +149,7 @@ static irqreturn_t atari_keyboard_interrupt(int irq, void *dummy)
>> if (acia_stat & ACIA_OVRN) {
>> /* a very fast typist or a slow system, give a warning */
>> /* ...happens often if interrupts were disabled for too long */
>> - printk(KERN_DEBUG "Keyboard overrun\n");
>> + pr_debug("Keyboard overrun\n");
>> scancode = acia.key_data;
>> if (ikbd_self_test)
>> /* During self test, don't do resyncing, just process the code */
>
> This is not equivalent (unless there is a DEBUG macro definition hinding
> in a header file somewhere). Since the changelog doesn't mention
> suppressing any output, perhaps you were deceived by the questionable API,
> as I have been in the past (see 16b9d870a0 and d61c5427f6).

This is an actual message people want to see in the kernel log, even
when not debugging?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2016-12-08 22:55:58

by Finn Thain

[permalink] [raw]
Subject: Re: [PATCH 01/22] m68k/atari: Modernize printing of kernel messages


On Thu, 8 Dec 2016, Geert Uytterhoeven wrote:

> On Wed, Dec 7, 2016 at 11:36 PM, Finn Thain <[email protected]> wrote:
> > On Wed, 7 Dec 2016, Geert Uytterhoeven wrote:
> >> - Convert from printk() to pr_*(),
> >> - Add missing continuations, to fix user-visible breakage,
> >> - Drop useless WARNING prefix,
> >> - Move trailing spaces to start of continuations.
> >>
> >> Fixes: 4bcc595ccd80decb ("printk: reinstate KERN_CONT for printing continuation lines")
> >> Signed-off-by: Geert Uytterhoeven <[email protected]>
> >> ---
> >> arch/m68k/atari/atakeyb.c | 14 ++++++------
> >> arch/m68k/atari/config.c | 56 +++++++++++++++++++++++------------------------
> >> 2 files changed, 35 insertions(+), 35 deletions(-)
> >>
> >> diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c
> >> index 264db11268039329..37091898adb3d3b5 100644
> >> --- a/arch/m68k/atari/atakeyb.c
> >> +++ b/arch/m68k/atari/atakeyb.c
> >> @@ -149,7 +149,7 @@ static irqreturn_t atari_keyboard_interrupt(int irq, void *dummy)
> >> if (acia_stat & ACIA_OVRN) {
> >> /* a very fast typist or a slow system, give a warning */
> >> /* ...happens often if interrupts were disabled for too long */
> >> - printk(KERN_DEBUG "Keyboard overrun\n");
> >> + pr_debug("Keyboard overrun\n");
> >> scancode = acia.key_data;
> >> if (ikbd_self_test)
> >> /* During self test, don't do resyncing, just process the code */
> >
> > This is not equivalent (unless there is a DEBUG macro definition hinding
> > in a header file somewhere). Since the changelog doesn't mention
> > suppressing any output, perhaps you were deceived by the questionable API,
> > as I have been in the past (see 16b9d870a0 and d61c5427f6).
>
> This is an actual message people want to see in the kernel log, even
> when not debugging?
>

That's really a question for Atari users, of course. For my part, I think
you should mention the behavioural change in the commit log.

--

2016-12-08 23:11:39

by Finn Thain

[permalink] [raw]
Subject: Re: [PATCH 02/22] m68k/mac: macints - Modernize printing of kernel messages


On Thu, 8 Dec 2016, Geert Uytterhoeven wrote:

> On Wed, Dec 7, 2016 at 11:45 PM, Finn Thain <[email protected]> wrote:
> > On Wed, 7 Dec 2016, Geert Uytterhoeven wrote:
> >
> >> - Introduce helpers for printing debug messages, incl. dummies for
> >> validating format strings when debugging is disabled,
> >> - Convert from printk() to pr_*(),
> >> - Add missing continuations, to fix user-visible breakage.
> >>
> >> Fixes: 4bcc595ccd80decb ("printk: reinstate KERN_CONT for printing continuation lines")
> >> Signed-off-by: Geert Uytterhoeven <[email protected]>
> >> ---
> >> arch/m68k/mac/macints.c | 42 ++++++++++++++++++++++--------------------
> >> 1 file changed, 22 insertions(+), 20 deletions(-)
> >>
> >> diff --git a/arch/m68k/mac/macints.c b/arch/m68k/mac/macints.c
> >> index 9f98c08719010e27..8572290cb93b6679 100644
> >> --- a/arch/m68k/mac/macints.c
> >> +++ b/arch/m68k/mac/macints.c
> >> @@ -135,6 +135,11 @@
> >> irqreturn_t mac_debug_handler(int, void *);
> >>
> >> /* #define DEBUG_MACINTS */
> >> +#ifdef DEBUG_MACINTS
> >> +#define pr_irq(fmt, ...) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> >> +#else
> >> +#define pr_irq(fmt, ...) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> >> +#endif
> >>
> >> static unsigned int mac_irq_startup(struct irq_data *);
> >> static void mac_irq_shutdown(struct irq_data *);
> >
> > I would prefer to delete all the DEBUG_MACINTS clutter.
>
> OK, can do that.

Thanks.

>
> >> @@ -281,7 +282,7 @@ static void mac_irq_shutdown(struct irq_data *data)
> >> irqreturn_t mac_debug_handler(int irq, void *dev_id)
> >> {
> >> if (num_debug[irq] < 10) {
> >> - printk("DEBUG: Unexpected IRQ %d\n", irq);
> >> + pr_info("DEBUG: Unexpected IRQ %d\n", irq);
> >> num_debug[irq]++;
> >> }
> >> return IRQ_HANDLED;
> >
> > Is this dead code?
>
> Yes, mac_debug_handler() is unused.
>
> Removing that can be done in a separate patch (this is one of the
> patches I'd like to send upstream ASAP).

OK.

>
> >> @@ -319,20 +320,21 @@ irqreturn_t mac_nmi_handler(int irq, void *dev_id)
> >> #if 0
> >> struct pt_regs *fp = get_irq_regs();
> >> show_state();
> >> - printk("PC: %08lx\nSR: %04x SP: %p\n", fp->pc, fp->sr, fp);
> >> - printk("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
> >> - fp->d0, fp->d1, fp->d2, fp->d3);
> >> - printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
> >> - fp->d4, fp->d5, fp->a0, fp->a1);
> >> + pr_info("PC: %08lx\nSR: %04x SP: %p\n", fp->pc, fp->sr, fp);
> >> + pr_info("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
> >> + fp->d0, fp->d1, fp->d2, fp->d3);
> >> + pr_info("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
> >> + fp->d4, fp->d5, fp->a0, fp->a1);
> >>
> >> if (STACK_MAGIC != *(unsigned long *)current->kernel_stack_page)
> >> - printk("Corrupted stack page\n");
> >> - printk("Process %s (pid: %d, stackpage=%08lx)\n",
> >> - current->comm, current->pid, current->kernel_stack_page);
> >> + pr_info("Corrupted stack page\n");
> >> + pr_info("Process %s (pid: %d, stackpage=%08lx)\n",
> >> + current->comm, current->pid,
> >> + current->kernel_stack_page);
> >> if (intr_count == 1)
> >> dump_stack((struct frame *)fp);
> >> #else
> >> - /* printk("NMI "); */
> >> + /* pr_info("NMI "); */
> >> #endif
> >> }
> >> in_nmi--;
> >>
> >
> > I think it would be good to use pr_debug here instead of #if 0. But that
> > will probably break the build... better ignore the #if 0 section for this
> > series, until I put together a different patch?
>
> Or worse, break at runtime.
>

The NMI isn't easily tiggered, unless you know how. It's solely for
developers.

Anyway, this is dead code so it makes little difference whether you patch
it or not. But this hunk will break an NMI debug patch that I've been
using for ten years or so. Since this code needs a rewrite anyway, you
might as well avoid the churn IMHO.

> There's also non-printing code in that block.

But no side-effects, right?

--

> Gr{oetje,eeting}s,
>
> Geert
>

2016-12-09 12:09:30

by Greg Ungerer

[permalink] [raw]
Subject: Re: [PATCH 06/22] m68k/coldfire: Modernize printing of kernel messages

Hi Finn, Geert,

On 08/12/16 08:53, Finn Thain wrote:
>
> On Wed, 7 Dec 2016, Geert Uytterhoeven wrote:
>
>> - Introduce helpers for printing debug messages, incl. dummies for
>> validating format strings when debugging is disabled,
>> - Convert from printk() to pr_*(),
>> - Correct printf()-style format specifiers,
>> - Drop superfluous casts,
>>
>> Signed-off-by: Geert Uytterhoeven <[email protected]>
>> ---
>> arch/m68k/coldfire/m528x.c | 4 +-
>> arch/m68k/coldfire/sltimers.c | 4 +-
>> arch/m68k/coldfire/timers.c | 4 +-
>> arch/m68k/coldfire/vectors.c | 2 +-
>> arch/m68k/include/asm/dma.h | 98 +++++++++++++------------------------
>> arch/m68k/include/asm/mcf_pgtable.h | 9 ++--
>> 6 files changed, 44 insertions(+), 77 deletions(-)
>>
[snip]
>> diff --git a/arch/m68k/coldfire/vectors.c b/arch/m68k/coldfire/vectors.c
>> index 08923fe600e013d9..a185df5963d4ae50 100644
>> --- a/arch/m68k/coldfire/vectors.c
>> +++ b/arch/m68k/coldfire/vectors.c
>> @@ -24,7 +24,7 @@
>> asmlinkage void dbginterrupt_c(struct frame *fp)
>> {
>> extern void dump(struct pt_regs *fp);
>> - printk(KERN_DEBUG "%s(%d): BUS ERROR TRAP\n", __FILE__, __LINE__);
>> + pr_debug("%s(%d): BUS ERROR TRAP\n", __FILE__, __LINE__);
>> dump((struct pt_regs *) fp);
>> asm("halt");
>> }
>
> This file also seems to lack #define DEBUG, so you and Greg might want to
> check this change.

I think we still want this message in, even if DEBUG is
not defined. This code is conditionally compiled in for
hardware debuger processing - and this message should really
come out if this trap case occurs so the user has some idea
that it just tripped. (The text of the message is not perfect,
but that is a separate issue).

Perhaps pr_alert() or pr_crit() would be better?

Regards
Greg

2016-12-09 12:10:07

by Greg Ungerer

[permalink] [raw]
Subject: Re: [PATCH 04/22] m68k/68000: Modernize printing of kernel messages

Hi Geert,

On 08/12/16 01:09, Geert Uytterhoeven wrote:
> Convert from printk() to pr_*().
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>

Looks good to me, so:

Acked-by: Greg Ungerer <[email protected]>

Regards
Greg



> ---
> arch/m68k/68000/m68328.c | 6 +++---
> arch/m68k/68000/m68EZ328.c | 6 +++---
> arch/m68k/68000/m68VZ328.c | 6 +++---
> 3 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/arch/m68k/68000/m68328.c b/arch/m68k/68000/m68328.c
> index e53caf4c3bfbf9d1..419751b15ec8b5f1 100644
> --- a/arch/m68k/68000/m68328.c
> +++ b/arch/m68k/68000/m68328.c
> @@ -45,9 +45,9 @@ void m68328_reset (void)
>
> void __init config_BSP(char *command, int len)
> {
> - printk(KERN_INFO "\n68328 support D. Jeff Dionne <[email protected]>\n");
> - printk(KERN_INFO "68328 support Kenneth Albanowski <[email protected]>\n");
> - printk(KERN_INFO "68328/Pilot support Bernhard Kuhn <[email protected]>\n");
> + pr_info("68328 support D. Jeff Dionne <[email protected]>\n");
> + pr_info("68328 support Kenneth Albanowski <[email protected]>\n");
> + pr_info("68328/Pilot support Bernhard Kuhn <[email protected]>\n");
>
> mach_hwclk = m68328_hwclk;
> mach_reset = m68328_reset;
> diff --git a/arch/m68k/68000/m68EZ328.c b/arch/m68k/68000/m68EZ328.c
> index e6ab321f93f832e9..6a309a3cfbfc1953 100644
> --- a/arch/m68k/68000/m68EZ328.c
> +++ b/arch/m68k/68000/m68EZ328.c
> @@ -57,12 +57,12 @@ void __init config_BSP(char *command, int len)
> {
> unsigned char *p;
>
> - printk(KERN_INFO "\n68EZ328 DragonBallEZ support (C) 1999 Rt-Control, Inc\n");
> + pr_info("68EZ328 DragonBallEZ support (C) 1999 Rt-Control, Inc\n");
>
> #ifdef CONFIG_UCSIMM
> - printk(KERN_INFO "uCsimm serial string [%s]\n",getserialnum());
> + pr_info("uCsimm serial string [%s]\n", getserialnum());
> p = cs8900a_hwaddr = gethwaddr(0);
> - printk(KERN_INFO "uCsimm hwaddr %pM\n", p);
> + pr_info("uCsimm hwaddr %pM\n", p);
>
> p = getbenv("APPEND");
> if (p) strcpy(p,command);
> diff --git a/arch/m68k/68000/m68VZ328.c b/arch/m68k/68000/m68VZ328.c
> index 1154bdb220a022cd..81b5491685a4a2ab 100644
> --- a/arch/m68k/68000/m68VZ328.c
> +++ b/arch/m68k/68000/m68VZ328.c
> @@ -150,9 +150,9 @@ static void __init init_hardware(char *command, int size)
> {
> char *p;
>
> - printk(KERN_INFO "uCdimm serial string [%s]\n", getserialnum());
> + pr_info("uCdimm serial string [%s]\n", getserialnum());
> p = cs8900a_hwaddr = gethwaddr(0);
> - printk(KERN_INFO "uCdimm hwaddr %pM\n", p);
> + pr_info("uCdimm hwaddr %pM\n", p);
> p = getbenv("APPEND");
> if (p)
> strcpy(p, command);
> @@ -177,7 +177,7 @@ static void __init init_hardware(char *command, int size)
>
> void __init config_BSP(char *command, int size)
> {
> - printk(KERN_INFO "68VZ328 DragonBallVZ support (c) 2001 Lineo, Inc.\n");
> + pr_info("68VZ328 DragonBallVZ support (c) 2001 Lineo, Inc.\n");
>
> init_hardware(command, size);
>
>

2016-12-09 22:50:09

by Finn Thain

[permalink] [raw]
Subject: Re: [PATCH 18/22] m68k/mm: kmap - Modernize printing of kernel messages


On Thu, 8 Dec 2016, I wrote:

>
> On Wed, 7 Dec 2016, Geert Uytterhoeven wrote:
>
> > - Convert from printk() to pr_*(),
> > - Add missing continuations,
> > - Remove #undef DEBUG.
> >
> > Note that "#ifdef DEBUG" is sometimes retained because pr_cont() is
> > not optimized away when debugging is disabled.
> >
>
> I think that argues for using printk(KERN_DEBUG ...) and print(KERN_CONT
> ...) inside #ifdef DEBUG, which would need no explanation.
>
> If instead you use a combination of pr_debug and pr_cont and #ifdef
> DEBUG, perhaps the explanation should be moved from the commit log to a
> comment in the code?
>

Perhaps a better solution than these alternatives would be,

#if defined(DEBUG)
#define pr_debug_cont pr_cont
#else
#define pr_debug_cont no_printk
#endif

But this API is still surprising and ugly. It doesn't work with
CONFIG_DYNAMIC_DEBUG but that's not so important.

IMO, a far better linux/printk.h would have provided us with these
definitions:

#define pr_emerg(fmt, ...) \
printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
/* ... */
#define pr_debug(fmt, ...) \
printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
#define pr_cont(fmt, ...) \
printk(KERN_CONT fmt, ##__VA_ARGS__)

#if defined(CONFIG_DYNAMIC_DEBUG)
#define pr_debug_cond(fmt, ...) \
dynamic_pr_debug(fmt, ##__VA_ARGS__)
#define pr_cont_cond(fmt, ...) \
dynamic_pr_cont(fmt, ##__VA_ARGS__)
#elif defined(DEBUG)
#define pr_debug_cond(fmt, ...) \
printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
#define pr_cont_cond(fmt, ...) \
no_printk(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__)
#else
#define pr_debug_cond(fmt, ...) \
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
#define pr_cont_cond(fmt, ...) \
no_printk(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__)
#endif

Which have the virtues of symmetry and least surprise.

--

2016-12-10 00:44:56

by Michael Schmitz

[permalink] [raw]
Subject: Re: [PATCH 01/22] m68k/atari: Modernize printing of kernel messages

Hi Geert,

Am 09.12.2016 um 01:22 schrieb Geert Uytterhoeven:
> On Wed, Dec 7, 2016 at 11:36 PM, Finn Thain <[email protected]> wrote:
>> On Wed, 7 Dec 2016, Geert Uytterhoeven wrote:
>>> - Convert from printk() to pr_*(),
>>> - Add missing continuations, to fix user-visible breakage,
>>> - Drop useless WARNING prefix,
>>> - Move trailing spaces to start of continuations.
>>>
>>> Fixes: 4bcc595ccd80decb ("printk: reinstate KERN_CONT for printing continuation lines")
>>> Signed-off-by: Geert Uytterhoeven <[email protected]>
>>> ---
>>> arch/m68k/atari/atakeyb.c | 14 ++++++------
>>> arch/m68k/atari/config.c | 56 +++++++++++++++++++++++------------------------
>>> 2 files changed, 35 insertions(+), 35 deletions(-)
>>>
>>> diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c
>>> index 264db11268039329..37091898adb3d3b5 100644
>>> --- a/arch/m68k/atari/atakeyb.c
>>> +++ b/arch/m68k/atari/atakeyb.c
>>> @@ -149,7 +149,7 @@ static irqreturn_t atari_keyboard_interrupt(int irq, void *dummy)
>>> if (acia_stat & ACIA_OVRN) {
>>> /* a very fast typist or a slow system, give a warning */
>>> /* ...happens often if interrupts were disabled for too long */
>>> - printk(KERN_DEBUG "Keyboard overrun\n");
>>> + pr_debug("Keyboard overrun\n");
>>> scancode = acia.key_data;
>>> if (ikbd_self_test)
>>> /* During self test, don't do resyncing, just process the code */
>>
>> This is not equivalent (unless there is a DEBUG macro definition hinding
>> in a header file somewhere). Since the changelog doesn't mention
>> suppressing any output, perhaps you were deceived by the questionable API,
>> as I have been in the past (see 16b9d870a0 and d61c5427f6).
>
> This is an actual message people want to see in the kernel log, even

No, it's not something people want to see - clutters up the screen, and
causes even more interrupt hogging disk IO from syslogd so exacerbates
the problem on slow systems.

But Finn is right in that output is now suppressed instead of given a
particular log level. IMO stating that the message will now only be
generated when the kernel has been compiled for debugging would be
perfectly fine.

Cheers,

Michael


> when not debugging?
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
> --
> To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>