Commit 4629a173 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven

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: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
[FT: Renamed pr_iop* macros, adjusted log message severity and eliminated DEBUG_IOP]
Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
parent c1ae3cfa
...@@ -115,7 +115,17 @@ ...@@ -115,7 +115,17 @@
#include <asm/macints.h> #include <asm/macints.h>
#include <asm/mac_iop.h> #include <asm/mac_iop.h>
/*#define DEBUG_IOP*/ #ifdef DEBUG
#define iop_pr_debug(fmt, ...) \
printk(KERN_DEBUG "%s: " fmt, __func__, ##__VA_ARGS__)
#define iop_pr_cont(fmt, ...) \
printk(KERN_CONT fmt, ##__VA_ARGS__)
#else
#define iop_pr_debug(fmt, ...) \
no_printk(KERN_DEBUG "%s: " fmt, __func__, ##__VA_ARGS__)
#define iop_pr_cont(fmt, ...) \
no_printk(KERN_CONT fmt, ##__VA_ARGS__)
#endif
/* Non-zero if the IOPs are present */ /* Non-zero if the IOPs are present */
...@@ -268,10 +278,10 @@ void __init iop_init(void) ...@@ -268,10 +278,10 @@ void __init iop_init(void)
int i; int i;
if (iop_scc_present) { 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) { 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_start(iop_base[IOP_NUM_ISM]);
iop_alive(iop_base[IOP_NUM_ISM]); /* clears the alive flag */ iop_alive(iop_base[IOP_NUM_ISM]); /* clears the alive flag */
} }
...@@ -310,9 +320,9 @@ void __init iop_register_interrupts(void) ...@@ -310,9 +320,9 @@ void __init iop_register_interrupts(void)
pr_err("Couldn't register ISM IOP interrupt\n"); pr_err("Couldn't register ISM IOP interrupt\n");
} }
if (!iop_alive(iop_base[IOP_NUM_ISM])) { 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 { } else {
printk("IOP: the ISM IOP seems to be alive.\n"); pr_warn("IOP: the ISM IOP seems to be alive.\n");
} }
} }
} }
...@@ -349,9 +359,8 @@ void iop_complete_message(struct iop_msg *msg) ...@@ -349,9 +359,8 @@ void iop_complete_message(struct iop_msg *msg)
int chan = msg->channel; int chan = msg->channel;
int i,offset; int i,offset;
#ifdef DEBUG_IOP iop_pr_debug("msg %p iop_num %d channel %d\n", msg, msg->iop_num,
printk("iop_complete(%p): iop %d chan %d\n", msg, msg->iop_num, msg->channel); msg->channel);
#endif
offset = IOP_ADDR_RECV_MSG + (msg->channel * IOP_MSG_LEN); offset = IOP_ADDR_RECV_MSG + (msg->channel * IOP_MSG_LEN);
...@@ -397,9 +406,7 @@ static void iop_handle_send(uint iop_num, uint chan) ...@@ -397,9 +406,7 @@ static void iop_handle_send(uint iop_num, uint chan)
struct iop_msg *msg,*msg2; struct iop_msg *msg,*msg2;
int i,offset; int i,offset;
#ifdef DEBUG_IOP iop_pr_debug("iop_num %d chan %d\n", iop_num, chan);
printk("iop_handle_send: iop %d channel %d\n", iop_num, chan);
#endif
iop_writeb(iop, IOP_ADDR_SEND_STATE + chan, IOP_MSG_IDLE); iop_writeb(iop, IOP_ADDR_SEND_STATE + chan, IOP_MSG_IDLE);
...@@ -430,9 +437,7 @@ static void iop_handle_recv(uint iop_num, uint chan) ...@@ -430,9 +437,7 @@ static void iop_handle_recv(uint iop_num, uint chan)
int i,offset; int i,offset;
struct iop_msg *msg; struct iop_msg *msg;
#ifdef DEBUG_IOP iop_pr_debug("iop_num %d chan %d\n", iop_num, chan);
printk("iop_handle_recv: iop %d channel %d\n", iop_num, chan);
#endif
msg = iop_alloc_msg(); msg = iop_alloc_msg();
msg->iop_num = iop_num; msg->iop_num = iop_num;
...@@ -454,14 +459,9 @@ static void iop_handle_recv(uint iop_num, uint chan) ...@@ -454,14 +459,9 @@ static void iop_handle_recv(uint iop_num, uint chan)
if (msg->handler) { if (msg->handler) {
(*msg->handler)(msg); (*msg->handler)(msg);
} else { } else {
#ifdef DEBUG_IOP iop_pr_debug("unclaimed message on iop_num %d chan %d\n",
printk("iop_handle_recv: unclaimed message on iop %d channel %d\n", iop_num, chan); iop_num, chan);
printk("iop_handle_recv:"); iop_pr_debug("%*ph\n", IOP_MSG_LEN, msg->message);
for (i = 0 ; i < IOP_MSG_LEN ; i++) {
printk(" %02X", (uint) msg->message[i]);
}
printk("\n");
#endif
iop_complete_message(msg); iop_complete_message(msg);
} }
} }
...@@ -574,50 +574,34 @@ irqreturn_t iop_ism_irq(int irq, void *dev_id) ...@@ -574,50 +574,34 @@ irqreturn_t iop_ism_irq(int irq, void *dev_id)
volatile struct mac_iop *iop = iop_base[iop_num]; volatile struct mac_iop *iop = iop_base[iop_num];
int i,state; int i,state;
#ifdef DEBUG_IOP iop_pr_debug("status %02X\n", iop->status_ctrl);
printk("iop_ism_irq: status = %02X\n", (uint) iop->status_ctrl);
#endif
/* INT0 indicates a state change on an outgoing message channel */ /* INT0 indicates a state change on an outgoing message channel */
if (iop->status_ctrl & IOP_INT0) { if (iop->status_ctrl & IOP_INT0) {
iop->status_ctrl = IOP_INT0 | IOP_RUN | IOP_AUTOINC; iop->status_ctrl = IOP_INT0 | IOP_RUN | IOP_AUTOINC;
#ifdef DEBUG_IOP iop_pr_debug("new status %02X, send states", iop->status_ctrl);
printk("iop_ism_irq: new status = %02X, send states",
(uint) iop->status_ctrl);
#endif
for (i = 0 ; i < NUM_IOP_CHAN ; i++) { for (i = 0 ; i < NUM_IOP_CHAN ; i++) {
state = iop_readb(iop, IOP_ADDR_SEND_STATE + i); state = iop_readb(iop, IOP_ADDR_SEND_STATE + i);
#ifdef DEBUG_IOP iop_pr_cont(" %02X", state);
printk(" %02X", state);
#endif
if (state == IOP_MSG_COMPLETE) { if (state == IOP_MSG_COMPLETE) {
iop_handle_send(iop_num, i); iop_handle_send(iop_num, i);
} }
} }
#ifdef DEBUG_IOP iop_pr_cont("\n");
printk("\n");
#endif
} }
if (iop->status_ctrl & IOP_INT1) { /* INT1 for incoming msgs */ if (iop->status_ctrl & IOP_INT1) { /* INT1 for incoming msgs */
iop->status_ctrl = IOP_INT1 | IOP_RUN | IOP_AUTOINC; iop->status_ctrl = IOP_INT1 | IOP_RUN | IOP_AUTOINC;
#ifdef DEBUG_IOP iop_pr_debug("new status %02X, recv states", iop->status_ctrl);
printk("iop_ism_irq: new status = %02X, recv states",
(uint) iop->status_ctrl);
#endif
for (i = 0 ; i < NUM_IOP_CHAN ; i++) { for (i = 0 ; i < NUM_IOP_CHAN ; i++) {
state = iop_readb(iop, IOP_ADDR_RECV_STATE + i); state = iop_readb(iop, IOP_ADDR_RECV_STATE + i);
#ifdef DEBUG_IOP iop_pr_cont(" %02X", state);
printk(" %02X", state);
#endif
if (state == IOP_MSG_NEW) { if (state == IOP_MSG_NEW) {
iop_handle_recv(iop_num, i); iop_handle_recv(iop_num, i);
} }
} }
#ifdef DEBUG_IOP iop_pr_cont("\n");
printk("\n");
#endif
} }
return IRQ_HANDLED; return IRQ_HANDLED;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment