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 08/22] m68k/mac: iop - Modernize printing of kernel messages
Date: Wed, 7 Dec 2016 16:09:06 +0100 [thread overview]
Message-ID: <1481123360-10978-9-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/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
next prev parent reply other threads:[~2016-12-07 15:13 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 ` Geert Uytterhoeven [this message]
2016-12-07 23:06 ` [PATCH 08/22] m68k/mac: iop " 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 ` [PATCH 10/22] m68k/mac: psc " Geert Uytterhoeven
2016-12-07 23:10 ` 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-9-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).