diff options
Diffstat (limited to 'drivers/net/wan')
29 files changed, 627 insertions, 679 deletions
diff --git a/drivers/net/wan/c101.c b/drivers/net/wan/c101.c index 4ac85a09c5a..54f995f4a5a 100644 --- a/drivers/net/wan/c101.c +++ b/drivers/net/wan/c101.c @@ -14,6 +14,8 @@ * Moxa C101 User's Manual */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> #include <linux/kernel.h> #include <linux/capability.h> @@ -313,44 +315,44 @@ static int __init c101_run(unsigned long irq, unsigned long winbase) int result; if (irq<3 || irq>15 || irq == 6) /* FIXME */ { - printk(KERN_ERR "c101: invalid IRQ value\n"); + pr_err("invalid IRQ value\n"); return -ENODEV; } if (winbase < 0xC0000 || winbase > 0xDFFFF || (winbase & 0x3FFF) !=0) { - printk(KERN_ERR "c101: invalid RAM value\n"); + pr_err("invalid RAM value\n"); return -ENODEV; } card = kzalloc(sizeof(card_t), GFP_KERNEL); if (card == NULL) { - printk(KERN_ERR "c101: unable to allocate memory\n"); + pr_err("unable to allocate memory\n"); return -ENOBUFS; } card->dev = alloc_hdlcdev(card); if (!card->dev) { - printk(KERN_ERR "c101: unable to allocate memory\n"); + pr_err("unable to allocate memory\n"); kfree(card); return -ENOBUFS; } if (request_irq(irq, sca_intr, 0, devname, card)) { - printk(KERN_ERR "c101: could not allocate IRQ\n"); + pr_err("could not allocate IRQ\n"); c101_destroy_card(card); return -EBUSY; } card->irq = irq; if (!request_mem_region(winbase, C101_MAPPED_RAM_SIZE, devname)) { - printk(KERN_ERR "c101: could not request RAM window\n"); + pr_err("could not request RAM window\n"); c101_destroy_card(card); return -EBUSY; } card->phy_winbase = winbase; card->win0base = ioremap(winbase, C101_MAPPED_RAM_SIZE); if (!card->win0base) { - printk(KERN_ERR "c101: could not map I/O address\n"); + pr_err("could not map I/O address\n"); c101_destroy_card(card); return -EFAULT; } @@ -381,7 +383,7 @@ static int __init c101_run(unsigned long irq, unsigned long winbase) result = register_hdlc_device(dev); if (result) { - printk(KERN_WARNING "c101: unable to register hdlc device\n"); + pr_warn("unable to register hdlc device\n"); c101_destroy_card(card); return result; } @@ -389,10 +391,8 @@ static int __init c101_run(unsigned long irq, unsigned long winbase) sca_init_port(card); /* Set up C101 memory */ set_carrier(card); - printk(KERN_INFO "%s: Moxa C101 on IRQ%u," - " using %u TX + %u RX packets rings\n", - dev->name, card->irq, - card->tx_ring_buffers, card->rx_ring_buffers); + netdev_info(dev, "Moxa C101 on IRQ%u, using %u TX + %u RX packets rings\n", + card->irq, card->tx_ring_buffers, card->rx_ring_buffers); *new_card = card; new_card = &card->next_card; @@ -405,12 +405,12 @@ static int __init c101_init(void) { if (hw == NULL) { #ifdef MODULE - printk(KERN_INFO "c101: no card initialized\n"); + pr_info("no card initialized\n"); #endif return -EINVAL; /* no parameters specified, abort */ } - printk(KERN_INFO "%s\n", version); + pr_info("%s\n", version); do { unsigned long irq, ram; @@ -428,7 +428,7 @@ static int __init c101_init(void) return first_card ? 0 : -EINVAL; }while(*hw++ == ':'); - printk(KERN_ERR "c101: invalid hardware parameters\n"); + pr_err("invalid hardware parameters\n"); return first_card ? 0 : -EINVAL; } diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index 6fb6f8e667d..6aed238e573 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c @@ -74,6 +74,8 @@ * The Sync PPP/Cisco HDLC layer (syncppp.c) ported to Linux by Alan Cox */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> @@ -361,14 +363,13 @@ static int __init cosa_init(void) if (cosa_major > 0) { if (register_chrdev(cosa_major, "cosa", &cosa_fops)) { - printk(KERN_WARNING "cosa: unable to get major %d\n", - cosa_major); + pr_warn("unable to get major %d\n", cosa_major); err = -EIO; goto out; } } else { if (!(cosa_major=register_chrdev(0, "cosa", &cosa_fops))) { - printk(KERN_WARNING "cosa: unable to register chardev\n"); + pr_warn("unable to register chardev\n"); err = -EIO; goto out; } @@ -378,7 +379,7 @@ static int __init cosa_init(void) for (i=0; io[i] != 0 && i < MAX_CARDS; i++) cosa_probe(io[i], irq[i], dma[i]); if (!nr_cards) { - printk(KERN_WARNING "cosa: no devices found.\n"); + pr_warn("no devices found\n"); unregister_chrdev(cosa_major, "cosa"); err = -ENODEV; goto out; @@ -447,26 +448,25 @@ static int cosa_probe(int base, int irq, int dma) /* Checking validity of parameters: */ /* IRQ should be 2-7 or 10-15; negative IRQ means autoprobe */ if ((irq >= 0 && irq < 2) || irq > 15 || (irq < 10 && irq > 7)) { - printk (KERN_INFO "cosa_probe: invalid IRQ %d\n", irq); + pr_info("invalid IRQ %d\n", irq); return -1; } /* I/O address should be between 0x100 and 0x3ff and should be * multiple of 8. */ if (base < 0x100 || base > 0x3ff || base & 0x7) { - printk (KERN_INFO "cosa_probe: invalid I/O address 0x%x\n", - base); + pr_info("invalid I/O address 0x%x\n", base); return -1; } /* DMA should be 0,1 or 3-7 */ if (dma < 0 || dma == 4 || dma > 7) { - printk (KERN_INFO "cosa_probe: invalid DMA %d\n", dma); + pr_info("invalid DMA %d\n", dma); return -1; } /* and finally, on 16-bit COSA DMA should be 4-7 and * I/O base should not be multiple of 0x10 */ if (((base & 0x8) && dma < 4) || (!(base & 0x8) && dma > 3)) { - printk (KERN_INFO "cosa_probe: 8/16 bit base and DMA mismatch" - " (base=0x%x, dma=%d)\n", base, dma); + pr_info("8/16 bit base and DMA mismatch (base=0x%x, dma=%d)\n", + base, dma); return -1; } @@ -479,7 +479,7 @@ static int cosa_probe(int base, int irq, int dma) return -1; if (cosa_reset_and_read_id(cosa, cosa->id_string) < 0) { - printk(KERN_DEBUG "cosa: probe at 0x%x failed.\n", base); + printk(KERN_DEBUG "probe at 0x%x failed.\n", base); err = -1; goto err_out; } @@ -492,8 +492,7 @@ static int cosa_probe(int base, int irq, int dma) else { /* Print a warning only if we are not autoprobing */ #ifndef COSA_ISA_AUTOPROBE - printk(KERN_INFO "cosa: valid signature not found at 0x%x.\n", - base); + pr_info("valid signature not found at 0x%x\n", base); #endif err = -1; goto err_out; @@ -501,14 +500,14 @@ static int cosa_probe(int base, int irq, int dma) /* Update the name of the region now we know the type of card */ release_region(base, is_8bit(cosa)?2:4); if (!request_region(base, is_8bit(cosa)?2:4, cosa->type)) { - printk(KERN_DEBUG "cosa: changing name at 0x%x failed.\n", base); + printk(KERN_DEBUG "changing name at 0x%x failed.\n", base); return -1; } /* Now do IRQ autoprobe */ if (irq < 0) { unsigned long irqs; -/* printk(KERN_INFO "IRQ autoprobe\n"); */ +/* pr_info("IRQ autoprobe\n"); */ irqs = probe_irq_on(); /* * Enable interrupt on tx buffer empty (it sure is) @@ -526,13 +525,13 @@ static int cosa_probe(int base, int irq, int dma) cosa_getdata8(cosa); if (irq < 0) { - printk (KERN_INFO "cosa IRQ autoprobe: multiple interrupts obtained (%d, board at 0x%x)\n", + pr_info("multiple interrupts obtained (%d, board at 0x%x)\n", irq, cosa->datareg); err = -1; goto err_out; } if (irq == 0) { - printk (KERN_INFO "cosa IRQ autoprobe: no interrupt obtained (board at 0x%x)\n", + pr_info("no interrupt obtained (board at 0x%x)\n", cosa->datareg); /* return -1; */ } @@ -579,8 +578,7 @@ static int cosa_probe(int base, int irq, int dma) /* Register the network interface */ if (!(chan->netdev = alloc_hdlcdev(chan))) { - printk(KERN_WARNING "%s: alloc_hdlcdev failed.\n", - chan->name); + pr_warn("%s: alloc_hdlcdev failed\n", chan->name); goto err_hdlcdev; } dev_to_hdlc(chan->netdev)->attach = cosa_net_attach; @@ -591,14 +589,14 @@ static int cosa_probe(int base, int irq, int dma) chan->netdev->irq = chan->cosa->irq; chan->netdev->dma = chan->cosa->dma; if (register_hdlc_device(chan->netdev)) { - printk(KERN_WARNING "%s: register_hdlc_device()" - " failed.\n", chan->netdev->name); + netdev_warn(chan->netdev, + "register_hdlc_device() failed\n"); free_netdev(chan->netdev); goto err_hdlcdev; } } - printk (KERN_INFO "cosa%d: %s (%s at 0x%x irq %d dma %d), %d channels\n", + pr_info("cosa%d: %s (%s at 0x%x irq %d dma %d), %d channels\n", cosa->num, cosa->id_string, cosa->type, cosa->datareg, cosa->irq, cosa->dma, cosa->nchannels); @@ -618,8 +616,7 @@ err_out1: free_irq(cosa->irq, cosa); err_out: release_region(cosa->datareg,is_8bit(cosa)?2:4); - printk(KERN_NOTICE "cosa%d: allocating resources failed\n", - cosa->num); + pr_notice("cosa%d: allocating resources failed\n", cosa->num); return err; } @@ -641,14 +638,14 @@ static int cosa_net_open(struct net_device *dev) unsigned long flags; if (!(chan->cosa->firmware_status & COSA_FW_START)) { - printk(KERN_NOTICE "%s: start the firmware first (status %d)\n", - chan->cosa->name, chan->cosa->firmware_status); + pr_notice("%s: start the firmware first (status %d)\n", + chan->cosa->name, chan->cosa->firmware_status); return -EPERM; } spin_lock_irqsave(&chan->cosa->lock, flags); if (chan->usage != 0) { - printk(KERN_WARNING "%s: cosa_net_open called with usage count" - " %d\n", chan->name, chan->usage); + pr_warn("%s: cosa_net_open called with usage count %d\n", + chan->name, chan->usage); spin_unlock_irqrestore(&chan->cosa->lock, flags); return -EBUSY; } @@ -736,8 +733,7 @@ static char *cosa_net_setup_rx(struct channel_data *chan, int size) kfree_skb(chan->rx_skb); chan->rx_skb = dev_alloc_skb(size); if (chan->rx_skb == NULL) { - printk(KERN_NOTICE "%s: Memory squeeze, dropping packet\n", - chan->name); + pr_notice("%s: Memory squeeze, dropping packet\n", chan->name); chan->netdev->stats.rx_dropped++; return NULL; } @@ -748,8 +744,7 @@ static char *cosa_net_setup_rx(struct channel_data *chan, int size) static int cosa_net_rx_done(struct channel_data *chan) { if (!chan->rx_skb) { - printk(KERN_WARNING "%s: rx_done with empty skb!\n", - chan->name); + pr_warn("%s: rx_done with empty skb!\n", chan->name); chan->netdev->stats.rx_errors++; chan->netdev->stats.rx_frame_errors++; return 0; @@ -768,8 +763,7 @@ static int cosa_net_rx_done(struct channel_data *chan) static int cosa_net_tx_done(struct channel_data *chan, int size) { if (!chan->tx_skb) { - printk(KERN_WARNING "%s: tx_done with empty skb!\n", - chan->name); + pr_warn("%s: tx_done with empty skb!\n", chan->name); chan->netdev->stats.tx_errors++; chan->netdev->stats.tx_aborted_errors++; return 1; @@ -794,15 +788,15 @@ static ssize_t cosa_read(struct file *file, char *kbuf; if (!(cosa->firmware_status & COSA_FW_START)) { - printk(KERN_NOTICE "%s: start the firmware first (status %d)\n", - cosa->name, cosa->firmware_status); + pr_notice("%s: start the firmware first (status %d)\n", + cosa->name, cosa->firmware_status); return -EPERM; } if (mutex_lock_interruptible(&chan->rlock)) return -ERESTARTSYS; if ((chan->rxdata = kmalloc(COSA_MTU, GFP_DMA|GFP_KERNEL)) == NULL) { - printk(KERN_INFO "%s: cosa_read() - OOM\n", cosa->name); + pr_info("%s: cosa_read() - OOM\n", cosa->name); mutex_unlock(&chan->rlock); return -ENOMEM; } @@ -869,8 +863,8 @@ static ssize_t cosa_write(struct file *file, char *kbuf; if (!(cosa->firmware_status & COSA_FW_START)) { - printk(KERN_NOTICE "%s: start the firmware first (status %d)\n", - cosa->name, cosa->firmware_status); + pr_notice("%s: start the firmware first (status %d)\n", + cosa->name, cosa->firmware_status); return -EPERM; } if (down_interruptible(&chan->wsem)) @@ -881,8 +875,8 @@ static ssize_t cosa_write(struct file *file, /* Allocate the buffer */ if ((kbuf = kmalloc(count, GFP_KERNEL|GFP_DMA)) == NULL) { - printk(KERN_NOTICE "%s: cosa_write() OOM - dropping packet\n", - cosa->name); + pr_notice("%s: cosa_write() OOM - dropping packet\n", + cosa->name); up(&chan->wsem); return -ENOMEM; } @@ -932,7 +926,7 @@ static int chrdev_tx_done(struct channel_data *chan, int size) static unsigned int cosa_poll(struct file *file, poll_table *poll) { - printk(KERN_INFO "cosa_poll is here\n"); + pr_info("cosa_poll is here\n"); return 0; } @@ -1017,15 +1011,14 @@ static inline int cosa_reset(struct cosa_data *cosa) { char idstring[COSA_MAX_ID_STRING]; if (cosa->usage > 1) - printk(KERN_INFO "cosa%d: WARNING: reset requested with cosa->usage > 1 (%d). Odd things may happen.\n", + pr_info("cosa%d: WARNING: reset requested with cosa->usage > 1 (%d). Odd things may happen.\n", cosa->num, cosa->usage); cosa->firmware_status &= ~(COSA_FW_RESET|COSA_FW_START); if (cosa_reset_and_read_id(cosa, idstring) < 0) { - printk(KERN_NOTICE "cosa%d: reset failed\n", cosa->num); + pr_notice("cosa%d: reset failed\n", cosa->num); return -EIO; } - printk(KERN_INFO "cosa%d: resetting device: %s\n", cosa->num, - idstring); + pr_info("cosa%d: resetting device: %s\n", cosa->num, idstring); cosa->firmware_status |= COSA_FW_RESET; return 0; } @@ -1037,11 +1030,11 @@ static inline int cosa_download(struct cosa_data *cosa, void __user *arg) int i; if (cosa->usage > 1) - printk(KERN_INFO "%s: WARNING: download of microcode requested with cosa->usage > 1 (%d). Odd things may happen.\n", + pr_info("%s: WARNING: download of microcode requested with cosa->usage > 1 (%d). Odd things may happen.\n", cosa->name, cosa->usage); if (!(cosa->firmware_status & COSA_FW_RESET)) { - printk(KERN_NOTICE "%s: reset the card first (status %d).\n", - cosa->name, cosa->firmware_status); + pr_notice("%s: reset the card first (status %d)\n", + cosa->name, cosa->firmware_status); return -EPERM; } @@ -1059,11 +1052,11 @@ static inline int cosa_download(struct cosa_data *cosa, void __user *arg) i = download(cosa, d.code, d.len, d.addr); if (i < 0) { - printk(KERN_NOTICE "cosa%d: microcode download failed: %d\n", - cosa->num, i); + pr_notice("cosa%d: microcode download failed: %d\n", + cosa->num, i); return -EIO; } - printk(KERN_INFO "cosa%d: downloading microcode - 0x%04x bytes at 0x%04x\n", + pr_info("cosa%d: downloading microcode - 0x%04x bytes at 0x%04x\n", cosa->num, d.len, d.addr); cosa->firmware_status |= COSA_FW_RESET|COSA_FW_DOWNLOAD; return 0; @@ -1076,12 +1069,11 @@ static inline int cosa_readmem(struct cosa_data *cosa, void __user *arg) int i; if (cosa->usage > 1) - printk(KERN_INFO "cosa%d: WARNING: readmem requested with " - "cosa->usage > 1 (%d). Odd things may happen.\n", + pr_info("cosa%d: WARNING: readmem requested with cosa->usage > 1 (%d). Odd things may happen.\n", cosa->num, cosa->usage); if (!(cosa->firmware_status & COSA_FW_RESET)) { - printk(KERN_NOTICE "%s: reset the card first (status %d).\n", - cosa->name, cosa->firmware_status); + pr_notice("%s: reset the card first (status %d)\n", + cosa->name, cosa->firmware_status); return -EPERM; } @@ -1093,11 +1085,10 @@ static inline int cosa_readmem(struct cosa_data *cosa, void __user *arg) i = readmem(cosa, d.code, d.len, d.addr); if (i < 0) { - printk(KERN_NOTICE "cosa%d: reading memory failed: %d\n", - cosa->num, i); + pr_notice("cosa%d: reading memory failed: %d\n", cosa->num, i); return -EIO; } - printk(KERN_INFO "cosa%d: reading card memory - 0x%04x bytes at 0x%04x\n", + pr_info("cosa%d: reading card memory - 0x%04x bytes at 0x%04x\n", cosa->num, d.len, d.addr); cosa->firmware_status |= COSA_FW_RESET; return 0; @@ -1109,23 +1100,22 @@ static inline int cosa_start(struct cosa_data *cosa, int address) int i; if (cosa->usage > 1) - printk(KERN_INFO "cosa%d: WARNING: start microcode requested with cosa->usage > 1 (%d). Odd things may happen.\n", + pr_info("cosa%d: WARNING: start microcode requested with cosa->usage > 1 (%d). Odd things may happen.\n", cosa->num, cosa->usage); if ((cosa->firmware_status & (COSA_FW_RESET|COSA_FW_DOWNLOAD)) != (COSA_FW_RESET|COSA_FW_DOWNLOAD)) { - printk(KERN_NOTICE "%s: download the microcode and/or reset the card first (status %d).\n", - cosa->name, cosa->firmware_status); + pr_notice("%s: download the microcode and/or reset the card first (status %d)\n", + cosa->name, cosa->firmware_status); return -EPERM; } cosa->firmware_status &= ~COSA_FW_RESET; if ((i=startmicrocode(cosa, address)) < 0) { - printk(KERN_NOTICE "cosa%d: start microcode at 0x%04x failed: %d\n", - cosa->num, address, i); + pr_notice("cosa%d: start microcode at 0x%04x failed: %d\n", + cosa->num, address, i); return -EIO; } - printk(KERN_INFO "cosa%d: starting microcode at 0x%04x\n", - cosa->num, address); + pr_info("cosa%d: starting microcode at 0x%04x\n", cosa->num, address); cosa->startaddr = address; cosa->firmware_status |= COSA_FW_START; return 0; @@ -1255,11 +1245,11 @@ static int cosa_start_tx(struct channel_data *chan, char *buf, int len) #ifdef DEBUG_DATA int i; - printk(KERN_INFO "cosa%dc%d: starting tx(0x%x)", chan->cosa->num, - chan->num, len); + pr_info("cosa%dc%d: starting tx(0x%x)", + chan->cosa->num, chan->num, len); for (i=0; i<len; i++) - printk(" %02x", buf[i]&0xff); - printk("\n"); + pr_cont(" %02x", buf[i]&0xff); + pr_cont("\n"); #endif spin_lock_irqsave(&cosa->lock, flags); chan->txbuf = buf; @@ -1353,7 +1343,7 @@ static void cosa_kick(struct cosa_data *cosa) if (test_bit(TXBIT, &cosa->rxtx)) s = "TX DMA"; - printk(KERN_INFO "%s: %s timeout - restarting.\n", cosa->name, s); + pr_info("%s: %s timeout - restarting\n", cosa->name, s); spin_lock_irqsave(&cosa->lock, flags); cosa->rxtx = 0; @@ -1387,7 +1377,7 @@ static int cosa_dma_able(struct channel_data *chan, char *buf, int len) return 0; if ((b^ (b+len)) & 0x10000) { if (count++ < 5) - printk(KERN_INFO "%s: packet spanning a 64k boundary\n", + pr_info("%s: packet spanning a 64k boundary\n", chan->name); return 0; } @@ -1498,8 +1488,7 @@ static int readmem(struct cosa_data *cosa, char __user *microcode, int length, i char c; int i; if ((i=get_wait_data(cosa)) == -1) { - printk (KERN_INFO "cosa: 0x%04x bytes remaining\n", - length); + pr_info("0x%04x bytes remaining\n", length); return -11; } c=i; @@ -1582,14 +1571,15 @@ static int get_wait_data(struct cosa_data *cosa) short r; r = cosa_getdata8(cosa); #if 0 - printk(KERN_INFO "cosa: get_wait_data returning after %d retries\n", 999-retries); + pr_info("get_wait_data returning after %d retries\n", + 999-retries); #endif return r; } /* sleep if not ready to read */ schedule_timeout_interruptible(1); } - printk(KERN_INFO "cosa: timeout in get_wait_data (status 0x%x)\n", + pr_info("timeout in get_wait_data (status 0x%x)\n", cosa_getstatus(cosa)); return -1; } @@ -1607,7 +1597,7 @@ static int put_wait_data(struct cosa_data *cosa, int data) if (cosa_getstatus(cosa) & SR_TX_RDY) { cosa_putdata8(cosa, data); #if 0 - printk(KERN_INFO "Putdata: %d retries\n", 999-retries); + pr_info("Putdata: %d retries\n", 999-retries); #endif return 0; } @@ -1616,7 +1606,7 @@ static int put_wait_data(struct cosa_data *cosa, int data) schedule_timeout_interruptible(1); #endif } - printk(KERN_INFO "cosa%d: timeout in put_wait_data (status 0x%x)\n", + pr_info("cosa%d: timeout in put_wait_data (status 0x%x)\n", cosa->num, cosa_getstatus(cosa)); return -1; } @@ -1636,13 +1626,13 @@ static int puthexnumber(struct cosa_data *cosa, int number) sprintf(temp, "%04X", number); for (i=0; i<4; i++) { if (put_wait_data(cosa, temp[i]) == -1) { - printk(KERN_NOTICE "cosa%d: puthexnumber failed to write byte %d\n", - cosa->num, i); + pr_notice("cosa%d: puthexnumber failed to write byte %d\n", + cosa->num, i); return -1-2*i; } if (get_wait_data(cosa) != temp[i]) { - printk(KERN_NOTICE "cosa%d: puthexhumber failed to read echo of byte %d\n", - cosa->num, i); + pr_notice("cosa%d: puthexhumber failed to read echo of byte %d\n", + cosa->num, i); return -2-2*i; } } @@ -1687,8 +1677,7 @@ static inline void tx_interrupt(struct cosa_data *cosa, int status) { unsigned long flags, flags1; #ifdef DEBUG_IRQS - printk(KERN_INFO "cosa%d: SR_DOWN_REQUEST status=0x%04x\n", - cosa->num, status); + pr_info("cosa%d: SR_DOWN_REQUEST status=0x%04x\n", cosa->num, status); #endif spin_lock_irqsave(&cosa->lock, flags); set_bit(TXBIT, &cosa->rxtx); @@ -1696,8 +1685,7 @@ static inline void tx_interrupt(struct cosa_data *cosa, int status) /* flow control, see the comment above */ int i=0; if (!cosa->txbitmap) { - printk(KERN_WARNING "%s: No channel wants data " - "in TX IRQ. Expect DMA timeout.", + pr_warn("%s: No channel wants data in TX IRQ. Expect DMA timeout.\n", cosa->name); put_driver_status_nolock(cosa); clear_bit(TXBIT, &cosa->rxtx); @@ -1780,14 +1768,14 @@ static inline void tx_interrupt(struct cosa_data *cosa, int status) if (cosa->busmaster) { unsigned long addr = virt_to_bus(cosa->txbuf); int count=0; - printk(KERN_INFO "busmaster IRQ\n"); + pr_info("busmaster IRQ\n"); while (!(cosa_getstatus(cosa)&SR_TX_RDY)) { count++; udelay(10); if (count > 1000) break; } - printk(KERN_INFO "status %x\n", cosa_getstatus(cosa)); - printk(KERN_INFO "ready after %d loops\n", count); + pr_info("status %x\n", cosa_getstatus(cosa)); + pr_info("ready after %d loops\n", count); cosa_putdata16(cosa, (addr >> 16)&0xffff); count = 0; @@ -1796,7 +1784,7 @@ static inline void tx_interrupt(struct cosa_data *cosa, int status) if (count > 1000) break; udelay(10); } - printk(KERN_INFO "ready after %d loops\n", count); + pr_info("ready after %d loops\n", count); cosa_putdata16(cosa, addr &0xffff); flags1 = claim_dma_lock(); set_dma_mode(cosa->dma, DMA_MODE_CASCADE); @@ -1824,7 +1812,7 @@ static inline void rx_interrupt(struct cosa_data *cosa, int status) { unsigned long flags; #ifdef DEBUG_IRQS - printk(KERN_INFO "cosa%d: SR_UP_REQUEST\n", cosa->num); + pr_info("cosa%d: SR_UP_REQUEST\n", cosa->num); #endif spin_lock_irqsave(&cosa->lock, flags); @@ -1847,7 +1835,7 @@ static inline void rx_interrupt(struct cosa_data *cosa, int status) debug_data_in(cosa, cosa->rxsize & 0xff); #endif #if 0 - printk(KERN_INFO "cosa%d: receive rxsize = (0x%04x).\n", + pr_info("cosa%d: receive rxsize = (0x%04x)\n", cosa->num, cosa->rxsize); #endif } @@ -1857,12 +1845,12 @@ static inline void rx_interrupt(struct cosa_data *cosa, int status) debug_data_in(cosa, cosa->rxsize); #endif #if 0 - printk(KERN_INFO "cosa%d: receive rxsize = (0x%04x).\n", + pr_info("cosa%d: receive rxsize = (0x%04x)\n", cosa->num, cosa->rxsize); #endif } if (((cosa->rxsize & 0xe000) >> 13) >= cosa->nchannels) { - printk(KERN_WARNING "%s: rx for unknown channel (0x%04x)\n", + pr_warn("%s: rx for unknown channel (0x%04x)\n", cosa->name, cosa->rxsize); spin_unlock_irqrestore(&cosa->lock, flags); goto reject; @@ -1877,7 +1865,7 @@ static inline void rx_interrupt(struct cosa_data *cosa, int status) if (!cosa->rxbuf) { reject: /* Reject the packet */ - printk(KERN_INFO "cosa%d: rejecting packet on channel %d\n", + pr_info("cosa%d: rejecting packet on channel %d\n", cosa->num, cosa->rxchan->num); cosa->rxbuf = cosa->bouncebuf; } @@ -1924,11 +1912,11 @@ static inline void eot_interrupt(struct cosa_data *cosa, int status) #ifdef DEBUG_DATA { int i; - printk(KERN_INFO "cosa%dc%d: done rx(0x%x)", cosa->num, - cosa->rxchan->num, cosa->rxsize); + pr_info("cosa%dc%d: done rx(0x%x)", + cosa->num, cosa->rxchan->num, cosa->rxsize); for (i=0; i<cosa->rxsize; i++) - printk (" %02x", cosa->rxbuf[i]&0xff); - printk("\n"); + pr_cont(" %02x", cosa->rxbuf[i]&0xff); + pr_cont("\n"); } #endif /* Packet for unknown channel? */ @@ -1940,8 +1928,7 @@ static inline void eot_interrupt(struct cosa_data *cosa, int status) if (cosa->rxchan->rx_done(cosa->rxchan)) clear_bit(cosa->rxchan->num, &cosa->rxbitmap); } else { - printk(KERN_NOTICE "cosa%d: unexpected EOT interrupt\n", - cosa->num); + pr_notice("cosa%d: unexpected EOT interrupt\n", cosa->num); } /* * Clear the RXBIT, TXBIT and IRQBIT (the latest should be @@ -1963,8 +1950,7 @@ static irqreturn_t cosa_interrupt(int irq, void *cosa_) again: status = cosa_getstatus(cosa); #ifdef DEBUG_IRQS - printk(KERN_INFO "cosa%d: got IRQ, status 0x%02x\n", cosa->num, - status & 0xff); + pr_info("cosa%d: got IRQ, status 0x%02x\n", cosa->num, status & 0xff); #endif #ifdef DEBUG_IO debug_status_in(cosa, status); @@ -1985,15 +1971,15 @@ again: udelay(100); goto again; } - printk(KERN_INFO "cosa%d: unknown status 0x%02x in IRQ after %d retries\n", + pr_info("cosa%d: unknown status 0x%02x in IRQ after %d retries\n", cosa->num, status & 0xff, count); } #ifdef DEBUG_IRQS if (count) - printk(KERN_INFO "%s: %d-times got unknown status in IRQ\n", + pr_info("%s: %d-times got unknown status in IRQ\n", cosa->name, count); else - printk(KERN_INFO "%s: returning from IRQ\n", cosa->name); + pr_info("%s: returning from IRQ\n", cosa->name); #endif return IRQ_HANDLED; } @@ -2024,41 +2010,41 @@ static void debug_status_in(struct cosa_data *cosa, int status) s = "NO_REQ"; break; } - printk(KERN_INFO "%s: IO: status -> 0x%02x (%s%s%s%s)\n", + pr_info("%s: IO: status -> 0x%02x (%s%s%s%s)\n", cosa->name, status, - status & SR_USR_RQ ? "USR_RQ|":"", - status & SR_TX_RDY ? "TX_RDY|":"", - status & SR_RX_RDY ? "RX_RDY|":"", + status & SR_USR_RQ ? "USR_RQ|" : "", + status & SR_TX_RDY ? "TX_RDY|" : "", + status & SR_RX_RDY ? "RX_RDY|" : "", s); } static void debug_status_out(struct cosa_data *cosa, int status) { - printk(KERN_INFO "%s: IO: status <- 0x%02x (%s%s%s%s%s%s)\n", + pr_info("%s: IO: status <- 0x%02x (%s%s%s%s%s%s)\n", cosa->name, status, - status & SR_RX_DMA_ENA ? "RXDMA|":"!rxdma|", - status & SR_TX_DMA_ENA ? "TXDMA|":"!txdma|", - status & SR_RST ? "RESET|":"", - status & SR_USR_INT_ENA ? "USRINT|":"!usrint|", - status & SR_TX_INT_ENA ? "TXINT|":"!txint|", - status & SR_RX_INT_ENA ? "RXINT":"!rxint"); + status & SR_RX_DMA_ENA ? "RXDMA|" : "!rxdma|", + status & SR_TX_DMA_ENA ? "TXDMA|" : "!txdma|", + status & SR_RST ? "RESET|" : "", + status & SR_USR_INT_ENA ? "USRINT|" : "!usrint|", + status & SR_TX_INT_ENA ? "TXINT|" : "!txint|", + status & SR_RX_INT_ENA ? "RXINT" : "!rxint"); } static void debug_data_in(struct cosa_data *cosa, int data) { - printk(KERN_INFO "%s: IO: data -> 0x%04x\n", cosa->name, data); + pr_info("%s: IO: data -> 0x%04x\n", cosa->name, data); } static void debug_data_out(struct cosa_data *cosa, int data) { - printk(KERN_INFO "%s: IO: data <- 0x%04x\n", cosa->name, data); + pr_info("%s: IO: data <- 0x%04x\n", cosa->name, data); } static void debug_data_cmd(struct cosa_data *cosa, int data) { - printk(KERN_INFO "%s: IO: data <- 0x%04x (%s|%s)\n", + pr_info("%s: IO: data <- 0x%04x (%s|%s)\n", cosa->name, data, data & SR_RDY_RCV ? "RX_RDY" : "!rx_rdy", data & SR_RDY_SND ? "TX_RDY" : "!tx_rdy"); diff --git a/drivers/net/wan/cycx_drv.c b/drivers/net/wan/cycx_drv.c index 164c3624ba8..2a3ecae67a9 100644 --- a/drivers/net/wan/cycx_drv.c +++ b/drivers/net/wan/cycx_drv.c @@ -48,6 +48,8 @@ * Aug 8, 1998 acme Initial version. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/init.h> /* __init */ #include <linux/module.h> #include <linux/kernel.h> /* printk(), and other useful stuff */ @@ -81,10 +83,9 @@ static u16 checksum(u8 *buf, u32 len); /* Global Data */ /* private data */ -static const char modname[] = "cycx_drv"; static const char fullname[] = "Cyclom 2X Support Module"; -static const char copyright[] = "(c) 1998-2003 Arnaldo Carvalho de Melo " - "<acme@conectiva.com.br>"; +static const char copyright[] = + "(c) 1998-2003 Arnaldo Carvalho de Melo <acme@conectiva.com.br>"; /* Hardware configuration options. * These are arrays of configuration options used by verification routines. @@ -110,8 +111,8 @@ static const long cycx_2x_irq_options[] = { 7, 3, 5, 9, 10, 11, 12, 15 }; static int __init cycx_drv_init(void) { - printk(KERN_INFO "%s v%u.%u %s\n", fullname, MOD_VERSION, MOD_RELEASE, - copyright); + pr_info("%s v%u.%u %s\n", + fullname, MOD_VERSION, MOD_RELEASE, copyright); return 0; } @@ -139,18 +140,16 @@ int cycx_setup(struct cycx_hw *hw, void *cfm, u32 len, unsigned long dpmbase) /* Verify IRQ configuration options */ if (!get_option_index(cycx_2x_irq_options, hw->irq)) { - printk(KERN_ERR "%s: IRQ %d is invalid!\n", modname, hw->irq); + pr_err("IRQ %d is invalid!\n", hw->irq); return -EINVAL; } /* Setup adapter dual-port memory window and test memory */ if (!dpmbase) { - printk(KERN_ERR "%s: you must specify the dpm address!\n", - modname); + pr_err("you must specify the dpm address!\n"); return -EINVAL; } else if (!get_option_index(cyc2x_dpmbase_options, dpmbase)) { - printk(KERN_ERR "%s: memory address 0x%lX is invalid!\n", - modname, dpmbase); + pr_err("memory address 0x%lX is invalid!\n", dpmbase); return -EINVAL; } @@ -158,13 +157,12 @@ int cycx_setup(struct cycx_hw *hw, void *cfm, u32 len, unsigned long dpmbase) hw->dpmsize = CYCX_WINDOWSIZE; if (!detect_cyc2x(hw->dpmbase)) { - printk(KERN_ERR "%s: adapter Cyclom 2X not found at " - "address 0x%lX!\n", modname, dpmbase); + pr_err("adapter Cyclom 2X not found at address 0x%lX!\n", + dpmbase); return -EINVAL; } - printk(KERN_INFO "%s: found Cyclom 2X card at address 0x%lX.\n", - modname, dpmbase); + pr_info("found Cyclom 2X card at address 0x%lX\n", dpmbase); /* Load firmware. If loader fails then shut down adapter */ err = load_cyc2x(hw, cfm, len); @@ -339,7 +337,7 @@ static int cycx_data_boot(void __iomem *addr, u8 *code, u32 len) for (i = 0 ; i < len ; i += CFM_LOAD_BUFSZ) if (buffer_load(addr, code + i, min_t(u32, CFM_LOAD_BUFSZ, (len - i))) < 0) { - printk(KERN_ERR "%s: Error !!\n", modname); + pr_err("Error !!\n"); return -1; } @@ -370,7 +368,7 @@ static int cycx_code_boot(void __iomem *addr, u8 *code, u32 len) for (i = 0 ; i < len ; i += CFM_LOAD_BUFSZ) if (buffer_load(addr, code + i, min_t(u32, CFM_LOAD_BUFSZ, (len - i)))) { - printk(KERN_ERR "%s: Error !!\n", modname); + pr_err("Error !!\n"); return -1; } @@ -391,23 +389,20 @@ static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len) u16 cksum; /* Announce */ - printk(KERN_INFO "%s: firmware signature=\"%s\"\n", modname, - cfm->signature); + pr_info("firmware signature=\"%s\"\n", cfm->signature); /* Verify firmware signature */ if (strcmp(cfm->signature, CFM_SIGNATURE)) { - printk(KERN_ERR "%s:load_cyc2x: not Cyclom-2X firmware!\n", - modname); + pr_err("load_cyc2x: not Cyclom-2X firmware!\n"); return -EINVAL; } - printk(KERN_INFO "%s: firmware version=%u\n", modname, cfm->version); + pr_info("firmware version=%u\n", cfm->version); /* Verify firmware module format version */ if (cfm->version != CFM_VERSION) { - printk(KERN_ERR "%s:%s: firmware format %u rejected! " - "Expecting %u.\n", - modname, __func__, cfm->version, CFM_VERSION); + pr_err("%s: firmware format %u rejected! Expecting %u.\n", + __func__, cfm->version, CFM_VERSION); return -EINVAL; } @@ -419,23 +414,22 @@ static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len) if (((len - sizeof(struct cycx_firmware) - 1) != cfm->info.codesize) || */ if (cksum != cfm->checksum) { - printk(KERN_ERR "%s:%s: firmware corrupted!\n", - modname, __func__); - printk(KERN_ERR " cdsize = 0x%x (expected 0x%lx)\n", - len - (int)sizeof(struct cycx_firmware) - 1, - cfm->info.codesize); - printk(KERN_ERR " chksum = 0x%x (expected 0x%x)\n", - cksum, cfm->checksum); + pr_err("%s: firmware corrupted!\n", __func__); + pr_err(" cdsize = 0x%x (expected 0x%lx)\n", + len - (int)sizeof(struct cycx_firmware) - 1, + cfm->info.codesize); + pr_err(" chksum = 0x%x (expected 0x%x)\n", + cksum, cfm->checksum); return -EINVAL; } /* If everything is ok, set reset, data and code pointers */ img_hdr = (struct cycx_fw_header *)&cfm->image; #ifdef FIRMWARE_DEBUG - printk(KERN_INFO "%s:%s: image sizes\n", __func__, modname); - printk(KERN_INFO " reset=%lu\n", img_hdr->reset_size); - printk(KERN_INFO " data=%lu\n", img_hdr->data_size); - printk(KERN_INFO " code=%lu\n", img_hdr->code_size); + pr_info("%s: image sizes\n", __func__); + pr_info(" reset=%lu\n", img_hdr->reset_size); + pr_info(" data=%lu\n", img_hdr->data_size); + pr_info(" code=%lu\n", img_hdr->code_size); #endif reset_image = ((u8 *)img_hdr) + sizeof(struct cycx_fw_header); data_image = reset_image + img_hdr->reset_size; @@ -443,15 +437,14 @@ static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len) /*---- Start load ----*/ /* Announce */ - printk(KERN_INFO "%s: loading firmware %s (ID=%u)...\n", modname, - cfm->descr[0] ? cfm->descr : "unknown firmware", - cfm->info.codeid); + pr_info("loading firmware %s (ID=%u)...\n", + cfm->descr[0] ? cfm->descr : "unknown firmware", + cfm->info.codeid); for (i = 0 ; i < 5 ; i++) { /* Reset Cyclom hardware */ if (!reset_cyc2x(hw->dpmbase)) { - printk(KERN_ERR "%s: dpm problem or board not found\n", - modname); + pr_err("dpm problem or board not found\n"); return -EINVAL; } @@ -468,19 +461,19 @@ static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len) msleep_interruptible(1 * 1000); } - printk(KERN_ERR "%s: reset not started.\n", modname); + pr_err("reset not started\n"); return -EINVAL; reset_loaded: /* Load data.bin */ if (cycx_data_boot(hw->dpmbase, data_image, img_hdr->data_size)) { - printk(KERN_ERR "%s: cannot load data file.\n", modname); + pr_err("cannot load data file\n"); return -EINVAL; } /* Load code.bin */ if (cycx_code_boot(hw->dpmbase, code_image, img_hdr->code_size)) { - printk(KERN_ERR "%s: cannot load code file.\n", modname); + pr_err("cannot load code file\n"); return -EINVAL; } @@ -493,7 +486,7 @@ reset_loaded: /* Arthur Ganzert's tip: wait a while after the firmware loading... seg abr 26 17:17:12 EST 1999 - acme */ msleep_interruptible(7 * 1000); - printk(KERN_INFO "%s: firmware loaded!\n", modname); + pr_info("firmware loaded!\n"); /* enable interrupts */ cycx_inten(hw); diff --git a/drivers/net/wan/cycx_main.c b/drivers/net/wan/cycx_main.c index 859dba9b972..81fbbad406b 100644 --- a/drivers/net/wan/cycx_main.c +++ b/drivers/net/wan/cycx_main.c @@ -40,6 +40,8 @@ * 1998/08/08 acme Initial version. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/stddef.h> /* offsetof(), etc. */ #include <linux/errno.h> /* return codes */ #include <linux/string.h> /* inline memset(), etc. */ @@ -50,6 +52,7 @@ #include <linux/wanrouter.h> /* WAN router definitions */ #include <linux/cyclomx.h> /* cyclomx common user API definitions */ #include <linux/init.h> /* __init (when not using as a module) */ +#include <linux/interrupt.h> unsigned int cycx_debug; @@ -106,7 +109,7 @@ static int __init cycx_init(void) { int cnt, err = -ENOMEM; - printk(KERN_INFO "%s v%u.%u %s\n", + pr_info("%s v%u.%u %s\n", cycx_fullname, CYCX_DRV_VERSION, CYCX_DRV_RELEASE, cycx_copyright); @@ -132,9 +135,8 @@ static int __init cycx_init(void) err = register_wan_device(wandev); if (err) { - printk(KERN_ERR "%s: %s registration failed with " - "error %d!\n", - cycx_drvname, card->devname, err); + pr_err("%s registration failed with error %d!\n", + card->devname, err); break; } } @@ -197,14 +199,13 @@ static int cycx_wan_setup(struct wan_device *wandev, wandev_conf_t *conf) rc = -EINVAL; if (!conf->data_size || !conf->data) { - printk(KERN_ERR "%s: firmware not found in configuration " - "data!\n", wandev->name); + pr_err("%s: firmware not found in configuration data!\n", + wandev->name); goto out; } if (conf->irq <= 0) { - printk(KERN_ERR "%s: can't configure without IRQ!\n", - wandev->name); + pr_err("%s: can't configure without IRQ!\n", wandev->name); goto out; } @@ -212,8 +213,7 @@ static int cycx_wan_setup(struct wan_device *wandev, wandev_conf_t *conf) irq = conf->irq == 2 ? 9 : conf->irq; /* IRQ2 -> IRQ9 */ if (request_irq(irq, cycx_isr, 0, wandev->name, card)) { - printk(KERN_ERR "%s: can't reserve IRQ %d!\n", - wandev->name, irq); + pr_err("%s: can't reserve IRQ %d!\n", wandev->name, irq); goto out; } @@ -245,8 +245,7 @@ static int cycx_wan_setup(struct wan_device *wandev, wandev_conf_t *conf) break; #endif default: - printk(KERN_ERR "%s: this firmware is not supported!\n", - wandev->name); + pr_err("%s: this firmware is not supported!\n", wandev->name); rc = -EINVAL; } @@ -287,8 +286,7 @@ static int cycx_wan_shutdown(struct wan_device *wandev) card = wandev->private; wandev->state = WAN_UNCONFIGURED; cycx_down(&card->hw); - printk(KERN_INFO "%s: irq %d being freed!\n", wandev->name, - wandev->irq); + pr_info("%s: irq %d being freed!\n", wandev->name, wandev->irq); free_irq(wandev->irq, card); out: return ret; } @@ -307,8 +305,8 @@ static irqreturn_t cycx_isr(int irq, void *dev_id) goto out; if (card->in_isr) { - printk(KERN_WARNING "%s: interrupt re-entrancy on IRQ %d!\n", - card->devname, card->wandev.irq); + pr_warn("%s: interrupt re-entrancy on IRQ %d!\n", + card->devname, card->wandev.irq); goto out; } @@ -336,7 +334,7 @@ void cycx_set_state(struct cycx_device *card, int state) string_state = "disconnected!"; break; } - printk(KERN_INFO "%s: link %s\n", card->devname, string_state); + pr_info("%s: link %s\n", card->devname, string_state); card->wandev.state = state; } diff --git a/drivers/net/wan/cycx_x25.c b/drivers/net/wan/cycx_x25.c index cf9e15fd8d9..06f3f6309e4 100644 --- a/drivers/net/wan/cycx_x25.c +++ b/drivers/net/wan/cycx_x25.c @@ -76,6 +76,8 @@ * 1998/08/08 acme Initial version. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #define CYCLOMX_X25_DEBUG 1 #include <linux/ctype.h> /* isdigit() */ @@ -230,8 +232,8 @@ int cycx_x25_wan_init(struct cycx_device *card, wandev_conf_t *conf) /* Verify configuration ID */ if (conf->config_id != WANCONFIG_X25) { - printk(KERN_INFO "%s: invalid configuration ID %u!\n", - card->devname, conf->config_id); + pr_info("%s: invalid configuration ID %u!\n", + card->devname, conf->config_id); return -EINVAL; } @@ -374,8 +376,7 @@ static int cycx_wan_new_if(struct wan_device *wandev, struct net_device *dev, int err = 0; if (!conf->name[0] || strlen(conf->name) > WAN_IFNAME_SZ) { - printk(KERN_INFO "%s: invalid interface name!\n", - card->devname); + pr_info("%s: invalid interface name!\n", card->devname); return -EINVAL; } @@ -398,8 +399,8 @@ static int cycx_wan_new_if(struct wan_device *wandev, struct net_device *dev, if (len) { if (len > WAN_ADDRESS_SZ) { - printk(KERN_ERR "%s: %s local addr too long!\n", - wandev->name, chan->name); + pr_err("%s: %s local addr too long!\n", + wandev->name, chan->name); err = -EINVAL; goto error; } else { @@ -429,15 +430,14 @@ static int cycx_wan_new_if(struct wan_device *wandev, struct net_device *dev, if (lcn >= card->u.x.lo_pvc && lcn <= card->u.x.hi_pvc) chan->lcn = lcn; else { - printk(KERN_ERR - "%s: PVC %u is out of range on interface %s!\n", - wandev->name, lcn, chan->name); + pr_err("%s: PVC %u is out of range on interface %s!\n", + wandev->name, lcn, chan->name); err = -EINVAL; goto error; } } else { - printk(KERN_ERR "%s: invalid media address on interface %s!\n", - wandev->name, chan->name); + pr_err("%s: invalid media address on interface %s!\n", + wandev->name, chan->name); err = -EINVAL; goto error; } @@ -607,9 +607,8 @@ static netdev_tx_t cycx_netdevice_hard_start_xmit(struct sk_buff *skb, ++chan->ifstats.tx_dropped; else if (chan->svc && chan->protocol && chan->protocol != ntohs(skb->protocol)) { - printk(KERN_INFO - "%s: unsupported Ethertype 0x%04X on interface %s!\n", - card->devname, ntohs(skb->protocol), dev->name); + pr_info("%s: unsupported Ethertype 0x%04X on interface %s!\n", + card->devname, ntohs(skb->protocol), dev->name); ++chan->ifstats.tx_errors; } else if (chan->protocol == ETH_P_IP) { switch (chan->state) { @@ -643,9 +642,8 @@ static netdev_tx_t cycx_netdevice_hard_start_xmit(struct sk_buff *skb, cycx_x25_chan_disconnect(dev); goto free_packet; default: - printk(KERN_INFO - "%s: unknown %d x25-iface request on %s!\n", - card->devname, skb->data[0], dev->name); + pr_info("%s: unknown %d x25-iface request on %s!\n", + card->devname, skb->data[0], dev->name); ++chan->ifstats.tx_errors; goto free_packet; } @@ -746,8 +744,7 @@ static void cycx_x25_irq_tx(struct cycx_device *card, struct cycx_x25_cmd *cmd) card->buff_int_mode_unbusy = 1; netif_wake_queue(dev); } else - printk(KERN_ERR "%s:ackvc for inexistent lcn %d\n", - card->devname, lcn); + pr_err("%s:ackvc for inexistent lcn %d\n", card->devname, lcn); } /* Receive interrupt handler. @@ -780,8 +777,8 @@ static void cycx_x25_irq_rx(struct cycx_device *card, struct cycx_x25_cmd *cmd) dev = cycx_x25_get_dev_by_lcn(wandev, lcn); if (!dev) { /* Invalid channel, discard packet */ - printk(KERN_INFO "%s: receiving on orphaned LCN %d!\n", - card->devname, lcn); + pr_info("%s: receiving on orphaned LCN %d!\n", + card->devname, lcn); return; } @@ -802,8 +799,8 @@ static void cycx_x25_irq_rx(struct cycx_device *card, struct cycx_x25_cmd *cmd) if ((skb = dev_alloc_skb((chan->protocol == ETH_P_X25 ? 1 : 0) + bufsize + dev->hard_header_len)) == NULL) { - printk(KERN_INFO "%s: no socket buffers available!\n", - card->devname); + pr_info("%s: no socket buffers available!\n", + card->devname); chan->drop_sequence = 1; ++chan->ifstats.rx_dropped; return; @@ -826,8 +823,8 @@ static void cycx_x25_irq_rx(struct cycx_device *card, struct cycx_x25_cmd *cmd) if (bitm) chan->drop_sequence = 1; - printk(KERN_INFO "%s: unexpectedly long packet sequence " - "on interface %s!\n", card->devname, dev->name); + pr_info("%s: unexpectedly long packet sequence on interface %s!\n", + card->devname, dev->name); ++chan->ifstats.rx_length_errors; return; } @@ -880,8 +877,8 @@ static void cycx_x25_irq_connect(struct cycx_device *card, dev = cycx_x25_get_dev_by_dte_addr(wandev, rem); if (!dev) { /* Invalid channel, discard packet */ - printk(KERN_INFO "%s: connect not expected: remote %s!\n", - card->devname, rem); + pr_info("%s: connect not expected: remote %s!\n", + card->devname, rem); return; } @@ -909,8 +906,8 @@ static void cycx_x25_irq_connect_confirm(struct cycx_device *card, if (!dev) { /* Invalid channel, discard packet */ clear_bit(--key, (void*)&card->u.x.connection_keys); - printk(KERN_INFO "%s: connect confirm not expected: lcn %d, " - "key=%d!\n", card->devname, lcn, key); + pr_info("%s: connect confirm not expected: lcn %d, key=%d!\n", + card->devname, lcn, key); return; } @@ -934,8 +931,8 @@ static void cycx_x25_irq_disconnect_confirm(struct cycx_device *card, dev = cycx_x25_get_dev_by_lcn(wandev, lcn); if (!dev) { /* Invalid channel, discard packet */ - printk(KERN_INFO "%s:disconnect confirm not expected!:lcn %d\n", - card->devname, lcn); + pr_info("%s:disconnect confirm not expected!:lcn %d\n", + card->devname, lcn); return; } @@ -980,13 +977,13 @@ static void cycx_x25_irq_log(struct cycx_device *card, struct cycx_x25_cmd *cmd) cycx_peek(&card->hw, cmd->buf + 10 + toread, &code, 1); cycx_peek(&card->hw, cmd->buf + 10 + toread + 1, &routine, 1); - printk(KERN_INFO "cycx_x25_irq_handler: X25_LOG (0x4500) indic.:\n"); - printk(KERN_INFO "cmd->buf=0x%X\n", cmd->buf); - printk(KERN_INFO "Log message code=0x%X\n", msg_code); - printk(KERN_INFO "Link=%d\n", link); - printk(KERN_INFO "log code=0x%X\n", code); - printk(KERN_INFO "log routine=0x%X\n", routine); - printk(KERN_INFO "Message size=%d\n", size); + pr_info("cycx_x25_irq_handler: X25_LOG (0x4500) indic.:\n"); + pr_info("cmd->buf=0x%X\n", cmd->buf); + pr_info("Log message code=0x%X\n", msg_code); + pr_info("Link=%d\n", link); + pr_info("log code=0x%X\n", code); + pr_info("log routine=0x%X\n", routine); + pr_info("Message size=%d\n", size); hex_dump("Message", bf, toread); #endif } @@ -1009,24 +1006,14 @@ static void cycx_x25_irq_stat(struct cycx_device *card, static void cycx_x25_irq_spurious(struct cycx_device *card, struct cycx_x25_cmd *cmd) { - printk(KERN_INFO "%s: spurious interrupt (0x%X)!\n", - card->devname, cmd->command); + pr_info("%s: spurious interrupt (0x%X)!\n", + card->devname, cmd->command); } #ifdef CYCLOMX_X25_DEBUG static void hex_dump(char *msg, unsigned char *p, int len) { - unsigned char hex[1024], - * phex = hex; - - if (len >= (sizeof(hex) / 2)) - len = (sizeof(hex) / 2) - 1; - - while (len--) { - sprintf(phex, "%02x", *p++); - phex += 2; - } - - printk(KERN_INFO "%s: %s\n", msg, hex); + print_hex_dump(KERN_INFO, msg, DUMP_PREFIX_OFFSET, 16, 1, + p, len, true); } #endif @@ -1203,8 +1190,8 @@ static int x25_place_call(struct cycx_device *card, u8 key; if (card->u.x.connection_keys == ~0U) { - printk(KERN_INFO "%s: too many simultaneous connection " - "requests!\n", card->devname); + pr_info("%s: too many simultaneous connection requests!\n", + card->devname); return -EAGAIN; } @@ -1381,8 +1368,8 @@ static void cycx_x25_chan_timer(unsigned long d) if (chan->state == WAN_CONNECTED) cycx_x25_chan_disconnect(dev); else - printk(KERN_ERR "%s: %s for svc (%s) not connected!\n", - chan->card->devname, __func__, dev->name); + pr_err("%s: %s for svc (%s) not connected!\n", + chan->card->devname, __func__, dev->name); } /* Set logical channel state. */ @@ -1433,8 +1420,8 @@ static void cycx_x25_set_chan_state(struct net_device *dev, u8 state) break; } - printk(KERN_INFO "%s: interface %s %s\n", card->devname, - dev->name, string_state); + pr_info("%s: interface %s %s\n", + card->devname, dev->name, string_state); chan->state = state; } @@ -1488,7 +1475,7 @@ static void cycx_x25_chan_send_event(struct net_device *dev, u8 event) unsigned char *ptr; if ((skb = dev_alloc_skb(1)) == NULL) { - printk(KERN_ERR "%s: out of memory\n", __func__); + pr_err("%s: out of memory\n", __func__); return; } @@ -1557,56 +1544,56 @@ static void reset_timer(struct net_device *dev) #ifdef CYCLOMX_X25_DEBUG static void cycx_x25_dump_config(struct cycx_x25_config *conf) { - printk(KERN_INFO "X.25 configuration\n"); - printk(KERN_INFO "-----------------\n"); - printk(KERN_INFO "link number=%d\n", conf->link); - printk(KERN_INFO "line speed=%d\n", conf->speed); - printk(KERN_INFO "clock=%sternal\n", conf->clock == 8 ? "Ex" : "In"); - printk(KERN_INFO "# level 2 retransm.=%d\n", conf->n2); - printk(KERN_INFO "level 2 window=%d\n", conf->n2win); - printk(KERN_INFO "level 3 window=%d\n", conf->n3win); - printk(KERN_INFO "# logical channels=%d\n", conf->nvc); - printk(KERN_INFO "level 3 pkt len=%d\n", conf->pktlen); - printk(KERN_INFO "my address=%d\n", conf->locaddr); - printk(KERN_INFO "remote address=%d\n", conf->remaddr); - printk(KERN_INFO "t1=%d seconds\n", conf->t1); - printk(KERN_INFO "t2=%d seconds\n", conf->t2); - printk(KERN_INFO "t21=%d seconds\n", conf->t21); - printk(KERN_INFO "# PVCs=%d\n", conf->npvc); - printk(KERN_INFO "t23=%d seconds\n", conf->t23); - printk(KERN_INFO "flags=0x%x\n", conf->flags); + pr_info("X.25 configuration\n"); + pr_info("-----------------\n"); + pr_info("link number=%d\n", conf->link); + pr_info("line speed=%d\n", conf->speed); + pr_info("clock=%sternal\n", conf->clock == 8 ? "Ex" : "In"); + pr_info("# level 2 retransm.=%d\n", conf->n2); + pr_info("level 2 window=%d\n", conf->n2win); + pr_info("level 3 window=%d\n", conf->n3win); + pr_info("# logical channels=%d\n", conf->nvc); + pr_info("level 3 pkt len=%d\n", conf->pktlen); + pr_info("my address=%d\n", conf->locaddr); + pr_info("remote address=%d\n", conf->remaddr); + pr_info("t1=%d seconds\n", conf->t1); + pr_info("t2=%d seconds\n", conf->t2); + pr_info("t21=%d seconds\n", conf->t21); + pr_info("# PVCs=%d\n", conf->npvc); + pr_info("t23=%d seconds\n", conf->t23); + pr_info("flags=0x%x\n", conf->flags); } static void cycx_x25_dump_stats(struct cycx_x25_stats *stats) { - printk(KERN_INFO "X.25 statistics\n"); - printk(KERN_INFO "--------------\n"); - printk(KERN_INFO "rx_crc_errors=%d\n", stats->rx_crc_errors); - printk(KERN_INFO "rx_over_errors=%d\n", stats->rx_over_errors); - printk(KERN_INFO "n2_tx_frames=%d\n", stats->n2_tx_frames); - printk(KERN_INFO "n2_rx_frames=%d\n", stats->n2_rx_frames); - printk(KERN_INFO "tx_timeouts=%d\n", stats->tx_timeouts); - printk(KERN_INFO "rx_timeouts=%d\n", stats->rx_timeouts); - printk(KERN_INFO "n3_tx_packets=%d\n", stats->n3_tx_packets); - printk(KERN_INFO "n3_rx_packets=%d\n", stats->n3_rx_packets); - printk(KERN_INFO "tx_aborts=%d\n", stats->tx_aborts); - printk(KERN_INFO "rx_aborts=%d\n", stats->rx_aborts); + pr_info("X.25 statistics\n"); + pr_info("--------------\n"); + pr_info("rx_crc_errors=%d\n", stats->rx_crc_errors); + pr_info("rx_over_errors=%d\n", stats->rx_over_errors); + pr_info("n2_tx_frames=%d\n", stats->n2_tx_frames); + pr_info("n2_rx_frames=%d\n", stats->n2_rx_frames); + pr_info("tx_timeouts=%d\n", stats->tx_timeouts); + pr_info("rx_timeouts=%d\n", stats->rx_timeouts); + pr_info("n3_tx_packets=%d\n", stats->n3_tx_packets); + pr_info("n3_rx_packets=%d\n", stats->n3_rx_packets); + pr_info("tx_aborts=%d\n", stats->tx_aborts); + pr_info("rx_aborts=%d\n", stats->rx_aborts); } static void cycx_x25_dump_devs(struct wan_device *wandev) { struct net_device *dev = wandev->dev; - printk(KERN_INFO "X.25 dev states\n"); - printk(KERN_INFO "name: addr: txoff: protocol:\n"); - printk(KERN_INFO "---------------------------------------\n"); + pr_info("X.25 dev states\n"); + pr_info("name: addr: txoff: protocol:\n"); + pr_info("---------------------------------------\n"); while(dev) { struct cycx_x25_channel *chan = netdev_priv(dev); - printk(KERN_INFO "%-5.5s %-15.15s %d ETH_P_%s\n", - chan->name, chan->addr, netif_queue_stopped(dev), - chan->protocol == ETH_P_IP ? "IP" : "X25"); + pr_info("%-5.5s %-15.15s %d ETH_P_%s\n", + chan->name, chan->addr, netif_queue_stopped(dev), + chan->protocol == ETH_P_IP ? "IP" : "X25"); dev = chan->slave; } } diff --git a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c index 21b104db5a9..48ab38a34c5 100644 --- a/drivers/net/wan/dlci.c +++ b/drivers/net/wan/dlci.c @@ -28,6 +28,8 @@ * 2 of the License, or (at your option) any later version. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> @@ -112,8 +114,7 @@ static void dlci_receive(struct sk_buff *skb, struct net_device *dev) dlp = netdev_priv(dev); if (!pskb_may_pull(skb, sizeof(*hdr))) { - printk(KERN_NOTICE "%s: invalid data no header\n", - dev->name); + netdev_notice(dev, "invalid data no header\n"); dev->stats.rx_errors++; kfree_skb(skb); return; @@ -126,7 +127,8 @@ static void dlci_receive(struct sk_buff *skb, struct net_device *dev) if (hdr->control != FRAD_I_UI) { - printk(KERN_NOTICE "%s: Invalid header flag 0x%02X.\n", dev->name, hdr->control); + netdev_notice(dev, "Invalid header flag 0x%02X\n", + hdr->control); dev->stats.rx_errors++; } else @@ -135,14 +137,18 @@ static void dlci_receive(struct sk_buff *skb, struct net_device *dev) case FRAD_P_PADDING: if (hdr->NLPID != FRAD_P_SNAP) { - printk(KERN_NOTICE "%s: Unsupported NLPID 0x%02X.\n", dev->name, hdr->NLPID); + netdev_notice(dev, "Unsupported NLPID 0x%02X\n", + hdr->NLPID); dev->stats.rx_errors++; break; } if (hdr->OUI[0] + hdr->OUI[1] + hdr->OUI[2] != 0) { - printk(KERN_NOTICE "%s: Unsupported organizationally unique identifier 0x%02X-%02X-%02X.\n", dev->name, hdr->OUI[0], hdr->OUI[1], hdr->OUI[2]); + netdev_notice(dev, "Unsupported organizationally unique identifier 0x%02X-%02X-%02X\n", + hdr->OUI[0], + hdr->OUI[1], + hdr->OUI[2]); dev->stats.rx_errors++; break; } @@ -163,12 +169,14 @@ static void dlci_receive(struct sk_buff *skb, struct net_device *dev) case FRAD_P_SNAP: case FRAD_P_Q933: case FRAD_P_CLNP: - printk(KERN_NOTICE "%s: Unsupported NLPID 0x%02X.\n", dev->name, hdr->pad); + netdev_notice(dev, "Unsupported NLPID 0x%02X\n", + hdr->pad); dev->stats.rx_errors++; break; default: - printk(KERN_NOTICE "%s: Invalid pad byte 0x%02X.\n", dev->name, hdr->pad); + netdev_notice(dev, "Invalid pad byte 0x%02X\n", + hdr->pad); dev->stats.rx_errors++; break; } diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c index acb9ea83062..058e1697c17 100644 --- a/drivers/net/wan/dscc4.c +++ b/drivers/net/wan/dscc4.c @@ -80,6 +80,8 @@ * - misc crapectomy. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> #include <linux/sched.h> #include <linux/types.h> @@ -99,6 +101,7 @@ #include <asm/irq.h> #include <linux/init.h> +#include <linux/interrupt.h> #include <linux/string.h> #include <linux/if_arp.h> @@ -552,7 +555,7 @@ static int dscc4_wait_ack_cec(struct dscc4_dev_priv *dpriv, schedule_timeout_uninterruptible(10); rmb(); } while (++i > 0); - printk(KERN_ERR "%s: %s timeout\n", dev->name, msg); + netdev_err(dev, "%s timeout\n", msg); done: return (i >= 0) ? i : -EAGAIN; } @@ -568,18 +571,18 @@ static int dscc4_do_action(struct net_device *dev, char *msg) u32 state = readl(ioaddr); if (state & ArAck) { - printk(KERN_DEBUG "%s: %s ack\n", dev->name, msg); + netdev_dbg(dev, "%s ack\n", msg); writel(ArAck, ioaddr); goto done; } else if (state & Arf) { - printk(KERN_ERR "%s: %s failed\n", dev->name, msg); + netdev_err(dev, "%s failed\n", msg); writel(Arf, ioaddr); i = -1; goto done; } rmb(); } while (++i > 0); - printk(KERN_ERR "%s: %s timeout\n", dev->name, msg); + netdev_err(dev, "%s timeout\n", msg); done: return i; } @@ -635,7 +638,7 @@ static void dscc4_tx_reset(struct dscc4_dev_priv *dpriv, struct net_device *dev) writel(MTFi|Rdt, dpriv->base_addr + dpriv->dev_id*0x0c + CH0CFG); if (dscc4_do_action(dev, "Rdt") < 0) - printk(KERN_ERR "%s: Tx reset failed\n", dev->name); + netdev_err(dev, "Tx reset failed\n"); } #endif @@ -721,22 +724,20 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev, rc = pci_request_region(pdev, 0, "registers"); if (rc < 0) { - printk(KERN_ERR "%s: can't reserve MMIO region (regs)\n", - DRV_NAME); + pr_err("can't reserve MMIO region (regs)\n"); goto err_disable_0; } rc = pci_request_region(pdev, 1, "LBI interface"); if (rc < 0) { - printk(KERN_ERR "%s: can't reserve MMIO region (lbi)\n", - DRV_NAME); + pr_err("can't reserve MMIO region (lbi)\n"); goto err_free_mmio_region_1; } ioaddr = pci_ioremap_bar(pdev, 0); if (!ioaddr) { - printk(KERN_ERR "%s: cannot remap MMIO region %llx @ %llx\n", - DRV_NAME, (unsigned long long)pci_resource_len(pdev, 0), - (unsigned long long)pci_resource_start(pdev, 0)); + pr_err("cannot remap MMIO region %llx @ %llx\n", + (unsigned long long)pci_resource_len(pdev, 0), + (unsigned long long)pci_resource_start(pdev, 0)); rc = -EIO; goto err_free_mmio_regions_2; } @@ -756,7 +757,7 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev, rc = request_irq(pdev->irq, dscc4_irq, IRQF_SHARED, DRV_NAME, priv->root); if (rc < 0) { - printk(KERN_WARNING "%s: IRQ %d busy\n", DRV_NAME, pdev->irq); + pr_warn("IRQ %d busy\n", pdev->irq); goto err_release_4; } @@ -903,7 +904,7 @@ static int dscc4_found1(struct pci_dev *pdev, void __iomem *ioaddr) root = kcalloc(dev_per_card, sizeof(*root), GFP_KERNEL); if (!root) { - printk(KERN_ERR "%s: can't allocate data\n", DRV_NAME); + pr_err("can't allocate data\n"); goto err_out; } @@ -915,7 +916,7 @@ static int dscc4_found1(struct pci_dev *pdev, void __iomem *ioaddr) ppriv = kzalloc(sizeof(*ppriv), GFP_KERNEL); if (!ppriv) { - printk(KERN_ERR "%s: can't allocate private data\n", DRV_NAME); + pr_err("can't allocate private data\n"); goto err_free_dev; } @@ -951,7 +952,7 @@ static int dscc4_found1(struct pci_dev *pdev, void __iomem *ioaddr) ret = register_hdlc_device(d); if (ret < 0) { - printk(KERN_ERR "%s: unable to register\n", DRV_NAME); + pr_err("unable to register\n"); dscc4_release_ring(dpriv); goto err_unregister; } @@ -1004,7 +1005,7 @@ static int dscc4_loopback_check(struct dscc4_dev_priv *dpriv) if (settings->loopback && (settings->clock_type != CLOCK_INT)) { struct net_device *dev = dscc4_to_dev(dpriv); - printk(KERN_INFO "%s: loopback requires clock\n", dev->name); + netdev_info(dev, "loopback requires clock\n"); return -1; } return 0; @@ -1077,7 +1078,7 @@ static int dscc4_open(struct net_device *dev) scc_patchl(0, PowerUp, dpriv, dev, CCR0); scc_patchl(0, 0x00050000, dpriv, dev, CCR2); scc_writel(EventsMask, dpriv, dev, IMR); - printk(KERN_INFO "%s: up again.\n", dev->name); + netdev_info(dev, "up again\n"); goto done; } @@ -1094,11 +1095,11 @@ static int dscc4_open(struct net_device *dev) * situations. */ if (scc_readl_star(dpriv, dev) & SccBusy) { - printk(KERN_ERR "%s busy. Try later\n", dev->name); + netdev_err(dev, "busy - try later\n"); ret = -EAGAIN; goto err_out; } else - printk(KERN_INFO "%s: available. Good\n", dev->name); + netdev_info(dev, "available - good\n"); scc_writel(EventsMask, dpriv, dev, IMR); @@ -1116,7 +1117,7 @@ static int dscc4_open(struct net_device *dev) * reset is needed. Suggestions anyone ? */ if ((ret = dscc4_xpr_ack(dpriv)) < 0) { - printk(KERN_ERR "%s: %s timeout\n", DRV_NAME, "XPR"); + pr_err("XPR timeout\n"); goto err_disable_scc_events; } @@ -1341,8 +1342,7 @@ static int dscc4_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) return -EPERM; if (dpriv->flags & FakeReset) { - printk(KERN_INFO "%s: please reset the device" - " before this command\n", dev->name); + netdev_info(dev, "please reset the device before this command\n"); return -EPERM; } if (copy_from_user(&dpriv->settings, line, size)) @@ -1505,8 +1505,7 @@ static irqreturn_t dscc4_irq(int irq, void *token) writel(state, ioaddr + GSTAR); if (state & Arf) { - printk(KERN_ERR "%s: failure (Arf). Harass the maintener\n", - dev->name); + netdev_err(dev, "failure (Arf). Harass the maintainer\n"); goto out; } state &= ~ArAck; @@ -1514,7 +1513,7 @@ static irqreturn_t dscc4_irq(int irq, void *token) if (debug > 0) printk(KERN_DEBUG "%s: CfgIV\n", DRV_NAME); if (priv->iqcfg[priv->cfg_cur++%IRQ_RING_SIZE] & cpu_to_le32(Arf)) - printk(KERN_ERR "%s: %s failed\n", dev->name, "CFG"); + netdev_err(dev, "CFG failed\n"); if (!(state &= ~Cfg)) goto out; } @@ -1595,8 +1594,8 @@ try: ++dpriv->tx_dirty; } else { if (debug > 1) - printk(KERN_ERR "%s Tx: NULL skb %d\n", - dev->name, cur); + netdev_err(dev, "Tx: NULL skb %d\n", + cur); } /* * If the driver ends sending crap on the wire, it @@ -1615,7 +1614,7 @@ try: * Transmit Data Underrun */ if (state & Xdu) { - printk(KERN_ERR "%s: XDU. Ask maintainer\n", DRV_NAME); + netdev_err(dev, "Tx Data Underrun. Ask maintainer\n"); dpriv->flags = NeedIDT; /* Tx reset */ writel(MTFi | Rdt, @@ -1624,13 +1623,13 @@ try: return; } if (state & Cts) { - printk(KERN_INFO "%s: CTS transition\n", dev->name); + netdev_info(dev, "CTS transition\n"); if (!(state &= ~Cts)) /* DEBUG */ goto try; } if (state & Xmr) { /* Frame needs to be sent again - FIXME */ - printk(KERN_ERR "%s: Xmr. Ask maintainer\n", DRV_NAME); + netdev_err(dev, "Tx ReTx. Ask maintainer\n"); if (!(state &= ~Xmr)) /* DEBUG */ goto try; } @@ -1648,7 +1647,7 @@ try: break; } if (!i) - printk(KERN_INFO "%s busy in irq\n", dev->name); + netdev_info(dev, "busy in irq\n"); scc_addr = dpriv->base_addr + 0x0c*dpriv->dev_id; /* Keep this order: IDT before IDR */ @@ -1685,7 +1684,7 @@ try: } if (state & Cd) { if (debug > 0) - printk(KERN_INFO "%s: CD transition\n", dev->name); + netdev_info(dev, "CD transition\n"); if (!(state &= ~Cd)) /* DEBUG */ goto try; } @@ -1694,11 +1693,11 @@ try: #ifdef DSCC4_POLLING while (!dscc4_tx_poll(dpriv, dev)); #endif - printk(KERN_INFO "%s: Tx Hi\n", dev->name); + netdev_info(dev, "Tx Hi\n"); state &= ~Hi; } if (state & Err) { - printk(KERN_INFO "%s: Tx ERR\n", dev->name); + netdev_info(dev, "Tx ERR\n"); dev->stats.tx_errors++; state &= ~Err; } @@ -1768,7 +1767,7 @@ try: goto try; } if (state & Hi ) { /* HI bit */ - printk(KERN_INFO "%s: Rx Hi\n", dev->name); + netdev_info(dev, "Rx Hi\n"); state &= ~Hi; goto try; } @@ -1799,7 +1798,7 @@ try: goto try; } if (state & Cts) { - printk(KERN_INFO "%s: CTS transition\n", dev->name); + netdev_info(dev, "CTS transition\n"); if (!(state &= ~Cts)) /* DEBUG */ goto try; } @@ -1858,14 +1857,12 @@ try: sizeof(struct RxFD), scc_addr + CH0BRDA); writel(MTFi|Rdr|Idr, scc_addr + CH0CFG); if (dscc4_do_action(dev, "RDR") < 0) { - printk(KERN_ERR "%s: RDO recovery failed(%s)\n", - dev->name, "RDR"); + netdev_err(dev, "RDO recovery failed(RDR)\n"); goto rdo_end; } writel(MTFi|Idr, scc_addr + CH0CFG); if (dscc4_do_action(dev, "IDR") < 0) { - printk(KERN_ERR "%s: RDO recovery failed(%s)\n", - dev->name, "IDR"); + netdev_err(dev, "RDO recovery failed(IDR)\n"); goto rdo_end; } rdo_end: @@ -1874,7 +1871,7 @@ try: goto try; } if (state & Cd) { - printk(KERN_INFO "%s: CD transition\n", dev->name); + netdev_info(dev, "CD transition\n"); if (!(state &= ~Cd)) /* DEBUG */ goto try; } diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index 777d1a4e81b..ebb9f24eefb 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c @@ -25,6 +25,7 @@ #include <linux/slab.h> #include <linux/ioport.h> #include <linux/init.h> +#include <linux/interrupt.h> #include <linux/if.h> #include <linux/hdlc.h> #include <asm/io.h> @@ -1664,10 +1665,9 @@ check_started_ok(struct fst_card_info *card) * existing firmware etc so we just report it for the moment. */ if (FST_RDL(card, numberOfPorts) != card->nports) { - pr_warning("Port count mismatch on card %d. " - "Firmware thinks %d we say %d\n", - card->card_no, - FST_RDL(card, numberOfPorts), card->nports); + pr_warn("Port count mismatch on card %d. Firmware thinks %d we say %d\n", + card->card_no, + FST_RDL(card, numberOfPorts), card->nports); } } diff --git a/drivers/net/wan/hd64570.c b/drivers/net/wan/hd64570.c index a3ea27ce04f..33b67d88fce 100644 --- a/drivers/net/wan/hd64570.c +++ b/drivers/net/wan/hd64570.c @@ -582,8 +582,8 @@ static void sca_dump_rings(struct net_device *dev) sca_in(DSR_RX(phy_node(port)), card), port->rxin, sca_in(DSR_RX(phy_node(port)), card) & DSR_DE ? "" : "in"); for (cnt = 0; cnt < port_to_card(port)->rx_ring_buffers; cnt++) - printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat))); - printk(KERN_CONT "\n"); + pr_cont(" %02X", readb(&(desc_address(port, cnt, 0)->stat))); + pr_cont("\n"); printk(KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u " "last=%u %sactive", @@ -593,8 +593,8 @@ static void sca_dump_rings(struct net_device *dev) sca_in(DSR_TX(phy_node(port)), card) & DSR_DE ? "" : "in"); for (cnt = 0; cnt < port_to_card(port)->tx_ring_buffers; cnt++) - printk(" %02X", readb(&(desc_address(port, cnt, 1)->stat))); - printk("\n"); + pr_cont(" %02X", readb(&(desc_address(port, cnt, 1)->stat))); + pr_cont("\n"); printk(KERN_DEBUG "MSCI: MD: %02x %02x %02x, ST: %02x %02x %02x %02x," " FST: %02x CST: %02x %02x\n", diff --git a/drivers/net/wan/hd64572.c b/drivers/net/wan/hd64572.c index e305274f83f..efc0db10118 100644 --- a/drivers/net/wan/hd64572.c +++ b/drivers/net/wan/hd64572.c @@ -530,8 +530,8 @@ static void sca_dump_rings(struct net_device *dev) sca_in(DSR_RX(port->chan), card), port->rxin, sca_in(DSR_RX(port->chan), card) & DSR_DE ? "" : "in"); for (cnt = 0; cnt < port->card->rx_ring_buffers; cnt++) - printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat))); - printk(KERN_CONT "\n"); + pr_cont(" %02X", readb(&(desc_address(port, cnt, 0)->stat))); + pr_cont("\n"); printk(KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u " "last=%u %sactive", @@ -541,8 +541,8 @@ static void sca_dump_rings(struct net_device *dev) sca_in(DSR_TX(port->chan), card) & DSR_DE ? "" : "in"); for (cnt = 0; cnt < port->card->tx_ring_buffers; cnt++) - printk(" %02X", readb(&(desc_address(port, cnt, 1)->stat))); - printk("\n"); + pr_cont(" %02X", readb(&(desc_address(port, cnt, 1)->stat))); + pr_cont("\n"); printk(KERN_DEBUG "MSCI: MD: %02x %02x %02x," " ST: %02x %02x %02x %02x %02x, FST: %02x CST: %02x %02x\n", diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c index 5d4bb615ccc..10cc7df9549 100644 --- a/drivers/net/wan/hdlc.c +++ b/drivers/net/wan/hdlc.c @@ -22,6 +22,8 @@ * - proto->start() and stop() are called with spin_lock_irq held. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/errno.h> #include <linux/hdlc.h> #include <linux/if_arp.h> @@ -130,10 +132,10 @@ static int hdlc_device_event(struct notifier_block *this, unsigned long event, goto carrier_exit; if (hdlc->carrier) { - printk(KERN_INFO "%s: Carrier detected\n", dev->name); + netdev_info(dev, "Carrier detected\n"); hdlc_proto_start(dev); } else { - printk(KERN_INFO "%s: Carrier lost\n", dev->name); + netdev_info(dev, "Carrier lost\n"); hdlc_proto_stop(dev); } @@ -165,10 +167,10 @@ int hdlc_open(struct net_device *dev) spin_lock_irq(&hdlc->state_lock); if (hdlc->carrier) { - printk(KERN_INFO "%s: Carrier detected\n", dev->name); + netdev_info(dev, "Carrier detected\n"); hdlc_proto_start(dev); } else - printk(KERN_INFO "%s: No carrier\n", dev->name); + netdev_info(dev, "No carrier\n"); hdlc->open = 1; @@ -281,8 +283,8 @@ int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto, if (size) if ((dev_to_hdlc(dev)->state = kmalloc(size, GFP_KERNEL)) == NULL) { - printk(KERN_WARNING "Memory squeeze on" - " hdlc_proto_attach()\n"); + netdev_warn(dev, + "Memory squeeze on hdlc_proto_attach()\n"); module_put(proto->module); return -ENOBUFS; } @@ -363,7 +365,7 @@ static int __init hdlc_module_init(void) { int result; - printk(KERN_INFO "%s\n", version); + pr_info("%s\n", version); if ((result = register_netdevice_notifier(&hdlc_notifier)) != 0) return result; dev_add_pack(&hdlc_packet_type); diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c index b1e5e5b69c2..3f20808b5ff 100644 --- a/drivers/net/wan/hdlc_cisco.c +++ b/drivers/net/wan/hdlc_cisco.c @@ -103,9 +103,7 @@ static void cisco_keepalive_send(struct net_device *dev, u32 type, skb = dev_alloc_skb(sizeof(struct hdlc_header) + sizeof(struct cisco_packet)); if (!skb) { - printk(KERN_WARNING - "%s: Memory squeeze on cisco_keepalive_send()\n", - dev->name); + netdev_warn(dev, "Memory squeeze on cisco_keepalive_send()\n"); return; } skb_reserve(skb, 4); @@ -181,8 +179,8 @@ static int cisco_rx(struct sk_buff *skb) CISCO_PACKET_LEN) && (skb->len != sizeof(struct hdlc_header) + CISCO_BIG_PACKET_LEN)) { - printk(KERN_INFO "%s: Invalid length of Cisco control" - " packet (%d bytes)\n", dev->name, skb->len); + netdev_info(dev, "Invalid length of Cisco control packet (%d bytes)\n", + skb->len); goto rx_error; } @@ -217,8 +215,7 @@ static int cisco_rx(struct sk_buff *skb) return NET_RX_SUCCESS; case CISCO_ADDR_REPLY: - printk(KERN_INFO "%s: Unexpected Cisco IP address " - "reply\n", dev->name); + netdev_info(dev, "Unexpected Cisco IP address reply\n"); goto rx_error; case CISCO_KEEPALIVE_REQ: @@ -235,9 +232,8 @@ static int cisco_rx(struct sk_buff *skb) min = sec / 60; sec -= min * 60; hrs = min / 60; min -= hrs * 60; days = hrs / 24; hrs -= days * 24; - printk(KERN_INFO "%s: Link up (peer " - "uptime %ud%uh%um%us)\n", - dev->name, days, hrs, min, sec); + netdev_info(dev, "Link up (peer uptime %ud%uh%um%us)\n", + days, hrs, min, sec); netif_dormant_off(dev); st->up = 1; } @@ -249,8 +245,7 @@ static int cisco_rx(struct sk_buff *skb) } /* switch (keepalive type) */ } /* switch (protocol) */ - printk(KERN_INFO "%s: Unsupported protocol %x\n", dev->name, - ntohs(data->protocol)); + netdev_info(dev, "Unsupported protocol %x\n", ntohs(data->protocol)); dev_kfree_skb_any(skb); return NET_RX_DROP; @@ -272,7 +267,7 @@ static void cisco_timer(unsigned long arg) if (st->up && time_after(jiffies, st->last_poll + st->settings.timeout * HZ)) { st->up = 0; - printk(KERN_INFO "%s: Link down\n", dev->name); + netdev_info(dev, "Link down\n"); netif_dormant_on(dev); } diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c index fc433f28c04..b25c9229a6a 100644 --- a/drivers/net/wan/hdlc_fr.c +++ b/drivers/net/wan/hdlc_fr.c @@ -446,15 +446,14 @@ static netdev_tx_t pvc_xmit(struct sk_buff *skb, struct net_device *dev) static inline void fr_log_dlci_active(pvc_device *pvc) { - printk(KERN_INFO "%s: DLCI %d [%s%s%s]%s %s\n", - pvc->frad->name, - pvc->dlci, - pvc->main ? pvc->main->name : "", - pvc->main && pvc->ether ? " " : "", - pvc->ether ? pvc->ether->name : "", - pvc->state.new ? " new" : "", - !pvc->state.exist ? "deleted" : - pvc->state.active ? "active" : "inactive"); + netdev_info(pvc->frad, "DLCI %d [%s%s%s]%s %s\n", + pvc->dlci, + pvc->main ? pvc->main->name : "", + pvc->main && pvc->ether ? " " : "", + pvc->ether ? pvc->ether->name : "", + pvc->state.new ? " new" : "", + !pvc->state.exist ? "deleted" : + pvc->state.active ? "active" : "inactive"); } @@ -481,16 +480,14 @@ static void fr_lmi_send(struct net_device *dev, int fullrep) if (dce && fullrep) { len += state(hdlc)->dce_pvc_count * (2 + stat_len); if (len > HDLC_MAX_MRU) { - printk(KERN_WARNING "%s: Too many PVCs while sending " - "LMI full report\n", dev->name); + netdev_warn(dev, "Too many PVCs while sending LMI full report\n"); return; } } skb = dev_alloc_skb(len); if (!skb) { - printk(KERN_WARNING "%s: Memory squeeze on fr_lmi_send()\n", - dev->name); + netdev_warn(dev, "Memory squeeze on fr_lmi_send()\n"); return; } memset(skb->data, 0, len); @@ -615,8 +612,7 @@ static void fr_timer(unsigned long arg) state(hdlc)->last_errors <<= 1; /* Shift the list */ if (state(hdlc)->request) { if (state(hdlc)->reliable) - printk(KERN_INFO "%s: No LMI status reply " - "received\n", dev->name); + netdev_info(dev, "No LMI status reply received\n"); state(hdlc)->last_errors |= 1; } @@ -628,8 +624,7 @@ static void fr_timer(unsigned long arg) } if (state(hdlc)->reliable != reliable) { - printk(KERN_INFO "%s: Link %sreliable\n", dev->name, - reliable ? "" : "un"); + netdev_info(dev, "Link %sreliable\n", reliable ? "" : "un"); fr_set_link_state(reliable, dev); } @@ -665,33 +660,32 @@ static int fr_lmi_recv(struct net_device *dev, struct sk_buff *skb) if (skb->len < (lmi == LMI_ANSI ? LMI_ANSI_LENGTH : LMI_CCITT_CISCO_LENGTH)) { - printk(KERN_INFO "%s: Short LMI frame\n", dev->name); + netdev_info(dev, "Short LMI frame\n"); return 1; } if (skb->data[3] != (lmi == LMI_CISCO ? NLPID_CISCO_LMI : NLPID_CCITT_ANSI_LMI)) { - printk(KERN_INFO "%s: Received non-LMI frame with LMI DLCI\n", - dev->name); + netdev_info(dev, "Received non-LMI frame with LMI DLCI\n"); return 1; } if (skb->data[4] != LMI_CALLREF) { - printk(KERN_INFO "%s: Invalid LMI Call reference (0x%02X)\n", - dev->name, skb->data[4]); + netdev_info(dev, "Invalid LMI Call reference (0x%02X)\n", + skb->data[4]); return 1; } if (skb->data[5] != (dce ? LMI_STATUS_ENQUIRY : LMI_STATUS)) { - printk(KERN_INFO "%s: Invalid LMI Message type (0x%02X)\n", - dev->name, skb->data[5]); + netdev_info(dev, "Invalid LMI Message type (0x%02X)\n", + skb->data[5]); return 1; } if (lmi == LMI_ANSI) { if (skb->data[6] != LMI_ANSI_LOCKSHIFT) { - printk(KERN_INFO "%s: Not ANSI locking shift in LMI" - " message (0x%02X)\n", dev->name, skb->data[6]); + netdev_info(dev, "Not ANSI locking shift in LMI message (0x%02X)\n", + skb->data[6]); return 1; } i = 7; @@ -700,34 +694,34 @@ static int fr_lmi_recv(struct net_device *dev, struct sk_buff *skb) if (skb->data[i] != (lmi == LMI_CCITT ? LMI_CCITT_REPTYPE : LMI_ANSI_CISCO_REPTYPE)) { - printk(KERN_INFO "%s: Not an LMI Report type IE (0x%02X)\n", - dev->name, skb->data[i]); + netdev_info(dev, "Not an LMI Report type IE (0x%02X)\n", + skb->data[i]); return 1; } if (skb->data[++i] != LMI_REPT_LEN) { - printk(KERN_INFO "%s: Invalid LMI Report type IE length" - " (%u)\n", dev->name, skb->data[i]); + netdev_info(dev, "Invalid LMI Report type IE length (%u)\n", + skb->data[i]); return 1; } reptype = skb->data[++i]; if (reptype != LMI_INTEGRITY && reptype != LMI_FULLREP) { - printk(KERN_INFO "%s: Unsupported LMI Report type (0x%02X)\n", - dev->name, reptype); + netdev_info(dev, "Unsupported LMI Report type (0x%02X)\n", + reptype); return 1; } if (skb->data[++i] != (lmi == LMI_CCITT ? LMI_CCITT_ALIVE : LMI_ANSI_CISCO_ALIVE)) { - printk(KERN_INFO "%s: Not an LMI Link integrity verification" - " IE (0x%02X)\n", dev->name, skb->data[i]); + netdev_info(dev, "Not an LMI Link integrity verification IE (0x%02X)\n", + skb->data[i]); return 1; } if (skb->data[++i] != LMI_INTEG_LEN) { - printk(KERN_INFO "%s: Invalid LMI Link integrity verification" - " IE length (%u)\n", dev->name, skb->data[i]); + netdev_info(dev, "Invalid LMI Link integrity verification IE length (%u)\n", + skb->data[i]); return 1; } i++; @@ -801,14 +795,14 @@ static int fr_lmi_recv(struct net_device *dev, struct sk_buff *skb) if (skb->data[i] != (lmi == LMI_CCITT ? LMI_CCITT_PVCSTAT : LMI_ANSI_CISCO_PVCSTAT)) { - printk(KERN_INFO "%s: Not an LMI PVC status IE" - " (0x%02X)\n", dev->name, skb->data[i]); + netdev_info(dev, "Not an LMI PVC status IE (0x%02X)\n", + skb->data[i]); return 1; } if (skb->data[++i] != stat_len) { - printk(KERN_INFO "%s: Invalid LMI PVC status IE length" - " (%u)\n", dev->name, skb->data[i]); + netdev_info(dev, "Invalid LMI PVC status IE length (%u)\n", + skb->data[i]); return 1; } i++; @@ -829,9 +823,7 @@ static int fr_lmi_recv(struct net_device *dev, struct sk_buff *skb) pvc = add_pvc(dev, dlci); if (!pvc && !no_ram) { - printk(KERN_WARNING - "%s: Memory squeeze on fr_lmi_recv()\n", - dev->name); + netdev_warn(dev, "Memory squeeze on fr_lmi_recv()\n"); no_ram = 1; } @@ -902,8 +894,8 @@ static int fr_rx(struct sk_buff *skb) pvc = find_pvc(hdlc, dlci); if (!pvc) { #ifdef DEBUG_PKT - printk(KERN_INFO "%s: No PVC for received frame's DLCI %d\n", - frad->name, dlci); + netdev_info(frad, "No PVC for received frame's DLCI %d\n", + dlci); #endif dev_kfree_skb_any(skb); return NET_RX_DROP; @@ -962,14 +954,14 @@ static int fr_rx(struct sk_buff *skb) break; default: - printk(KERN_INFO "%s: Unsupported protocol, OUI=%x " - "PID=%x\n", frad->name, oui, pid); + netdev_info(frad, "Unsupported protocol, OUI=%x PID=%x\n", + oui, pid); dev_kfree_skb_any(skb); return NET_RX_DROP; } } else { - printk(KERN_INFO "%s: Unsupported protocol, NLPID=%x " - "length = %i\n", frad->name, data[3], skb->len); + netdev_info(frad, "Unsupported protocol, NLPID=%x length=%i\n", + data[3], skb->len); dev_kfree_skb_any(skb); return NET_RX_DROP; } @@ -1073,8 +1065,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) int used; if ((pvc = add_pvc(frad, dlci)) == NULL) { - printk(KERN_WARNING "%s: Memory squeeze on fr_add_pvc()\n", - frad->name); + netdev_warn(frad, "Memory squeeze on fr_add_pvc()\n"); return -ENOBUFS; } @@ -1089,8 +1080,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) dev = alloc_netdev(0, "pvc%d", pvc_setup); if (!dev) { - printk(KERN_WARNING "%s: Memory squeeze on fr_pvc()\n", - frad->name); + netdev_warn(frad, "Memory squeeze on fr_pvc()\n"); delete_unused_pvcs(hdlc); return -ENOBUFS; } diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c index 941f053e650..055a918067e 100644 --- a/drivers/net/wan/hdlc_ppp.c +++ b/drivers/net/wan/hdlc_ppp.c @@ -223,8 +223,7 @@ static void ppp_tx_cp(struct net_device *dev, u16 pid, u8 code, skb = dev_alloc_skb(sizeof(struct hdlc_header) + sizeof(struct cp_header) + magic_len + len); if (!skb) { - printk(KERN_WARNING "%s: out of memory in ppp_tx_cp()\n", - dev->name); + netdev_warn(dev, "out of memory in ppp_tx_cp()\n"); return; } skb_reserve(skb, sizeof(struct hdlc_header)); @@ -345,7 +344,7 @@ static void ppp_cp_event(struct net_device *dev, u16 pid, u16 event, u8 code, ppp_tx_cp(dev, pid, CP_CODE_REJ, ++ppp->seq, len, data); if (old_state != OPENED && proto->state == OPENED) { - printk(KERN_INFO "%s: %s up\n", dev->name, proto_name(pid)); + netdev_info(dev, "%s up\n", proto_name(pid)); if (pid == PID_LCP) { netif_dormant_off(dev); ppp_cp_event(dev, PID_IPCP, START, 0, 0, 0, NULL); @@ -356,7 +355,7 @@ static void ppp_cp_event(struct net_device *dev, u16 pid, u16 event, u8 code, } } if (old_state == OPENED && proto->state != OPENED) { - printk(KERN_INFO "%s: %s down\n", dev->name, proto_name(pid)); + netdev_info(dev, "%s down\n", proto_name(pid)); if (pid == PID_LCP) { netif_dormant_on(dev); ppp_cp_event(dev, PID_IPCP, STOP, 0, 0, 0, NULL); @@ -585,7 +584,7 @@ static void ppp_timer(unsigned long arg) break; if (time_after(jiffies, ppp->last_pong + ppp->keepalive_timeout * HZ)) { - printk(KERN_INFO "%s: Link down\n", proto->dev->name); + netdev_info(proto->dev, "Link down\n"); ppp_cp_event(proto->dev, PID_LCP, STOP, 0, 0, 0, NULL); ppp_cp_event(proto->dev, PID_LCP, START, 0, 0, 0, NULL); } else { /* send keep-alive packet */ diff --git a/drivers/net/wan/hdlc_x25.c b/drivers/net/wan/hdlc_x25.c index 70527e5a54a..56aeb011cb3 100644 --- a/drivers/net/wan/hdlc_x25.c +++ b/drivers/net/wan/hdlc_x25.c @@ -34,7 +34,7 @@ static void x25_connect_disconnect(struct net_device *dev, int reason, int code) unsigned char *ptr; if ((skb = dev_alloc_skb(1)) == NULL) { - printk(KERN_ERR "%s: out of memory\n", dev->name); + netdev_err(dev, "out of memory\n"); return; } @@ -106,9 +106,8 @@ static netdev_tx_t x25_xmit(struct sk_buff *skb, struct net_device *dev) /* Send connect confirm. msg to level 3 */ x25_connected(dev, 0); else - printk(KERN_ERR "%s: LAPB connect request " - "failed, error code = %i\n", - dev->name, result); + netdev_err(dev, "LAPB connect request failed, error code = %i\n", + result); } break; @@ -118,9 +117,8 @@ static netdev_tx_t x25_xmit(struct sk_buff *skb, struct net_device *dev) /* Send disconnect confirm. msg to level 3 */ x25_disconnected(dev, 0); else - printk(KERN_ERR "%s: LAPB disconnect request " - "failed, error code = %i\n", - dev->name, result); + netdev_err(dev, "LAPB disconnect request failed, error code = %i\n", + result); } break; diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c index e817583e6ec..3d80e4267de 100644 --- a/drivers/net/wan/hostess_sv11.c +++ b/drivers/net/wan/hostess_sv11.c @@ -20,6 +20,8 @@ * Generic HDLC port Copyright (C) 2008 Krzysztof Halasa <khc@pm.waw.pl> */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> #include <linux/kernel.h> #include <linux/mm.h> @@ -192,8 +194,7 @@ static struct z8530_dev *sv11_init(int iobase, int irq) */ if (!request_region(iobase, 8, "Comtrol SV11")) { - printk(KERN_WARNING "hostess: I/O 0x%X already in use.\n", - iobase); + pr_warn("I/O 0x%X already in use\n", iobase); return NULL; } @@ -221,7 +222,7 @@ static struct z8530_dev *sv11_init(int iobase, int irq) if (request_irq(irq, z8530_interrupt, IRQF_DISABLED, "Hostess SV11", sv) < 0) { - printk(KERN_WARNING "hostess: IRQ %d already in use.\n", irq); + pr_warn("IRQ %d already in use\n", irq); goto err_irq; } @@ -255,7 +256,7 @@ static struct z8530_dev *sv11_init(int iobase, int irq) */ if (z8530_init(sv)) { - printk(KERN_ERR "Z8530 series device not found.\n"); + pr_err("Z8530 series device not found\n"); enable_irq(irq); goto free_dma; } @@ -282,7 +283,7 @@ static struct z8530_dev *sv11_init(int iobase, int irq) netdev->irq = irq; if (register_hdlc_device(netdev)) { - printk(KERN_ERR "hostess: unable to register HDLC device.\n"); + pr_err("unable to register HDLC device\n"); free_netdev(netdev); goto free_dma; } diff --git a/drivers/net/wan/ixp4xx_hss.c b/drivers/net/wan/ixp4xx_hss.c index f1e1643dc3e..aaaca9aa229 100644 --- a/drivers/net/wan/ixp4xx_hss.c +++ b/drivers/net/wan/ixp4xx_hss.c @@ -8,6 +8,8 @@ * as published by the Free Software Foundation. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/bitops.h> #include <linux/cdev.h> #include <linux/dma-mapping.h> @@ -358,9 +360,8 @@ static void hss_npe_send(struct port *port, struct msg *msg, const char* what) { u32 *val = (u32*)msg; if (npe_send_message(port->npe, msg, what)) { - printk(KERN_CRIT "HSS-%i: unable to send command [%08X:%08X]" - " to %s\n", port->id, val[0], val[1], - npe_name(port->npe)); + pr_crit("HSS-%i: unable to send command [%08X:%08X] to %s\n", + port->id, val[0], val[1], npe_name(port->npe)); BUG(); } } @@ -447,8 +448,7 @@ static void hss_config(struct port *port) if (npe_recv_message(port->npe, &msg, "HSS_LOAD_CONFIG") || /* HSS_LOAD_CONFIG for port #1 returns port_id = #4 */ msg.cmd != PORT_CONFIG_LOAD || msg.data32) { - printk(KERN_CRIT "HSS-%i: HSS_LOAD_CONFIG failed\n", - port->id); + pr_crit("HSS-%i: HSS_LOAD_CONFIG failed\n", port->id); BUG(); } @@ -477,8 +477,7 @@ static u32 hss_get_status(struct port *port) msg.hss_port = port->id; hss_npe_send(port, &msg, "PORT_ERROR_READ"); if (npe_recv_message(port->npe, &msg, "PORT_ERROR_READ")) { - printk(KERN_CRIT "HSS-%i: unable to read HSS status\n", - port->id); + pr_crit("HSS-%i: unable to read HSS status\n", port->id); BUG(); } @@ -736,9 +735,8 @@ static int hss_hdlc_poll(struct napi_struct *napi, int budget) dev->stats.rx_errors++; break; default: /* FIXME - remove printk */ - printk(KERN_ERR "%s: hss_hdlc_poll: status 0x%02X" - " errors %u\n", dev->name, desc->status, - desc->error_count); + netdev_err(dev, "hss_hdlc_poll: status 0x%02X errors %u\n", + desc->status, desc->error_count); dev->stats.rx_errors++; } @@ -1127,8 +1125,8 @@ static int hss_hdlc_close(struct net_device *dev) buffs--; if (buffs) - printk(KERN_CRIT "%s: unable to drain RX queue, %i buffer(s)" - " left in NPE\n", dev->name, buffs); + netdev_crit(dev, "unable to drain RX queue, %i buffer(s) left in NPE\n", + buffs); buffs = TX_DESCS; while (queue_get_desc(queue_ids[port->id].tx, port, 1) >= 0) @@ -1143,8 +1141,8 @@ static int hss_hdlc_close(struct net_device *dev) } while (++i < MAX_CLOSE_WAIT); if (buffs) - printk(KERN_CRIT "%s: unable to drain TX queue, %i buffer(s) " - "left in NPE\n", dev->name, buffs); + netdev_crit(dev, "unable to drain TX queue, %i buffer(s) left in NPE\n", + buffs); #if DEBUG_CLOSE if (!buffs) printk(KERN_DEBUG "Draining TX queues took %i cycles\n", i); @@ -1364,7 +1362,7 @@ static int __devinit hss_init_one(struct platform_device *pdev) platform_set_drvdata(pdev, port); - printk(KERN_INFO "%s: HSS-%i\n", dev->name, port->id); + netdev_info(dev, "HSS-%i\n", port->id); return 0; err_free_netdev: diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c index eec463f99c0..a817081737a 100644 --- a/drivers/net/wan/lapbether.c +++ b/drivers/net/wan/lapbether.c @@ -20,6 +20,8 @@ * 2000-11-14 Henner Eisen dev_hold/put, NETDEV_GOING_DOWN support */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/errno.h> #include <linux/types.h> #include <linux/socket.h> @@ -165,13 +167,11 @@ static netdev_tx_t lapbeth_xmit(struct sk_buff *skb, break; case X25_IFACE_CONNECT: if ((err = lapb_connect_request(dev)) != LAPB_OK) - printk(KERN_ERR "lapbeth: lapb_connect_request " - "error: %d\n", err); + pr_err("lapb_connect_request error: %d\n", err); goto drop; case X25_IFACE_DISCONNECT: if ((err = lapb_disconnect_request(dev)) != LAPB_OK) - printk(KERN_ERR "lapbeth: lapb_disconnect_request " - "err: %d\n", err); + pr_err("lapb_disconnect_request err: %d\n", err); /* Fall thru */ default: goto drop; @@ -180,7 +180,7 @@ static netdev_tx_t lapbeth_xmit(struct sk_buff *skb, skb_pull(skb, 1); if ((err = lapb_data_request(dev, skb)) != LAPB_OK) { - printk(KERN_ERR "lapbeth: lapb_data_request error - %d\n", err); + pr_err("lapb_data_request error - %d\n", err); goto drop; } out: @@ -220,7 +220,7 @@ static void lapbeth_connected(struct net_device *dev, int reason) struct sk_buff *skb = dev_alloc_skb(1); if (!skb) { - printk(KERN_ERR "lapbeth: out of memory\n"); + pr_err("out of memory\n"); return; } @@ -237,7 +237,7 @@ static void lapbeth_disconnected(struct net_device *dev, int reason) struct sk_buff *skb = dev_alloc_skb(1); if (!skb) { - printk(KERN_ERR "lapbeth: out of memory\n"); + pr_err("out of memory\n"); return; } @@ -277,7 +277,7 @@ static int lapbeth_open(struct net_device *dev) int err; if ((err = lapb_register(dev, &lapbeth_callbacks)) != LAPB_OK) { - printk(KERN_ERR "lapbeth: lapb_register error - %d\n", err); + pr_err("lapb_register error: %d\n", err); return -ENODEV; } @@ -292,7 +292,7 @@ static int lapbeth_close(struct net_device *dev) netif_stop_queue(dev); if ((err = lapb_unregister(dev)) != LAPB_OK) - printk(KERN_ERR "lapbeth: lapb_unregister error - %d\n", err); + pr_err("lapb_unregister error: %d\n", err); return 0; } diff --git a/drivers/net/wan/n2.c b/drivers/net/wan/n2.c index 17d408fe693..5129ad514d2 100644 --- a/drivers/net/wan/n2.c +++ b/drivers/net/wan/n2.c @@ -16,6 +16,8 @@ * SDL Inc. PPP/HDLC/CISCO driver */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> #include <linux/kernel.h> #include <linux/capability.h> @@ -341,57 +343,57 @@ static int __init n2_run(unsigned long io, unsigned long irq, int i; if (io < 0x200 || io > 0x3FF || (io % N2_IOPORTS) != 0) { - printk(KERN_ERR "n2: invalid I/O port value\n"); + pr_err("invalid I/O port value\n"); return -ENODEV; } if (irq < 3 || irq > 15 || irq == 6) /* FIXME */ { - printk(KERN_ERR "n2: invalid IRQ value\n"); + pr_err("invalid IRQ value\n"); return -ENODEV; } if (winbase < 0xA0000 || winbase > 0xFFFFF || (winbase & 0xFFF) != 0) { - printk(KERN_ERR "n2: invalid RAM value\n"); + pr_err("invalid RAM value\n"); return -ENODEV; } card = kzalloc(sizeof(card_t), GFP_KERNEL); if (card == NULL) { - printk(KERN_ERR "n2: unable to allocate memory\n"); + pr_err("unable to allocate memory\n"); return -ENOBUFS; } card->ports[0].dev = alloc_hdlcdev(&card->ports[0]); card->ports[1].dev = alloc_hdlcdev(&card->ports[1]); if (!card->ports[0].dev || !card->ports[1].dev) { - printk(KERN_ERR "n2: unable to allocate memory\n"); + pr_err("unable to allocate memory\n"); n2_destroy_card(card); return -ENOMEM; } if (!request_region(io, N2_IOPORTS, devname)) { - printk(KERN_ERR "n2: I/O port region in use\n"); + pr_err("I/O port region in use\n"); n2_destroy_card(card); return -EBUSY; } card->io = io; if (request_irq(irq, sca_intr, 0, devname, card)) { - printk(KERN_ERR "n2: could not allocate IRQ\n"); + pr_err("could not allocate IRQ\n"); n2_destroy_card(card); return -EBUSY; } card->irq = irq; if (!request_mem_region(winbase, USE_WINDOWSIZE, devname)) { - printk(KERN_ERR "n2: could not request RAM window\n"); + pr_err("could not request RAM window\n"); n2_destroy_card(card); return -EBUSY; } card->phy_winbase = winbase; card->winbase = ioremap(winbase, USE_WINDOWSIZE); if (!card->winbase) { - printk(KERN_ERR "n2: ioremap() failed\n"); + pr_err("ioremap() failed\n"); n2_destroy_card(card); return -EFAULT; } @@ -413,7 +415,7 @@ static int __init n2_run(unsigned long io, unsigned long irq, break; default: - printk(KERN_ERR "n2: invalid window size\n"); + pr_err("invalid window size\n"); n2_destroy_card(card); return -ENODEV; } @@ -433,12 +435,12 @@ static int __init n2_run(unsigned long io, unsigned long irq, card->buff_offset = (valid0 + valid1) * sizeof(pkt_desc) * (card->tx_ring_buffers + card->rx_ring_buffers); - printk(KERN_INFO "n2: RISCom/N2 %u KB RAM, IRQ%u, " - "using %u TX + %u RX packets rings\n", card->ram_size / 1024, - card->irq, card->tx_ring_buffers, card->rx_ring_buffers); + pr_info("RISCom/N2 %u KB RAM, IRQ%u, using %u TX + %u RX packets rings\n", + card->ram_size / 1024, card->irq, + card->tx_ring_buffers, card->rx_ring_buffers); if (card->tx_ring_buffers < 1) { - printk(KERN_ERR "n2: RAM test failed\n"); + pr_err("RAM test failed\n"); n2_destroy_card(card); return -EIO; } @@ -474,16 +476,14 @@ static int __init n2_run(unsigned long io, unsigned long irq, port->card = card; if (register_hdlc_device(dev)) { - printk(KERN_WARNING "n2: unable to register hdlc " - "device\n"); + pr_warn("unable to register hdlc device\n"); port->card = NULL; n2_destroy_card(card); return -ENOBUFS; } sca_init_port(port); /* Set up SCA memory */ - printk(KERN_INFO "%s: RISCom/N2 node %d\n", - dev->name, port->phy_node); + netdev_info(dev, "RISCom/N2 node %d\n", port->phy_node); } *new_card = card; @@ -498,12 +498,12 @@ static int __init n2_init(void) { if (hw==NULL) { #ifdef MODULE - printk(KERN_INFO "n2: no card initialized\n"); + pr_info("no card initialized\n"); #endif return -EINVAL; /* no parameters specified, abort */ } - printk(KERN_INFO "%s\n", version); + pr_info("%s\n", version); do { unsigned long io, irq, ram; @@ -541,7 +541,7 @@ static int __init n2_init(void) return first_card ? 0 : -EINVAL; }while(*hw++ == ':'); - printk(KERN_ERR "n2: invalid hardware parameters\n"); + pr_err("invalid hardware parameters\n"); return first_card ? 0 : -EINVAL; } diff --git a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c index 9617d3d0ee3..1eeedd6a10b 100644 --- a/drivers/net/wan/pc300_drv.c +++ b/drivers/net/wan/pc300_drv.c @@ -212,6 +212,8 @@ static const char rcsid[] = * */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> #include <linux/kernel.h> #include <linux/mm.h> @@ -3242,7 +3244,7 @@ static inline void show_version(void) rcsdate++; tmp = strrchr(rcsdate, ' '); *tmp = '\0'; - printk(KERN_INFO "Cyclades-PC300 driver %s %s\n", rcsvers, rcsdate); + pr_info("Cyclades-PC300 driver %s %s\n", rcsvers, rcsdate); } /* show_version */ static const struct net_device_ops cpc_netdev_ops = { diff --git a/drivers/net/wan/pc300_tty.c b/drivers/net/wan/pc300_tty.c index 1c65d1c3387..d47d2cd1047 100644 --- a/drivers/net/wan/pc300_tty.c +++ b/drivers/net/wan/pc300_tty.c @@ -755,7 +755,7 @@ void cpc_tty_receive(pc300dev_t *pc300dev) dsr_rx = cpc_readb(card->hw.scabase + DSR_RX(ch)); - cpc_tty = (st_cpc_tty_area *)pc300dev->cpc_tty; + cpc_tty = pc300dev->cpc_tty; while (1) { rx_len = 0; diff --git a/drivers/net/wan/pc300too.c b/drivers/net/wan/pc300too.c index c7ab3becd26..c49c1b3c7aa 100644 --- a/drivers/net/wan/pc300too.c +++ b/drivers/net/wan/pc300too.c @@ -17,6 +17,8 @@ * PC300/X21 cards. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> #include <linux/kernel.h> #include <linux/slab.h> @@ -318,7 +320,7 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev, card = kzalloc(sizeof(card_t), GFP_KERNEL); if (card == NULL) { - printk(KERN_ERR "pc300: unable to allocate memory\n"); + pr_err("unable to allocate memory\n"); pci_release_regions(pdev); pci_disable_device(pdev); return -ENOBUFS; @@ -328,7 +330,7 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev, if (pci_resource_len(pdev, 0) != PC300_PLX_SIZE || pci_resource_len(pdev, 2) != PC300_SCA_SIZE || pci_resource_len(pdev, 3) < 16384) { - printk(KERN_ERR "pc300: invalid card EEPROM parameters\n"); + pr_err("invalid card EEPROM parameters\n"); pc300_pci_remove_one(pdev); return -EFAULT; } @@ -345,7 +347,7 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev, if (card->plxbase == NULL || card->scabase == NULL || card->rambase == NULL) { - printk(KERN_ERR "pc300: ioremap() failed\n"); + pr_err("ioremap() failed\n"); pc300_pci_remove_one(pdev); } @@ -370,7 +372,7 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev, for (i = 0; i < card->n_ports; i++) if (!(card->ports[i].netdev = alloc_hdlcdev(&card->ports[i]))) { - printk(KERN_ERR "pc300: unable to allocate memory\n"); + pr_err("unable to allocate memory\n"); pc300_pci_remove_one(pdev); return -ENOMEM; } @@ -411,15 +413,14 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev, card->buff_offset = card->n_ports * sizeof(pkt_desc) * (card->tx_ring_buffers + card->rx_ring_buffers); - printk(KERN_INFO "pc300: PC300/%s, %u KB RAM at 0x%x, IRQ%u, " - "using %u TX + %u RX packets rings\n", - card->type == PC300_X21 ? "X21" : - card->type == PC300_TE ? "TE" : "RSV", - ramsize / 1024, ramphys, pdev->irq, - card->tx_ring_buffers, card->rx_ring_buffers); + pr_info("PC300/%s, %u KB RAM at 0x%x, IRQ%u, using %u TX + %u RX packets rings\n", + card->type == PC300_X21 ? "X21" : + card->type == PC300_TE ? "TE" : "RSV", + ramsize / 1024, ramphys, pdev->irq, + card->tx_ring_buffers, card->rx_ring_buffers); if (card->tx_ring_buffers < 1) { - printk(KERN_ERR "pc300: RAM test failed\n"); + pr_err("RAM test failed\n"); pc300_pci_remove_one(pdev); return -EFAULT; } @@ -429,8 +430,7 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev, /* Allocate IRQ */ if (request_irq(pdev->irq, sca_intr, IRQF_SHARED, "pc300", card)) { - printk(KERN_WARNING "pc300: could not allocate IRQ%d.\n", - pdev->irq); + pr_warn("could not allocate IRQ%d\n", pdev->irq); pc300_pci_remove_one(pdev); return -EBUSY; } @@ -466,15 +466,13 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev, sca_init_port(port); if (register_hdlc_device(dev)) { - printk(KERN_ERR "pc300: unable to register hdlc " - "device\n"); + pr_err("unable to register hdlc device\n"); port->card = NULL; pc300_pci_remove_one(pdev); return -ENOBUFS; } - printk(KERN_INFO "%s: PC300 channel %d\n", - dev->name, port->chan); + netdev_info(dev, "PC300 channel %d\n", port->chan); } return 0; } @@ -505,11 +503,11 @@ static struct pci_driver pc300_pci_driver = { static int __init pc300_init_module(void) { if (pci_clock_freq < 1000000 || pci_clock_freq > 80000000) { - printk(KERN_ERR "pc300: Invalid PCI clock frequency\n"); + pr_err("Invalid PCI clock frequency\n"); return -EINVAL; } if (use_crystal_clock != 0 && use_crystal_clock != 1) { - printk(KERN_ERR "pc300: Invalid 'use_crystal_clock' value\n"); + pr_err("Invalid 'use_crystal_clock' value\n"); return -EINVAL; } diff --git a/drivers/net/wan/pci200syn.c b/drivers/net/wan/pci200syn.c index fd7375955e4..1ce21163c77 100644 --- a/drivers/net/wan/pci200syn.c +++ b/drivers/net/wan/pci200syn.c @@ -14,6 +14,8 @@ * PLX Technology Inc. PCI9052 Data Book */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> #include <linux/kernel.h> #include <linux/capability.h> @@ -297,7 +299,7 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev, card = kzalloc(sizeof(card_t), GFP_KERNEL); if (card == NULL) { - printk(KERN_ERR "pci200syn: unable to allocate memory\n"); + pr_err("unable to allocate memory\n"); pci_release_regions(pdev); pci_disable_device(pdev); return -ENOBUFS; @@ -306,7 +308,7 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev, card->ports[0].netdev = alloc_hdlcdev(&card->ports[0]); card->ports[1].netdev = alloc_hdlcdev(&card->ports[1]); if (!card->ports[0].netdev || !card->ports[1].netdev) { - printk(KERN_ERR "pci200syn: unable to allocate memory\n"); + pr_err("unable to allocate memory\n"); pci200_pci_remove_one(pdev); return -ENOMEM; } @@ -314,7 +316,7 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev, if (pci_resource_len(pdev, 0) != PCI200SYN_PLX_SIZE || pci_resource_len(pdev, 2) != PCI200SYN_SCA_SIZE || pci_resource_len(pdev, 3) < 16384) { - printk(KERN_ERR "pci200syn: invalid card EEPROM parameters\n"); + pr_err("invalid card EEPROM parameters\n"); pci200_pci_remove_one(pdev); return -EFAULT; } @@ -331,7 +333,7 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev, if (card->plxbase == NULL || card->scabase == NULL || card->rambase == NULL) { - printk(KERN_ERR "pci200syn: ioremap() failed\n"); + pr_err("ioremap() failed\n"); pci200_pci_remove_one(pdev); return -EFAULT; } @@ -357,12 +359,12 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev, card->buff_offset = 2 * sizeof(pkt_desc) * (card->tx_ring_buffers + card->rx_ring_buffers); - printk(KERN_INFO "pci200syn: %u KB RAM at 0x%x, IRQ%u, using %u TX +" - " %u RX packets rings\n", ramsize / 1024, ramphys, - pdev->irq, card->tx_ring_buffers, card->rx_ring_buffers); + pr_info("%u KB RAM at 0x%x, IRQ%u, using %u TX + %u RX packets rings\n", + ramsize / 1024, ramphys, + pdev->irq, card->tx_ring_buffers, card->rx_ring_buffers); if (card->tx_ring_buffers < 1) { - printk(KERN_ERR "pci200syn: RAM test failed\n"); + pr_err("RAM test failed\n"); pci200_pci_remove_one(pdev); return -EFAULT; } @@ -373,8 +375,7 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev, /* Allocate IRQ */ if (request_irq(pdev->irq, sca_intr, IRQF_SHARED, "pci200syn", card)) { - printk(KERN_WARNING "pci200syn: could not allocate IRQ%d.\n", - pdev->irq); + pr_warn("could not allocate IRQ%d\n", pdev->irq); pci200_pci_remove_one(pdev); return -EBUSY; } @@ -400,15 +401,13 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev, port->card = card; sca_init_port(port); if (register_hdlc_device(dev)) { - printk(KERN_ERR "pci200syn: unable to register hdlc " - "device\n"); + pr_err("unable to register hdlc device\n"); port->card = NULL; pci200_pci_remove_one(pdev); return -ENOBUFS; } - printk(KERN_INFO "%s: PCI200SYN channel %d\n", - dev->name, port->chan); + netdev_info(dev, "PCI200SYN channel %d\n", port->chan); } sca_flush(card); @@ -435,7 +434,7 @@ static struct pci_driver pci200_pci_driver = { static int __init pci200_init_module(void) { if (pci_clock_freq < 1000000 || pci_clock_freq > 80000000) { - printk(KERN_ERR "pci200syn: Invalid PCI clock frequency\n"); + pr_err("Invalid PCI clock frequency\n"); return -EINVAL; } return pci_register_driver(&pci200_pci_driver); diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c index cff13a9597c..86127bcc9f7 100644 --- a/drivers/net/wan/sbni.c +++ b/drivers/net/wan/sbni.c @@ -37,6 +37,8 @@ * Known problem: this driver wasn't tested on multiprocessor machine. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> #include <linux/kernel.h> #include <linux/ptrace.h> @@ -200,8 +202,8 @@ sbni_isa_probe( struct net_device *dev ) return 0; else { - printk( KERN_ERR "sbni: base address 0x%lx is busy, or adapter " - "is malfunctional!\n", dev->base_addr ); + pr_err("base address 0x%lx is busy, or adapter is malfunctional!\n", + dev->base_addr); return -ENODEV; } } @@ -226,7 +228,6 @@ static void __init sbni_devsetup(struct net_device *dev) int __init sbni_probe(int unit) { struct net_device *dev; - static unsigned version_printed __initdata = 0; int err; dev = alloc_netdev(sizeof(struct net_local), "sbni", sbni_devsetup); @@ -250,8 +251,7 @@ int __init sbni_probe(int unit) free_netdev(dev); return err; } - if( version_printed++ == 0 ) - printk( KERN_INFO "%s", version ); + pr_info_once("%s", version); return 0; } @@ -303,7 +303,6 @@ sbni_pci_probe( struct net_device *dev ) != NULL ) { int pci_irq_line; unsigned long pci_ioaddr; - u16 subsys; if( pdev->vendor != SBNI_PCI_VENDOR && pdev->device != SBNI_PCI_DEVICE ) @@ -314,9 +313,7 @@ sbni_pci_probe( struct net_device *dev ) /* Avoid already found cards from previous calls */ if( !request_region( pci_ioaddr, SBNI_IO_EXTENT, dev->name ) ) { - pci_read_config_word( pdev, PCI_SUBSYSTEM_ID, &subsys ); - - if (subsys != 2) + if (pdev->subsystem_device != 2) continue; /* Dual adapter is present */ @@ -326,9 +323,9 @@ sbni_pci_probe( struct net_device *dev ) } if (pci_irq_line <= 0 || pci_irq_line >= nr_irqs) - printk( KERN_WARNING - " WARNING: The PCI BIOS assigned this PCI card to IRQ %d, which is unlikely to work!.\n" - " You should use the PCI BIOS setup to assign a valid IRQ line.\n", + pr_warn( +"WARNING: The PCI BIOS assigned this PCI card to IRQ %d, which is unlikely to work!.\n" +"You should use the PCI BIOS setup to assign a valid IRQ line.\n", pci_irq_line ); /* avoiding re-enable dual adapters */ @@ -372,8 +369,7 @@ sbni_probe1( struct net_device *dev, unsigned long ioaddr, int irq ) outb( 0, ioaddr + CSR0 ); if( !irq ) { - printk( KERN_ERR "%s: can't detect device irq!\n", - dev->name ); + pr_err("%s: can't detect device irq!\n", dev->name); release_region( ioaddr, SBNI_IO_EXTENT ); return NULL; } @@ -386,7 +382,7 @@ sbni_probe1( struct net_device *dev, unsigned long ioaddr, int irq ) /* Fill in sbni-specific dev fields. */ nl = netdev_priv(dev); if( !nl ) { - printk( KERN_ERR "%s: unable to get memory!\n", dev->name ); + pr_err("%s: unable to get memory!\n", dev->name); release_region( ioaddr, SBNI_IO_EXTENT ); return NULL; } @@ -415,21 +411,21 @@ sbni_probe1( struct net_device *dev, unsigned long ioaddr, int irq ) if( inb( ioaddr + CSR0 ) & 0x01 ) nl->state |= FL_SLOW_MODE; - printk( KERN_NOTICE "%s: ioaddr %#lx, irq %d, " - "MAC: 00:ff:01:%02x:%02x:%02x\n", - dev->name, dev->base_addr, dev->irq, - ((u8 *) dev->dev_addr) [3], - ((u8 *) dev->dev_addr) [4], - ((u8 *) dev->dev_addr) [5] ); + pr_notice("%s: ioaddr %#lx, irq %d, MAC: 00:ff:01:%02x:%02x:%02x\n", + dev->name, dev->base_addr, dev->irq, + ((u8 *)dev->dev_addr)[3], + ((u8 *)dev->dev_addr)[4], + ((u8 *)dev->dev_addr)[5]); - printk( KERN_NOTICE "%s: speed %d, receive level ", dev->name, - ( (nl->state & FL_SLOW_MODE) ? 500000 : 2000000) - / (1 << nl->csr1.rate) ); + pr_notice("%s: speed %d", + dev->name, + ((nl->state & FL_SLOW_MODE) ? 500000 : 2000000) + / (1 << nl->csr1.rate)); if( nl->delta_rxl == 0 ) - printk( "0x%x (fixed)\n", nl->cur_rxl_index ); + pr_cont(", receive level 0x%x (fixed)\n", nl->cur_rxl_index); else - printk( "(auto)\n"); + pr_cont(", receive level (auto)\n"); #ifdef CONFIG_SBNI_MULTILINE nl->master = dev; @@ -568,7 +564,7 @@ handle_channel( struct net_device *dev ) */ csr0 = inb( ioaddr + CSR0 ); if( !(csr0 & TR_RDY) || (csr0 & RC_RDY) ) - printk( KERN_ERR "%s: internal error!\n", dev->name ); + netdev_err(dev, "internal error!\n"); /* if state & FL_NEED_RESEND != 0 then tx_frameno != 0 */ if( req_ans || nl->tx_frameno != 0 ) @@ -851,7 +847,7 @@ prepare_to_send( struct sk_buff *skb, struct net_device *dev ) /* nl->tx_buf_p == NULL here! */ if( nl->tx_buf_p ) - printk( KERN_ERR "%s: memory leak!\n", dev->name ); + netdev_err(dev, "memory leak!\n"); nl->outpos = 0; nl->state &= ~(FL_WAIT_ACK | FL_NEED_RESEND); @@ -1179,16 +1175,15 @@ sbni_open( struct net_device *dev ) ((struct net_local *) (netdev_priv(*p))) ->second = dev; - printk( KERN_NOTICE "%s: using shared irq " - "with %s\n", dev->name, (*p)->name ); + netdev_notice(dev, "using shared irq with %s\n", + (*p)->name); nl->state |= FL_SECONDARY; goto handler_attached; } } if( request_irq(dev->irq, sbni_interrupt, IRQF_SHARED, dev->name, dev) ) { - printk( KERN_ERR "%s: unable to get IRQ %d.\n", - dev->name, dev->irq ); + netdev_err(dev, "unable to get IRQ %d\n", dev->irq); return -EAGAIN; } @@ -1220,8 +1215,8 @@ sbni_close( struct net_device *dev ) struct net_local *nl = netdev_priv(dev); if( nl->second && nl->second->flags & IFF_UP ) { - printk( KERN_NOTICE "Secondary channel (%s) is active!\n", - nl->second->name ); + netdev_notice(dev, "Secondary channel (%s) is active!\n", + nl->second->name); return -EBUSY; } @@ -1363,8 +1358,8 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd ) return -EFAULT; slave_dev = dev_get_by_name(&init_net, slave_name ); if( !slave_dev || !(slave_dev->flags & IFF_UP) ) { - printk( KERN_ERR "%s: trying to enslave non-active " - "device %s\n", dev->name, slave_name ); + netdev_err(dev, "trying to enslave non-active device %s\n", + slave_name); return -EPERM; } @@ -1417,8 +1412,7 @@ enslave( struct net_device *dev, struct net_device *slave_dev ) spin_unlock( &snl->lock ); spin_unlock( &nl->lock ); - printk( KERN_NOTICE "%s: slave device (%s) attached.\n", - dev->name, slave_dev->name ); + netdev_notice(dev, "slave device (%s) attached\n", slave_dev->name); return 0; } @@ -1547,7 +1541,7 @@ sbni_setup( char *p ) break; } bad_param: - printk( KERN_ERR "Error in sbni kernel parameter!\n" ); + pr_err("Error in sbni kernel parameter!\n"); return 0; } diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c index 3f4e2b5684d..c8531612eea 100644 --- a/drivers/net/wan/sdla.c +++ b/drivers/net/wan/sdla.c @@ -32,6 +32,8 @@ * 2 of the License, or (at your option) any later version. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> @@ -350,24 +352,24 @@ static void sdla_errors(struct net_device *dev, int cmd, int dlci, int ret, int case SDLA_RET_MODEM: state = data; if (*state & SDLA_MODEM_DCD_LOW) - printk(KERN_INFO "%s: Modem DCD unexpectedly low!\n", dev->name); + netdev_info(dev, "Modem DCD unexpectedly low!\n"); if (*state & SDLA_MODEM_CTS_LOW) - printk(KERN_INFO "%s: Modem CTS unexpectedly low!\n", dev->name); + netdev_info(dev, "Modem CTS unexpectedly low!\n"); /* I should probably do something about this! */ break; case SDLA_RET_CHANNEL_OFF: - printk(KERN_INFO "%s: Channel became inoperative!\n", dev->name); + netdev_info(dev, "Channel became inoperative!\n"); /* same here */ break; case SDLA_RET_CHANNEL_ON: - printk(KERN_INFO "%s: Channel became operative!\n", dev->name); + netdev_info(dev, "Channel became operative!\n"); /* same here */ break; case SDLA_RET_DLCI_STATUS: - printk(KERN_INFO "%s: Status change reported by Access Node.\n", dev->name); + netdev_info(dev, "Status change reported by Access Node\n"); len /= sizeof(struct _dlci_stat); for(pstatus = data, i=0;i < len;i++,pstatus++) { @@ -382,29 +384,32 @@ static void sdla_errors(struct net_device *dev, int cmd, int dlci, int ret, int sprintf(line, "unknown status: %02X", pstatus->flags); state = line; } - printk(KERN_INFO "%s: DLCI %i: %s.\n", dev->name, pstatus->dlci, state); + netdev_info(dev, "DLCI %i: %s\n", + pstatus->dlci, state); /* same here */ } break; case SDLA_RET_DLCI_UNKNOWN: - printk(KERN_INFO "%s: Received unknown DLCIs:", dev->name); + netdev_info(dev, "Received unknown DLCIs:"); len /= sizeof(short); for(pdlci = data,i=0;i < len;i++,pdlci++) - printk(" %i", *pdlci); - printk("\n"); + pr_cont(" %i", *pdlci); + pr_cont("\n"); break; case SDLA_RET_TIMEOUT: - printk(KERN_ERR "%s: Command timed out!\n", dev->name); + netdev_err(dev, "Command timed out!\n"); break; case SDLA_RET_BUF_OVERSIZE: - printk(KERN_INFO "%s: Bc/CIR overflow, acceptable size is %i\n", dev->name, len); + netdev_info(dev, "Bc/CIR overflow, acceptable size is %i\n", + len); break; case SDLA_RET_BUF_TOO_BIG: - printk(KERN_INFO "%s: Buffer size over specified max of %i\n", dev->name, len); + netdev_info(dev, "Buffer size over specified max of %i\n", + len); break; case SDLA_RET_CHANNEL_INACTIVE: @@ -415,7 +420,8 @@ static void sdla_errors(struct net_device *dev, int cmd, int dlci, int ret, int break; default: - printk(KERN_DEBUG "%s: Cmd 0x%2.2X generated return code 0x%2.2X\n", dev->name, cmd, ret); + netdev_dbg(dev, "Cmd 0x%02X generated return code 0x%02X\n", + cmd, ret); /* Further processing could be done here */ break; } @@ -678,12 +684,14 @@ static netdev_tx_t sdla_transmit(struct sk_buff *skb, case ARPHRD_FRAD: if (skb->dev->type != ARPHRD_DLCI) { - printk(KERN_WARNING "%s: Non DLCI device, type %i, tried to send on FRAD module.\n", dev->name, skb->dev->type); + netdev_warn(dev, "Non DLCI device, type %i, tried to send on FRAD module\n", + skb->dev->type); accept = 0; } break; default: - printk(KERN_WARNING "%s: unknown firmware type 0x%4.4X\n", dev->name, dev->type); + netdev_warn(dev, "unknown firmware type 0x%04X\n", + dev->type); accept = 0; break; } @@ -807,7 +815,8 @@ static void sdla_receive(struct net_device *dev) if (i == CONFIG_DLCI_MAX) { - printk(KERN_NOTICE "%s: Received packet from invalid DLCI %i, ignoring.", dev->name, dlci); + netdev_notice(dev, "Received packet from invalid DLCI %i, ignoring\n", + dlci); dev->stats.rx_errors++; success = 0; } @@ -819,7 +828,7 @@ static void sdla_receive(struct net_device *dev) skb = dev_alloc_skb(len + sizeof(struct frhdr)); if (skb == NULL) { - printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name); + netdev_notice(dev, "Memory squeeze, dropping packet\n"); dev->stats.rx_dropped++; success = 0; } @@ -880,8 +889,7 @@ static irqreturn_t sdla_isr(int dummy, void *dev_id) if (!flp->initialized) { - printk(KERN_WARNING "%s: irq %d for uninitialized device.\n", - dev->name, dev->irq); + netdev_warn(dev, "irq %d for uninitialized device\n", dev->irq); return IRQ_NONE; } @@ -901,7 +909,7 @@ static irqreturn_t sdla_isr(int dummy, void *dev_id) case SDLA_INTR_TX: case SDLA_INTR_COMPLETE: case SDLA_INTR_TIMER: - printk(KERN_WARNING "%s: invalid irq flag 0x%02X.\n", dev->name, byte); + netdev_warn(dev, "invalid irq flag 0x%02X\n", byte); break; } @@ -1347,7 +1355,7 @@ static int sdla_set_config(struct net_device *dev, struct ifmap *map) return -EINVAL; if (!request_region(map->base_addr, SDLA_IO_EXTENTS, dev->name)){ - printk(KERN_WARNING "SDLA: io-port 0x%04lx in use\n", dev->base_addr); + pr_warn("io-port 0x%04lx in use\n", dev->base_addr); return -EINVAL; } base = map->base_addr; @@ -1412,7 +1420,7 @@ static int sdla_set_config(struct net_device *dev, struct ifmap *map) } } - printk(KERN_NOTICE "%s: Unknown card type\n", dev->name); + netdev_notice(dev, "Unknown card type\n"); err = -ENODEV; goto fail; diff --git a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c index e91457d6023..0b4fd05e150 100644 --- a/drivers/net/wan/sealevel.c +++ b/drivers/net/wan/sealevel.c @@ -12,6 +12,8 @@ * */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> #include <linux/kernel.h> #include <linux/mm.h> @@ -190,7 +192,7 @@ static int slvl_setup(struct slvl_device *sv, int iobase, int irq) dev->irq = irq; if (register_hdlc_device(dev)) { - printk(KERN_ERR "sealevel: unable to register HDLC device\n"); + pr_err("unable to register HDLC device\n"); free_netdev(dev); return -1; } @@ -215,8 +217,7 @@ static __init struct slvl_board *slvl_init(int iobase, int irq, */ if (!request_region(iobase, 8, "Sealevel 4021")) { - printk(KERN_WARNING "sealevel: I/O 0x%X already in use.\n", - iobase); + pr_warn("I/O 0x%X already in use\n", iobase); return NULL; } @@ -267,7 +268,7 @@ static __init struct slvl_board *slvl_init(int iobase, int irq, if (request_irq(irq, z8530_interrupt, IRQF_DISABLED, "SeaLevel", dev) < 0) { - printk(KERN_WARNING "sealevel: IRQ %d already in use.\n", irq); + pr_warn("IRQ %d already in use\n", irq); goto err_request_irq; } @@ -292,7 +293,7 @@ static __init struct slvl_board *slvl_init(int iobase, int irq, */ if (z8530_init(dev) != 0) { - printk(KERN_ERR "Z8530 series device not found.\n"); + pr_err("Z8530 series device not found\n"); enable_irq(irq); goto free_hw; } diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c index db73a7be199..44b70719725 100644 --- a/drivers/net/wan/wanxl.c +++ b/drivers/net/wan/wanxl.c @@ -13,6 +13,8 @@ * - wanXL100 will require minor driver modifications, no access to hw */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> #include <linux/kernel.h> #include <linux/slab.h> @@ -22,6 +24,7 @@ #include <linux/string.h> #include <linux/errno.h> #include <linux/init.h> +#include <linux/interrupt.h> #include <linux/ioport.h> #include <linux/netdevice.h> #include <linux/hdlc.h> @@ -101,9 +104,8 @@ static inline dma_addr_t pci_map_single_debug(struct pci_dev *pdev, void *ptr, { dma_addr_t addr = pci_map_single(pdev, ptr, size, direction); if (addr + size > 0x100000000LL) - printk(KERN_CRIT "wanXL %s: pci_map_single() returned memory" - " at 0x%LX!\n", pci_name(pdev), - (unsigned long long)addr); + pr_crit("%s: pci_map_single() returned memory at 0x%llx!\n", + pci_name(pdev), (unsigned long long)addr); return addr; } @@ -146,8 +148,8 @@ static inline void wanxl_cable_intr(port_t *port) } dte = (value & STATUS_CABLE_DCE) ? " DCE" : " DTE"; } - printk(KERN_INFO "%s: %s%s module, %s cable%s%s\n", - port->dev->name, pm, dte, cable, dsr, dcd); + netdev_info(port->dev, "%s%s module, %s cable%s%s\n", + pm, dte, cable, dsr, dcd); if (value & STATUS_CABLE_DCD) netif_carrier_on(port->dev); @@ -197,8 +199,8 @@ static inline void wanxl_rx_intr(card_t *card) while (desc = &card->status->rx_descs[card->rx_in], desc->stat != PACKET_EMPTY) { if ((desc->stat & PACKET_PORT_MASK) > card->n_ports) - printk(KERN_CRIT "wanXL %s: received packet for" - " nonexistent port\n", pci_name(card->pdev)); + pr_crit("%s: received packet for nonexistent port\n", + pci_name(card->pdev)); else { struct sk_buff *skb = card->rx_skbs[card->rx_in]; port_t *port = &card->ports[desc->stat & @@ -282,7 +284,7 @@ static netdev_tx_t wanxl_xmit(struct sk_buff *skb, struct net_device *dev) printk(KERN_DEBUG "%s: transmitter buffer full\n", dev->name); #endif netif_stop_queue(dev); - spin_unlock_irq(&port->lock); + spin_unlock(&port->lock); return NETDEV_TX_BUSY; /* request packet to be queued */ } @@ -396,7 +398,7 @@ static int wanxl_open(struct net_device *dev) int i; if (get_status(port)->open) { - printk(KERN_ERR "%s: port already open\n", dev->name); + netdev_err(dev, "port already open\n"); return -EIO; } if ((i = hdlc_open(dev)) != 0) @@ -416,7 +418,7 @@ static int wanxl_open(struct net_device *dev) } } while (time_after(timeout, jiffies)); - printk(KERN_ERR "%s: unable to open port\n", dev->name); + netdev_err(dev, "unable to open port\n"); /* ask the card to close the port, should it be still alive */ writel(1 << (DOORBELL_TO_CARD_CLOSE_0 + port->node), dbr); return -EFAULT; @@ -442,7 +444,7 @@ static int wanxl_close(struct net_device *dev) } while (time_after(timeout, jiffies)); if (get_status(port)->open) - printk(KERN_ERR "%s: unable to close port\n", dev->name); + netdev_err(dev, "unable to close port\n"); netif_stop_queue(dev); @@ -567,11 +569,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, int i, ports, alloc_size; #ifndef MODULE - static int printed_version; - if (!printed_version) { - printed_version++; - printk(KERN_INFO "%s\n", version); - } + pr_info_once("%s\n", version); #endif i = pci_enable_device(pdev); @@ -587,7 +585,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, work on most platforms */ if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(28)) || pci_set_dma_mask(pdev, DMA_BIT_MASK(28))) { - printk(KERN_ERR "wanXL: No usable DMA configuration\n"); + pr_err("No usable DMA configuration\n"); return -EIO; } @@ -606,8 +604,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, alloc_size = sizeof(card_t) + ports * sizeof(port_t); card = kzalloc(alloc_size, GFP_KERNEL); if (card == NULL) { - printk(KERN_ERR "wanXL %s: unable to allocate memory\n", - pci_name(pdev)); + pr_err("%s: unable to allocate memory\n", pci_name(pdev)); pci_release_regions(pdev); pci_disable_device(pdev); return -ENOBUFS; @@ -634,7 +631,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, to indicate the card can do 32-bit DMA addressing */ if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)) || pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { - printk(KERN_ERR "wanXL: No usable DMA configuration\n"); + pr_err("No usable DMA configuration\n"); wanxl_pci_remove_one(pdev); return -EIO; } @@ -644,7 +641,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, card->plx = ioremap_nocache(plx_phy, 0x70); if (!card->plx) { - printk(KERN_ERR "wanxl: ioremap() failed\n"); + pr_err("ioremap() failed\n"); wanxl_pci_remove_one(pdev); return -EFAULT; } @@ -656,8 +653,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, timeout = jiffies + 20 * HZ; while ((stat = readl(card->plx + PLX_MAILBOX_0)) != 0) { if (time_before(timeout, jiffies)) { - printk(KERN_WARNING "wanXL %s: timeout waiting for" - " PUTS to complete\n", pci_name(pdev)); + pr_warn("%s: timeout waiting for PUTS to complete\n", + pci_name(pdev)); wanxl_pci_remove_one(pdev); return -ENODEV; } @@ -668,8 +665,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, break; default: - printk(KERN_WARNING "wanXL %s: PUTS test 0x%X" - " failed\n", pci_name(pdev), stat & 0x30); + pr_warn("%s: PUTS test 0x%X failed\n", + pci_name(pdev), stat & 0x30); wanxl_pci_remove_one(pdev); return -ENODEV; } @@ -687,17 +684,16 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, /* sanity check the board's reported memory size */ if (ramsize < BUFFERS_ADDR + (TX_BUFFERS + RX_BUFFERS) * BUFFER_LENGTH * ports) { - printk(KERN_WARNING "wanXL %s: no enough on-board RAM" - " (%u bytes detected, %u bytes required)\n", - pci_name(pdev), ramsize, BUFFERS_ADDR + - (TX_BUFFERS + RX_BUFFERS) * BUFFER_LENGTH * ports); + pr_warn("%s: no enough on-board RAM (%u bytes detected, %u bytes required)\n", + pci_name(pdev), ramsize, + BUFFERS_ADDR + + (TX_BUFFERS + RX_BUFFERS) * BUFFER_LENGTH * ports); wanxl_pci_remove_one(pdev); return -ENODEV; } if (wanxl_puts_command(card, MBX1_CMD_BSWAP)) { - printk(KERN_WARNING "wanXL %s: unable to Set Byte Swap" - " Mode\n", pci_name(pdev)); + pr_warn("%s: unable to Set Byte Swap Mode\n", pci_name(pdev)); wanxl_pci_remove_one(pdev); return -ENODEV; } @@ -714,7 +710,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, mem = ioremap_nocache(mem_phy, PDM_OFFSET + sizeof(firmware)); if (!mem) { - printk(KERN_ERR "wanxl: ioremap() failed\n"); + pr_err("ioremap() failed\n"); wanxl_pci_remove_one(pdev); return -EFAULT; } @@ -733,8 +729,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, writel(0, card->plx + PLX_MAILBOX_5); if (wanxl_puts_command(card, MBX1_CMD_ABORTJ)) { - printk(KERN_WARNING "wanXL %s: unable to Abort and Jump\n", - pci_name(pdev)); + pr_warn("%s: unable to Abort and Jump\n", pci_name(pdev)); wanxl_pci_remove_one(pdev); return -ENODEV; } @@ -748,8 +743,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, }while (time_after(timeout, jiffies)); if (!stat) { - printk(KERN_WARNING "wanXL %s: timeout while initializing card " - "firmware\n", pci_name(pdev)); + pr_warn("%s: timeout while initializing card firmware\n", + pci_name(pdev)); wanxl_pci_remove_one(pdev); return -ENODEV; } @@ -758,13 +753,13 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, ramsize = stat; #endif - printk(KERN_INFO "wanXL %s: at 0x%X, %u KB of RAM at 0x%X, irq %u\n", - pci_name(pdev), plx_phy, ramsize / 1024, mem_phy, pdev->irq); + pr_info("%s: at 0x%X, %u KB of RAM at 0x%X, irq %u\n", + pci_name(pdev), plx_phy, ramsize / 1024, mem_phy, pdev->irq); /* Allocate IRQ */ if (request_irq(pdev->irq, wanxl_intr, IRQF_SHARED, "wanXL", card)) { - printk(KERN_WARNING "wanXL %s: could not allocate IRQ%i.\n", - pci_name(pdev), pdev->irq); + pr_warn("%s: could not allocate IRQ%i\n", + pci_name(pdev), pdev->irq); wanxl_pci_remove_one(pdev); return -EBUSY; } @@ -775,8 +770,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, port_t *port = &card->ports[i]; struct net_device *dev = alloc_hdlcdev(port); if (!dev) { - printk(KERN_ERR "wanXL %s: unable to allocate" - " memory\n", pci_name(pdev)); + pr_err("%s: unable to allocate memory\n", + pci_name(pdev)); wanxl_pci_remove_one(pdev); return -ENOMEM; } @@ -792,8 +787,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, port->node = i; get_status(port)->clocking = CLOCK_EXT; if (register_hdlc_device(dev)) { - printk(KERN_ERR "wanXL %s: unable to register hdlc" - " device\n", pci_name(pdev)); + pr_err("%s: unable to register hdlc device\n", + pci_name(pdev)); free_netdev(dev); wanxl_pci_remove_one(pdev); return -ENOBUFS; @@ -801,11 +796,11 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, card->n_ports++; } - printk(KERN_INFO "wanXL %s: port", pci_name(pdev)); + pr_info("%s: port", pci_name(pdev)); for (i = 0; i < ports; i++) - printk("%s #%i: %s", i ? "," : "", i, - card->ports[i].dev->name); - printk("\n"); + pr_cont("%s #%i: %s", + i ? "," : "", i, card->ports[i].dev->name); + pr_cont("\n"); for (i = 0; i < ports; i++) wanxl_cable_intr(&card->ports[i]); /* get carrier status etc.*/ @@ -835,7 +830,7 @@ static struct pci_driver wanxl_pci_driver = { static int __init wanxl_init_module(void) { #ifdef MODULE - printk(KERN_INFO "%s\n", version); + pr_info("%s\n", version); #endif return pci_register_driver(&wanxl_pci_driver); } diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c index 24297b274cd..46ceb3ae907 100644 --- a/drivers/net/wan/x25_asy.c +++ b/drivers/net/wan/x25_asy.c @@ -14,6 +14,8 @@ * 2000-10-29 Henner Eisen lapb_data_indication() return status. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> #include <asm/system.h> @@ -96,7 +98,7 @@ static struct x25_asy *x25_asy_alloc(void) x25_asy_devs[i] = dev; return sl; } else { - printk(KERN_WARNING "x25_asy_alloc() - register_netdev() failure.\n"); + pr_warn("%s(): register_netdev() failure\n", __func__); free_netdev(dev); } } @@ -114,8 +116,7 @@ static void x25_asy_free(struct x25_asy *sl) sl->xbuff = NULL; if (!test_and_clear_bit(SLF_INUSE, &sl->flags)) - printk(KERN_ERR "%s: x25_asy_free for already free unit.\n", - sl->dev->name); + netdev_err(sl->dev, "x25_asy_free for already free unit\n"); } static int x25_asy_change_mtu(struct net_device *dev, int newmtu) @@ -128,8 +129,7 @@ static int x25_asy_change_mtu(struct net_device *dev, int newmtu) rbuff = kmalloc(len + 4, GFP_ATOMIC); if (xbuff == NULL || rbuff == NULL) { - printk(KERN_WARNING "%s: unable to grow X.25 buffers, MTU change cancelled.\n", - dev->name); + netdev_warn(dev, "unable to grow X.25 buffers, MTU change cancelled\n"); kfree(xbuff); kfree(rbuff); return -ENOMEM; @@ -198,8 +198,7 @@ static void x25_asy_bump(struct x25_asy *sl) skb = dev_alloc_skb(count+1); if (skb == NULL) { - printk(KERN_WARNING "%s: memory squeeze, dropping packet.\n", - sl->dev->name); + netdev_warn(sl->dev, "memory squeeze, dropping packet\n"); dev->stats.rx_dropped++; return; } @@ -287,9 +286,9 @@ static void x25_asy_timeout(struct net_device *dev) /* May be we must check transmitter timeout here ? * 14 Oct 1994 Dmitry Gorodchanin. */ - printk(KERN_WARNING "%s: transmit timed out, %s?\n", dev->name, - (tty_chars_in_buffer(sl->tty) || sl->xleft) ? - "bad line quality" : "driver error"); + netdev_warn(dev, "transmit timed out, %s?\n", + (tty_chars_in_buffer(sl->tty) || sl->xleft) ? + "bad line quality" : "driver error"); sl->xleft = 0; clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags); x25_asy_unlock(sl); @@ -306,8 +305,7 @@ static netdev_tx_t x25_asy_xmit(struct sk_buff *skb, int err; if (!netif_running(sl->dev)) { - printk(KERN_ERR "%s: xmit call when iface is down\n", - dev->name); + netdev_err(dev, "xmit call when iface is down\n"); kfree_skb(skb); return NETDEV_TX_OK; } @@ -318,13 +316,15 @@ static netdev_tx_t x25_asy_xmit(struct sk_buff *skb, case X25_IFACE_CONNECT: /* Connection request .. do nothing */ err = lapb_connect_request(dev); if (err != LAPB_OK) - printk(KERN_ERR "x25_asy: lapb_connect_request error - %d\n", err); + netdev_err(dev, "lapb_connect_request error: %d\n", + err); kfree_skb(skb); return NETDEV_TX_OK; case X25_IFACE_DISCONNECT: /* do nothing - hang up ?? */ err = lapb_disconnect_request(dev); if (err != LAPB_OK) - printk(KERN_ERR "x25_asy: lapb_disconnect_request error - %d\n", err); + netdev_err(dev, "lapb_disconnect_request error: %d\n", + err); default: kfree_skb(skb); return NETDEV_TX_OK; @@ -343,7 +343,7 @@ static netdev_tx_t x25_asy_xmit(struct sk_buff *skb, err = lapb_data_request(dev, skb); if (err != LAPB_OK) { - printk(KERN_ERR "x25_asy: lapb_data_request error - %d\n", err); + netdev_err(dev, "lapb_data_request error: %d\n", err); kfree_skb(skb); return NETDEV_TX_OK; } @@ -378,7 +378,7 @@ static void x25_asy_data_transmit(struct net_device *dev, struct sk_buff *skb) spin_lock(&sl->lock); if (netif_queue_stopped(sl->dev) || sl->tty == NULL) { spin_unlock(&sl->lock); - printk(KERN_ERR "x25_asy: tbusy drop\n"); + netdev_err(dev, "tbusy drop\n"); kfree_skb(skb); return; } @@ -404,7 +404,7 @@ static void x25_asy_connected(struct net_device *dev, int reason) skb = dev_alloc_skb(1); if (skb == NULL) { - printk(KERN_ERR "x25_asy: out of memory\n"); + netdev_err(dev, "out of memory\n"); return; } @@ -423,7 +423,7 @@ static void x25_asy_disconnected(struct net_device *dev, int reason) skb = dev_alloc_skb(1); if (skb == NULL) { - printk(KERN_ERR "x25_asy: out of memory\n"); + netdev_err(dev, "out of memory\n"); return; } @@ -603,8 +603,8 @@ static void x25_asy_close_tty(struct tty_struct *tty) err = lapb_unregister(sl->dev); if (err != LAPB_OK) - printk(KERN_ERR "x25_asy_close: lapb_unregister error -%d\n", - err); + pr_err("x25_asy_close: lapb_unregister error: %d\n", + err); tty->disc_data = NULL; sl->tty = NULL; @@ -782,14 +782,13 @@ static int __init init_x25_asy(void) if (x25_asy_maxdev < 4) x25_asy_maxdev = 4; /* Sanity */ - printk(KERN_INFO "X.25 async: version 0.00 ALPHA " - "(dynamic channels, max=%d).\n", x25_asy_maxdev); + pr_info("X.25 async: version 0.00 ALPHA (dynamic channels, max=%d)\n", + x25_asy_maxdev); x25_asy_devs = kcalloc(x25_asy_maxdev, sizeof(struct net_device *), GFP_KERNEL); if (!x25_asy_devs) { - printk(KERN_WARNING "X25 async: Can't allocate x25_asy_ctrls[] " - "array! Uaargh! (-> No X.25 available)\n"); + pr_warn("Can't allocate x25_asy_ctrls[] array! Uaargh! (-> No X.25 available)\n"); return -ENOMEM; } diff --git a/drivers/net/wan/z85230.c b/drivers/net/wan/z85230.c index 0806232e0f8..0e576906170 100644 --- a/drivers/net/wan/z85230.c +++ b/drivers/net/wan/z85230.c @@ -36,6 +36,8 @@ * Synchronous mode without DMA is unlikely to pass about 2400 baud. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> #include <linux/kernel.h> #include <linux/mm.h> @@ -365,7 +367,7 @@ static void z8530_rx(struct z8530_channel *c) c->count=0; if(stat&Rx_OVR) { - printk(KERN_WARNING "%s: overrun\n", c->dev->name); + pr_warn("%s: overrun\n", c->dev->name); c->rx_overrun++; } if(stat&CRC_ERR) @@ -464,12 +466,12 @@ static void z8530_status(struct z8530_channel *chan) if (altered & chan->dcdcheck) { if (status & chan->dcdcheck) { - printk(KERN_INFO "%s: DCD raised\n", chan->dev->name); + pr_info("%s: DCD raised\n", chan->dev->name); write_zsreg(chan, R3, chan->regs[3] | RxENABLE); if (chan->netdevice) netif_carrier_on(chan->netdevice); } else { - printk(KERN_INFO "%s: DCD lost\n", chan->dev->name); + pr_info("%s: DCD lost\n", chan->dev->name); write_zsreg(chan, R3, chan->regs[3] & ~RxENABLE); z8530_flush_fifo(chan); if (chan->netdevice) @@ -538,12 +540,12 @@ static void z8530_dma_tx(struct z8530_channel *chan) { if(!chan->dma_tx) { - printk(KERN_WARNING "Hey who turned the DMA off?\n"); + pr_warn("Hey who turned the DMA off?\n"); z8530_tx(chan); return; } /* This shouldn't occur in DMA mode */ - printk(KERN_ERR "DMA tx - bogus event!\n"); + pr_err("DMA tx - bogus event!\n"); z8530_tx(chan); } @@ -585,12 +587,12 @@ static void z8530_dma_status(struct z8530_channel *chan) if (altered & chan->dcdcheck) { if (status & chan->dcdcheck) { - printk(KERN_INFO "%s: DCD raised\n", chan->dev->name); + pr_info("%s: DCD raised\n", chan->dev->name); write_zsreg(chan, R3, chan->regs[3] | RxENABLE); if (chan->netdevice) netif_carrier_on(chan->netdevice); } else { - printk(KERN_INFO "%s:DCD lost\n", chan->dev->name); + pr_info("%s: DCD lost\n", chan->dev->name); write_zsreg(chan, R3, chan->regs[3] & ~RxENABLE); z8530_flush_fifo(chan); if (chan->netdevice) @@ -712,7 +714,7 @@ irqreturn_t z8530_interrupt(int irq, void *dev_id) if(locker) { - printk(KERN_ERR "IRQ re-enter\n"); + pr_err("IRQ re-enter\n"); return IRQ_NONE; } locker=1; @@ -758,7 +760,8 @@ irqreturn_t z8530_interrupt(int irq, void *dev_id) } spin_unlock(&dev->lock); if(work==5000) - printk(KERN_ERR "%s: interrupt jammed - abort(0x%X)!\n", dev->name, intr); + pr_err("%s: interrupt jammed - abort(0x%X)!\n", + dev->name, intr); /* Ok all done */ locker=0; return IRQ_HANDLED; @@ -1225,7 +1228,7 @@ static const char *z8530_type_name[]={ void z8530_describe(struct z8530_dev *dev, char *mapping, unsigned long io) { - printk(KERN_INFO "%s: %s found at %s 0x%lX, IRQ %d.\n", + pr_info("%s: %s found at %s 0x%lX, IRQ %d\n", dev->name, z8530_type_name[dev->type], mapping, @@ -1621,8 +1624,7 @@ static void z8530_rx_done(struct z8530_channel *c) else /* Can't occur as we dont reenable the DMA irq until after the flip is done */ - printk(KERN_WARNING "%s: DMA flip overrun!\n", - c->netdevice->name); + netdev_warn(c->netdevice, "DMA flip overrun!\n"); release_dma_lock(flags); @@ -1637,8 +1639,7 @@ static void z8530_rx_done(struct z8530_channel *c) skb = dev_alloc_skb(ct); if (skb == NULL) { c->netdevice->stats.rx_dropped++; - printk(KERN_WARNING "%s: Memory squeeze.\n", - c->netdevice->name); + netdev_warn(c->netdevice, "Memory squeeze\n"); } else { skb_put(skb, ct); skb_copy_to_linear_data(skb, rxb, ct); @@ -1678,8 +1679,7 @@ static void z8530_rx_done(struct z8530_channel *c) c->skb2 = dev_alloc_skb(c->mtu); if (c->skb2 == NULL) - printk(KERN_WARNING "%s: memory squeeze.\n", - c->netdevice->name); + netdev_warn(c->netdevice, "memory squeeze\n"); else skb_put(c->skb2, c->mtu); c->netdevice->stats.rx_packets++; @@ -1693,7 +1693,7 @@ static void z8530_rx_done(struct z8530_channel *c) c->rx_function(c, skb); } else { c->netdevice->stats.rx_dropped++; - printk(KERN_ERR "%s: Lost a frame\n", c->netdevice->name); + netdev_err(c->netdevice, "Lost a frame\n"); } } |