diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-02 10:10:52 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-02 10:10:52 -0700 |
commit | ceb198bb007b84ead867e87a71ffe715c4412b15 (patch) | |
tree | 2d933558cdef1f0e8e7f8efed8b1444a5558fa04 /arch/m68k | |
parent | b68e7e952f24527de62f4768b1cead91f92f5f6e (diff) | |
parent | f6ab4d59a5fe205f12287e515a43fc5e6de779b1 (diff) | |
download | linux-ceb198bb007b84ead867e87a71ffe715c4412b15.tar.bz2 |
Merge tag 'm68k-for-v4.12-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k
Pull m68k updates from Geert Uytterhoeven:
- more kernel message modernizations and cleanups
- Mac and Nubus improvements and cleanups.
* tag 'm68k-for-v4.12-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k:
nubus: Add MVC and VSC video card definitions
nubus: Clean up whitespace
nubus: Clean up printk calls
nubus: Fix nubus_rewinddir
m68k/mac: Clarify IOP message alloc/free confusion
m68k/mac: Adopt platform_device_register_simple()
m68k/mac: Modernize printing of kernel messages
m68k/mac: IOP - Modernize printing of kernel messages
Diffstat (limited to 'arch/m68k')
-rw-r--r-- | arch/m68k/mac/config.c | 61 | ||||
-rw-r--r-- | arch/m68k/mac/iop.c | 93 | ||||
-rw-r--r-- | arch/m68k/mac/misc.c | 23 |
3 files changed, 61 insertions, 116 deletions
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index 9dc65a4c28d2..22123f7e8f75 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,14 +879,13 @@ 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", + 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); @@ -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) @@ -921,15 +919,6 @@ static void mac_get_model(char *str) strcat(str, macintosh_config->name); } -static struct resource swim_rsrc = { .flags = IORESOURCE_MEM }; - -static struct platform_device swim_pdev = { - .name = "swim", - .id = -1, - .num_resources = 1, - .resource = &swim_rsrc, -}; - static const struct resource mac_scsi_iifx_rsrc[] __initconst = { { .flags = IORESOURCE_IRQ, @@ -994,26 +983,6 @@ static const struct resource mac_scsi_ccl_rsrc[] __initconst = { }, }; -static struct platform_device esp_0_pdev = { - .name = "mac_esp", - .id = 0, -}; - -static struct platform_device esp_1_pdev = { - .name = "mac_esp", - .id = 1, -}; - -static struct platform_device sonic_pdev = { - .name = "macsonic", - .id = -1, -}; - -static struct platform_device mace_pdev = { - .name = "macmace", - .id = -1, -}; - int __init mac_platform_init(void) { u8 *swim_base; @@ -1045,9 +1014,13 @@ int __init mac_platform_init(void) } if (swim_base) { - swim_rsrc.start = (resource_size_t) swim_base, - swim_rsrc.end = (resource_size_t) swim_base + 0x2000, - platform_device_register(&swim_pdev); + struct resource swim_rsrc = { + .flags = IORESOURCE_MEM, + .start = (resource_size_t)swim_base, + .end = (resource_size_t)swim_base + 0x2000, + }; + + platform_device_register_simple("swim", -1, &swim_rsrc, 1); } /* @@ -1057,13 +1030,13 @@ int __init mac_platform_init(void) switch (macintosh_config->scsi_type) { case MAC_SCSI_QUADRA: case MAC_SCSI_QUADRA3: - platform_device_register(&esp_0_pdev); + platform_device_register_simple("mac_esp", 0, NULL, 0); break; case MAC_SCSI_QUADRA2: - platform_device_register(&esp_0_pdev); + platform_device_register_simple("mac_esp", 0, NULL, 0); if ((macintosh_config->ident == MAC_MODEL_Q900) || (macintosh_config->ident == MAC_MODEL_Q950)) - platform_device_register(&esp_1_pdev); + platform_device_register_simple("mac_esp", 1, NULL, 0); break; case MAC_SCSI_IIFX: /* Addresses from The Guide to Mac Family Hardware. @@ -1129,10 +1102,10 @@ int __init mac_platform_init(void) switch (macintosh_config->ether_type) { case MAC_ETHER_SONIC: - platform_device_register(&sonic_pdev); + platform_device_register_simple("macsonic", -1, NULL, 0); break; case MAC_ETHER_MACE: - platform_device_register(&mace_pdev); + platform_device_register_simple("macmace", -1, NULL, 0); break; } diff --git a/arch/m68k/mac/iop.c b/arch/m68k/mac/iop.c index 7990b6f50105..4c1e606e7d03 100644 --- a/arch/m68k/mac/iop.c +++ b/arch/m68k/mac/iop.c @@ -115,7 +115,17 @@ #include <asm/macints.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 */ @@ -200,7 +210,7 @@ static int iop_alive(volatile struct mac_iop *iop) return retval; } -static struct iop_msg *iop_alloc_msg(void) +static struct iop_msg *iop_get_unused_msg(void) { int i; unsigned long flags; @@ -219,11 +229,6 @@ static struct iop_msg *iop_alloc_msg(void) return NULL; } -static void iop_free_msg(struct iop_msg *msg) -{ - msg->status = IOP_MSGSTATUS_UNUSED; -} - /* * This is called by the startup code before anything else. Its purpose * is to find and initialize the IOPs early in the boot sequence, so that @@ -268,10 +273,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 +315,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_warn("IOP: the ISM IOP seems to be alive.\n"); } } } @@ -349,9 +354,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 + iop_pr_debug("msg %p iop_num %d channel %d\n", msg, msg->iop_num, + msg->channel); offset = IOP_ADDR_RECV_MSG + (msg->channel * IOP_MSG_LEN); @@ -363,7 +367,7 @@ void iop_complete_message(struct iop_msg *msg) IOP_ADDR_RECV_STATE + chan, IOP_MSG_COMPLETE); iop_interrupt(iop_base[msg->iop_num]); - iop_free_msg(msg); + msg->status = IOP_MSGSTATUS_UNUSED; } /* @@ -394,12 +398,10 @@ static void iop_do_send(struct iop_msg *msg) static void iop_handle_send(uint iop_num, uint chan) { volatile struct mac_iop *iop = iop_base[iop_num]; - struct iop_msg *msg,*msg2; + struct iop_msg *msg; int i,offset; -#ifdef DEBUG_IOP - printk("iop_handle_send: iop %d channel %d\n", iop_num, chan); -#endif + iop_pr_debug("iop_num %d chan %d\n", iop_num, chan); iop_writeb(iop, IOP_ADDR_SEND_STATE + chan, IOP_MSG_IDLE); @@ -411,10 +413,8 @@ static void iop_handle_send(uint iop_num, uint chan) msg->reply[i] = iop_readb(iop, offset); } if (msg->handler) (*msg->handler)(msg); - msg2 = msg; + msg->status = IOP_MSGSTATUS_UNUSED; msg = msg->next; - iop_free_msg(msg2); - iop_send_queue[iop_num][chan] = msg; if (msg) iop_do_send(msg); } @@ -430,11 +430,9 @@ 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 + iop_pr_debug("iop_num %d chan %d\n", iop_num, chan); - msg = iop_alloc_msg(); + msg = iop_get_unused_msg(); msg->iop_num = iop_num; msg->channel = chan; msg->status = IOP_MSGSTATUS_UNSOL; @@ -454,14 +452,9 @@ static void iop_handle_recv(uint iop_num, uint chan) if (msg->handler) { (*msg->handler)(msg); } else { -#ifdef DEBUG_IOP - printk("iop_handle_recv: unclaimed message on iop %d channel %d\n", iop_num, chan); - printk("iop_handle_recv:"); - for (i = 0 ; i < IOP_MSG_LEN ; i++) { - printk(" %02X", (uint) msg->message[i]); - } - printk("\n"); -#endif + iop_pr_debug("unclaimed message on iop_num %d chan %d\n", + iop_num, chan); + iop_pr_debug("%*ph\n", IOP_MSG_LEN, msg->message); iop_complete_message(msg); } } @@ -484,7 +477,7 @@ int iop_send_message(uint iop_num, uint chan, void *privdata, if (chan >= NUM_IOP_CHAN) return -EINVAL; if (msg_len > IOP_MSG_LEN) return -EINVAL; - msg = iop_alloc_msg(); + msg = iop_get_unused_msg(); if (!msg) return -ENOMEM; msg->next = NULL; @@ -574,50 +567,34 @@ 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 + iop_pr_debug("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 + iop_pr_debug("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 + iop_pr_cont(" %02X", state); if (state == IOP_MSG_COMPLETE) { iop_handle_send(iop_num, i); } } -#ifdef DEBUG_IOP - printk("\n"); -#endif + iop_pr_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 + iop_pr_debug("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 + iop_pr_cont(" %02X", state); if (state == IOP_MSG_NEW) { iop_handle_recv(iop_num, i); } } -#ifdef DEBUG_IOP - printk("\n"); -#endif + iop_pr_cont("\n"); } return IRQ_HANDLED; } diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c index 5b01704c85eb..8aa8792e3174 100644 --- a/arch/m68k/mac/misc.c +++ b/arch/m68k/mac/misc.c @@ -281,8 +281,7 @@ static long via_read_time(void) last_result.idata = result.idata; } - pr_err("via_read_time: failed to read a stable value; " - "got 0x%08lx then 0x%08lx\n", + pr_err("via_read_time: failed to read a stable value; got 0x%08lx then 0x%08lx\n", last_result.idata, result.idata); return 0; @@ -465,7 +464,7 @@ void mac_poweroff(void) #endif } local_irq_enable(); - printk("It is now safe to turn off your Macintosh.\n"); + pr_crit("It is now safe to turn off your Macintosh.\n"); while(1); } @@ -556,7 +555,7 @@ void mac_reset(void) /* should never get here */ local_irq_enable(); - printk ("Restart failed. Please restart manually.\n"); + pr_crit("Restart failed. Please restart manually.\n"); while(1); } @@ -661,17 +660,13 @@ int mac_hwclk(int op, struct rtc_time *t) unmktime(now, 0, &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", - t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, - t->tm_hour, t->tm_min, t->tm_sec); -#endif + pr_debug("%s: read %04d-%02d-%-2d %02d:%02d:%02d\n", + __func__, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, + t->tm_hour, t->tm_min, t->tm_sec); } else { /* write */ -#if 0 - printk("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 + pr_debug("%s: tried to write %04d-%02d-%-2d %02d:%02d:%02d\n", + __func__, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, + t->tm_hour, t->tm_min, t->tm_sec); now = mktime(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); |