linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Greg Ungerer <gerg@linux-m68k.org>, Sam Creasey <sammy@sammy.net>,
	Joshua Thompson <funaho@jurai.org>,
	Finn Thain <fthain@telegraphics.com.au>
Cc: linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org,
	Geert Uytterhoeven <geert@linux-m68k.org>
Subject: [PATCH 10/22] m68k/mac: psc - Modernize printing of kernel messages
Date: Wed,  7 Dec 2016 16:09:08 +0100	[thread overview]
Message-ID: <1481123360-10978-11-git-send-email-geert@linux-m68k.org> (raw)
In-Reply-To: <1481123360-10978-1-git-send-email-geert@linux-m68k.org>

  - 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 <geert@linux-m68k.org>
---
 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

  parent reply	other threads:[~2016-12-07 15:18 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-07 15:08 [PATCH 00/22] m68k: Modernize printing of kernel messages Geert Uytterhoeven
2016-12-07 15:08 ` [PATCH 01/22] m68k/atari: " Geert Uytterhoeven
2016-12-07 22:36   ` Finn Thain
2016-12-08 12:22     ` Geert Uytterhoeven
2016-12-08 22:55       ` Finn Thain
2016-12-10  0:44       ` Michael Schmitz
2017-02-09 11:59         ` Geert Uytterhoeven
2016-12-07 15:09 ` [PATCH 02/22] m68k/mac: macints - " Geert Uytterhoeven
2016-12-07 22:45   ` Finn Thain
2016-12-08 12:25     ` Geert Uytterhoeven
2016-12-08 23:11       ` Finn Thain
2016-12-07 15:09 ` [PATCH 03/22] m68k/mac: via " Geert Uytterhoeven
2016-12-07 22:48   ` Finn Thain
2016-12-07 15:09 ` [PATCH 04/22] m68k/68000: " Geert Uytterhoeven
2016-12-09 12:00   ` Greg Ungerer
2016-12-07 15:09 ` [PATCH 05/22] m68k/bvme6000: " Geert Uytterhoeven
2016-12-07 15:09 ` [PATCH 06/22] m68k/coldfire: " Geert Uytterhoeven
2016-12-07 22:53   ` Finn Thain
2016-12-09 12:09     ` Greg Ungerer
2016-12-07 15:09 ` [PATCH 07/22] m68k/mac: baboon - " Geert Uytterhoeven
2016-12-07 22:54   ` Finn Thain
2016-12-07 15:09 ` [PATCH 08/22] m68k/mac: iop " Geert Uytterhoeven
2016-12-07 23:06   ` Finn Thain
2016-12-07 15:09 ` [PATCH 09/22] m68k/mac: oss " Geert Uytterhoeven
2016-12-07 23:08   ` Finn Thain
2016-12-07 15:09 ` Geert Uytterhoeven [this message]
2016-12-07 23:10   ` [PATCH 10/22] m68k/mac: psc " Finn Thain
2016-12-07 15:09 ` [PATCH 11/22] m68k/mac: " Geert Uytterhoeven
2016-12-07 23:17   ` Finn Thain
2016-12-07 15:09 ` [PATCH 12/22] m68k/mvme147: " Geert Uytterhoeven
2016-12-07 15:09 ` [PATCH 13/22] m68k/mvme16x: " Geert Uytterhoeven
2016-12-07 15:09 ` [PATCH 14/22] m68k/q40: " Geert Uytterhoeven
2016-12-07 15:09 ` [PATCH 15/22] m68k/sun3: " Geert Uytterhoeven
2016-12-07 15:09 ` [PATCH 16/22] m68k/sun3x: " Geert Uytterhoeven
2016-12-07 15:09 ` [PATCH 17/22] m68k/kernel: " Geert Uytterhoeven
2016-12-07 15:09 ` [PATCH 18/22] m68k/mm: kmap - " Geert Uytterhoeven
2016-12-07 23:26   ` Finn Thain
2016-12-09 22:50     ` Finn Thain
2016-12-07 15:09 ` [PATCH 19/22] m68k/mm: motorola " Geert Uytterhoeven
2016-12-07 15:09 ` [PATCH 20/22] m68k/mm: sun3 " Geert Uytterhoeven
2016-12-07 15:09 ` [PATCH 21/22] m68k/mm: " Geert Uytterhoeven
2016-12-07 15:09 ` [PATCH 22/22] m68k/include: " Geert Uytterhoeven
2017-02-09 13:25 ` [PATCH 00/22] m68k: " Geert Uytterhoeven
2017-02-12  9:43   ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1481123360-10978-11-git-send-email-geert@linux-m68k.org \
    --to=geert@linux-m68k.org \
    --cc=fthain@telegraphics.com.au \
    --cc=funaho@jurai.org \
    --cc=gerg@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=sammy@sammy.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).