1
0
Fork 0

generic_hdlc: Update to current logging forms

Use pr_fmt, pr_<level> and netdev_<level> as appropriate.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
hifive-unleashed-5.1
Joe Perches 2011-06-26 19:01:28 +00:00 committed by David S. Miller
parent 2903dd654d
commit 12a3bfefc8
12 changed files with 186 additions and 211 deletions

View File

@ -14,6 +14,8 @@
* Moxa C101 User's Manual * Moxa C101 User's Manual
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/capability.h> #include <linux/capability.h>
@ -313,44 +315,44 @@ static int __init c101_run(unsigned long irq, unsigned long winbase)
int result; int result;
if (irq<3 || irq>15 || irq == 6) /* FIXME */ { if (irq<3 || irq>15 || irq == 6) /* FIXME */ {
printk(KERN_ERR "c101: invalid IRQ value\n"); pr_err("invalid IRQ value\n");
return -ENODEV; return -ENODEV;
} }
if (winbase < 0xC0000 || winbase > 0xDFFFF || (winbase & 0x3FFF) !=0) { if (winbase < 0xC0000 || winbase > 0xDFFFF || (winbase & 0x3FFF) !=0) {
printk(KERN_ERR "c101: invalid RAM value\n"); pr_err("invalid RAM value\n");
return -ENODEV; return -ENODEV;
} }
card = kzalloc(sizeof(card_t), GFP_KERNEL); card = kzalloc(sizeof(card_t), GFP_KERNEL);
if (card == NULL) { if (card == NULL) {
printk(KERN_ERR "c101: unable to allocate memory\n"); pr_err("unable to allocate memory\n");
return -ENOBUFS; return -ENOBUFS;
} }
card->dev = alloc_hdlcdev(card); card->dev = alloc_hdlcdev(card);
if (!card->dev) { if (!card->dev) {
printk(KERN_ERR "c101: unable to allocate memory\n"); pr_err("unable to allocate memory\n");
kfree(card); kfree(card);
return -ENOBUFS; return -ENOBUFS;
} }
if (request_irq(irq, sca_intr, 0, devname, card)) { 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); c101_destroy_card(card);
return -EBUSY; return -EBUSY;
} }
card->irq = irq; card->irq = irq;
if (!request_mem_region(winbase, C101_MAPPED_RAM_SIZE, devname)) { 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); c101_destroy_card(card);
return -EBUSY; return -EBUSY;
} }
card->phy_winbase = winbase; card->phy_winbase = winbase;
card->win0base = ioremap(winbase, C101_MAPPED_RAM_SIZE); card->win0base = ioremap(winbase, C101_MAPPED_RAM_SIZE);
if (!card->win0base) { 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); c101_destroy_card(card);
return -EFAULT; return -EFAULT;
} }
@ -381,7 +383,7 @@ static int __init c101_run(unsigned long irq, unsigned long winbase)
result = register_hdlc_device(dev); result = register_hdlc_device(dev);
if (result) { if (result) {
printk(KERN_WARNING "c101: unable to register hdlc device\n"); pr_warn("unable to register hdlc device\n");
c101_destroy_card(card); c101_destroy_card(card);
return result; 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 */ sca_init_port(card); /* Set up C101 memory */
set_carrier(card); set_carrier(card);
printk(KERN_INFO "%s: Moxa C101 on IRQ%u," netdev_info(dev, "Moxa C101 on IRQ%u, using %u TX + %u RX packets rings\n",
" using %u TX + %u RX packets rings\n", card->irq, card->tx_ring_buffers, card->rx_ring_buffers);
dev->name, card->irq,
card->tx_ring_buffers, card->rx_ring_buffers);
*new_card = card; *new_card = card;
new_card = &card->next_card; new_card = &card->next_card;
@ -405,12 +405,12 @@ static int __init c101_init(void)
{ {
if (hw == NULL) { if (hw == NULL) {
#ifdef MODULE #ifdef MODULE
printk(KERN_INFO "c101: no card initialized\n"); pr_info("no card initialized\n");
#endif #endif
return -EINVAL; /* no parameters specified, abort */ return -EINVAL; /* no parameters specified, abort */
} }
printk(KERN_INFO "%s\n", version); pr_info("%s\n", version);
do { do {
unsigned long irq, ram; unsigned long irq, ram;
@ -428,7 +428,7 @@ static int __init c101_init(void)
return first_card ? 0 : -EINVAL; return first_card ? 0 : -EINVAL;
}while(*hw++ == ':'); }while(*hw++ == ':');
printk(KERN_ERR "c101: invalid hardware parameters\n"); pr_err("invalid hardware parameters\n");
return first_card ? 0 : -EINVAL; return first_card ? 0 : -EINVAL;
} }

View File

@ -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), port->rxin,
sca_in(DSR_RX(phy_node(port)), card) & DSR_DE ? "" : "in"); sca_in(DSR_RX(phy_node(port)), card) & DSR_DE ? "" : "in");
for (cnt = 0; cnt < port_to_card(port)->rx_ring_buffers; cnt++) for (cnt = 0; cnt < port_to_card(port)->rx_ring_buffers; cnt++)
printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat))); pr_cont(" %02X", readb(&(desc_address(port, cnt, 0)->stat)));
printk(KERN_CONT "\n"); pr_cont("\n");
printk(KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u " printk(KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u "
"last=%u %sactive", "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"); sca_in(DSR_TX(phy_node(port)), card) & DSR_DE ? "" : "in");
for (cnt = 0; cnt < port_to_card(port)->tx_ring_buffers; cnt++) for (cnt = 0; cnt < port_to_card(port)->tx_ring_buffers; cnt++)
printk(" %02X", readb(&(desc_address(port, cnt, 1)->stat))); pr_cont(" %02X", readb(&(desc_address(port, cnt, 1)->stat)));
printk("\n"); pr_cont("\n");
printk(KERN_DEBUG "MSCI: MD: %02x %02x %02x, ST: %02x %02x %02x %02x," printk(KERN_DEBUG "MSCI: MD: %02x %02x %02x, ST: %02x %02x %02x %02x,"
" FST: %02x CST: %02x %02x\n", " FST: %02x CST: %02x %02x\n",

View File

@ -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), port->rxin,
sca_in(DSR_RX(port->chan), card) & DSR_DE ? "" : "in"); sca_in(DSR_RX(port->chan), card) & DSR_DE ? "" : "in");
for (cnt = 0; cnt < port->card->rx_ring_buffers; cnt++) for (cnt = 0; cnt < port->card->rx_ring_buffers; cnt++)
printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat))); pr_cont(" %02X", readb(&(desc_address(port, cnt, 0)->stat)));
printk(KERN_CONT "\n"); pr_cont("\n");
printk(KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u " printk(KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u "
"last=%u %sactive", "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"); sca_in(DSR_TX(port->chan), card) & DSR_DE ? "" : "in");
for (cnt = 0; cnt < port->card->tx_ring_buffers; cnt++) for (cnt = 0; cnt < port->card->tx_ring_buffers; cnt++)
printk(" %02X", readb(&(desc_address(port, cnt, 1)->stat))); pr_cont(" %02X", readb(&(desc_address(port, cnt, 1)->stat)));
printk("\n"); pr_cont("\n");
printk(KERN_DEBUG "MSCI: MD: %02x %02x %02x," printk(KERN_DEBUG "MSCI: MD: %02x %02x %02x,"
" ST: %02x %02x %02x %02x %02x, FST: %02x CST: %02x %02x\n", " ST: %02x %02x %02x %02x %02x, FST: %02x CST: %02x %02x\n",

View File

@ -22,6 +22,8 @@
* - proto->start() and stop() are called with spin_lock_irq held. * - proto->start() and stop() are called with spin_lock_irq held.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/hdlc.h> #include <linux/hdlc.h>
#include <linux/if_arp.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; goto carrier_exit;
if (hdlc->carrier) { if (hdlc->carrier) {
printk(KERN_INFO "%s: Carrier detected\n", dev->name); netdev_info(dev, "Carrier detected\n");
hdlc_proto_start(dev); hdlc_proto_start(dev);
} else { } else {
printk(KERN_INFO "%s: Carrier lost\n", dev->name); netdev_info(dev, "Carrier lost\n");
hdlc_proto_stop(dev); hdlc_proto_stop(dev);
} }
@ -165,10 +167,10 @@ int hdlc_open(struct net_device *dev)
spin_lock_irq(&hdlc->state_lock); spin_lock_irq(&hdlc->state_lock);
if (hdlc->carrier) { if (hdlc->carrier) {
printk(KERN_INFO "%s: Carrier detected\n", dev->name); netdev_info(dev, "Carrier detected\n");
hdlc_proto_start(dev); hdlc_proto_start(dev);
} else } else
printk(KERN_INFO "%s: No carrier\n", dev->name); netdev_info(dev, "No carrier\n");
hdlc->open = 1; hdlc->open = 1;
@ -281,8 +283,8 @@ int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
if (size) if (size)
if ((dev_to_hdlc(dev)->state = kmalloc(size, if ((dev_to_hdlc(dev)->state = kmalloc(size,
GFP_KERNEL)) == NULL) { GFP_KERNEL)) == NULL) {
printk(KERN_WARNING "Memory squeeze on" netdev_warn(dev,
" hdlc_proto_attach()\n"); "Memory squeeze on hdlc_proto_attach()\n");
module_put(proto->module); module_put(proto->module);
return -ENOBUFS; return -ENOBUFS;
} }
@ -363,7 +365,7 @@ static int __init hdlc_module_init(void)
{ {
int result; int result;
printk(KERN_INFO "%s\n", version); pr_info("%s\n", version);
if ((result = register_netdevice_notifier(&hdlc_notifier)) != 0) if ((result = register_netdevice_notifier(&hdlc_notifier)) != 0)
return result; return result;
dev_add_pack(&hdlc_packet_type); dev_add_pack(&hdlc_packet_type);

View File

@ -103,9 +103,7 @@ static void cisco_keepalive_send(struct net_device *dev, u32 type,
skb = dev_alloc_skb(sizeof(struct hdlc_header) + skb = dev_alloc_skb(sizeof(struct hdlc_header) +
sizeof(struct cisco_packet)); sizeof(struct cisco_packet));
if (!skb) { if (!skb) {
printk(KERN_WARNING netdev_warn(dev, "Memory squeeze on cisco_keepalive_send()\n");
"%s: Memory squeeze on cisco_keepalive_send()\n",
dev->name);
return; return;
} }
skb_reserve(skb, 4); skb_reserve(skb, 4);
@ -181,8 +179,8 @@ static int cisco_rx(struct sk_buff *skb)
CISCO_PACKET_LEN) && CISCO_PACKET_LEN) &&
(skb->len != sizeof(struct hdlc_header) + (skb->len != sizeof(struct hdlc_header) +
CISCO_BIG_PACKET_LEN)) { CISCO_BIG_PACKET_LEN)) {
printk(KERN_INFO "%s: Invalid length of Cisco control" netdev_info(dev, "Invalid length of Cisco control packet (%d bytes)\n",
" packet (%d bytes)\n", dev->name, skb->len); skb->len);
goto rx_error; goto rx_error;
} }
@ -217,8 +215,7 @@ static int cisco_rx(struct sk_buff *skb)
return NET_RX_SUCCESS; return NET_RX_SUCCESS;
case CISCO_ADDR_REPLY: case CISCO_ADDR_REPLY:
printk(KERN_INFO "%s: Unexpected Cisco IP address " netdev_info(dev, "Unexpected Cisco IP address reply\n");
"reply\n", dev->name);
goto rx_error; goto rx_error;
case CISCO_KEEPALIVE_REQ: case CISCO_KEEPALIVE_REQ:
@ -235,9 +232,8 @@ static int cisco_rx(struct sk_buff *skb)
min = sec / 60; sec -= min * 60; min = sec / 60; sec -= min * 60;
hrs = min / 60; min -= hrs * 60; hrs = min / 60; min -= hrs * 60;
days = hrs / 24; hrs -= days * 24; days = hrs / 24; hrs -= days * 24;
printk(KERN_INFO "%s: Link up (peer " netdev_info(dev, "Link up (peer uptime %ud%uh%um%us)\n",
"uptime %ud%uh%um%us)\n", days, hrs, min, sec);
dev->name, days, hrs, min, sec);
netif_dormant_off(dev); netif_dormant_off(dev);
st->up = 1; st->up = 1;
} }
@ -249,8 +245,7 @@ static int cisco_rx(struct sk_buff *skb)
} /* switch (keepalive type) */ } /* switch (keepalive type) */
} /* switch (protocol) */ } /* switch (protocol) */
printk(KERN_INFO "%s: Unsupported protocol %x\n", dev->name, netdev_info(dev, "Unsupported protocol %x\n", ntohs(data->protocol));
ntohs(data->protocol));
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
return NET_RX_DROP; return NET_RX_DROP;
@ -272,7 +267,7 @@ static void cisco_timer(unsigned long arg)
if (st->up && if (st->up &&
time_after(jiffies, st->last_poll + st->settings.timeout * HZ)) { time_after(jiffies, st->last_poll + st->settings.timeout * HZ)) {
st->up = 0; st->up = 0;
printk(KERN_INFO "%s: Link down\n", dev->name); netdev_info(dev, "Link down\n");
netif_dormant_on(dev); netif_dormant_on(dev);
} }

View File

@ -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) static inline void fr_log_dlci_active(pvc_device *pvc)
{ {
printk(KERN_INFO "%s: DLCI %d [%s%s%s]%s %s\n", netdev_info(pvc->frad, "DLCI %d [%s%s%s]%s %s\n",
pvc->frad->name, pvc->dlci,
pvc->dlci, pvc->main ? pvc->main->name : "",
pvc->main ? pvc->main->name : "", pvc->main && pvc->ether ? " " : "",
pvc->main && pvc->ether ? " " : "", pvc->ether ? pvc->ether->name : "",
pvc->ether ? pvc->ether->name : "", pvc->state.new ? " new" : "",
pvc->state.new ? " new" : "", !pvc->state.exist ? "deleted" :
!pvc->state.exist ? "deleted" : pvc->state.active ? "active" : "inactive");
pvc->state.active ? "active" : "inactive");
} }
@ -481,16 +480,14 @@ static void fr_lmi_send(struct net_device *dev, int fullrep)
if (dce && fullrep) { if (dce && fullrep) {
len += state(hdlc)->dce_pvc_count * (2 + stat_len); len += state(hdlc)->dce_pvc_count * (2 + stat_len);
if (len > HDLC_MAX_MRU) { if (len > HDLC_MAX_MRU) {
printk(KERN_WARNING "%s: Too many PVCs while sending " netdev_warn(dev, "Too many PVCs while sending LMI full report\n");
"LMI full report\n", dev->name);
return; return;
} }
} }
skb = dev_alloc_skb(len); skb = dev_alloc_skb(len);
if (!skb) { if (!skb) {
printk(KERN_WARNING "%s: Memory squeeze on fr_lmi_send()\n", netdev_warn(dev, "Memory squeeze on fr_lmi_send()\n");
dev->name);
return; return;
} }
memset(skb->data, 0, len); memset(skb->data, 0, len);
@ -615,8 +612,7 @@ static void fr_timer(unsigned long arg)
state(hdlc)->last_errors <<= 1; /* Shift the list */ state(hdlc)->last_errors <<= 1; /* Shift the list */
if (state(hdlc)->request) { if (state(hdlc)->request) {
if (state(hdlc)->reliable) if (state(hdlc)->reliable)
printk(KERN_INFO "%s: No LMI status reply " netdev_info(dev, "No LMI status reply received\n");
"received\n", dev->name);
state(hdlc)->last_errors |= 1; state(hdlc)->last_errors |= 1;
} }
@ -628,8 +624,7 @@ static void fr_timer(unsigned long arg)
} }
if (state(hdlc)->reliable != reliable) { if (state(hdlc)->reliable != reliable) {
printk(KERN_INFO "%s: Link %sreliable\n", dev->name, netdev_info(dev, "Link %sreliable\n", reliable ? "" : "un");
reliable ? "" : "un");
fr_set_link_state(reliable, dev); 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 : if (skb->len < (lmi == LMI_ANSI ? LMI_ANSI_LENGTH :
LMI_CCITT_CISCO_LENGTH)) { LMI_CCITT_CISCO_LENGTH)) {
printk(KERN_INFO "%s: Short LMI frame\n", dev->name); netdev_info(dev, "Short LMI frame\n");
return 1; return 1;
} }
if (skb->data[3] != (lmi == LMI_CISCO ? NLPID_CISCO_LMI : if (skb->data[3] != (lmi == LMI_CISCO ? NLPID_CISCO_LMI :
NLPID_CCITT_ANSI_LMI)) { NLPID_CCITT_ANSI_LMI)) {
printk(KERN_INFO "%s: Received non-LMI frame with LMI DLCI\n", netdev_info(dev, "Received non-LMI frame with LMI DLCI\n");
dev->name);
return 1; return 1;
} }
if (skb->data[4] != LMI_CALLREF) { if (skb->data[4] != LMI_CALLREF) {
printk(KERN_INFO "%s: Invalid LMI Call reference (0x%02X)\n", netdev_info(dev, "Invalid LMI Call reference (0x%02X)\n",
dev->name, skb->data[4]); skb->data[4]);
return 1; return 1;
} }
if (skb->data[5] != (dce ? LMI_STATUS_ENQUIRY : LMI_STATUS)) { if (skb->data[5] != (dce ? LMI_STATUS_ENQUIRY : LMI_STATUS)) {
printk(KERN_INFO "%s: Invalid LMI Message type (0x%02X)\n", netdev_info(dev, "Invalid LMI Message type (0x%02X)\n",
dev->name, skb->data[5]); skb->data[5]);
return 1; return 1;
} }
if (lmi == LMI_ANSI) { if (lmi == LMI_ANSI) {
if (skb->data[6] != LMI_ANSI_LOCKSHIFT) { if (skb->data[6] != LMI_ANSI_LOCKSHIFT) {
printk(KERN_INFO "%s: Not ANSI locking shift in LMI" netdev_info(dev, "Not ANSI locking shift in LMI message (0x%02X)\n",
" message (0x%02X)\n", dev->name, skb->data[6]); skb->data[6]);
return 1; return 1;
} }
i = 7; 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 : if (skb->data[i] != (lmi == LMI_CCITT ? LMI_CCITT_REPTYPE :
LMI_ANSI_CISCO_REPTYPE)) { LMI_ANSI_CISCO_REPTYPE)) {
printk(KERN_INFO "%s: Not an LMI Report type IE (0x%02X)\n", netdev_info(dev, "Not an LMI Report type IE (0x%02X)\n",
dev->name, skb->data[i]); skb->data[i]);
return 1; return 1;
} }
if (skb->data[++i] != LMI_REPT_LEN) { if (skb->data[++i] != LMI_REPT_LEN) {
printk(KERN_INFO "%s: Invalid LMI Report type IE length" netdev_info(dev, "Invalid LMI Report type IE length (%u)\n",
" (%u)\n", dev->name, skb->data[i]); skb->data[i]);
return 1; return 1;
} }
reptype = skb->data[++i]; reptype = skb->data[++i];
if (reptype != LMI_INTEGRITY && reptype != LMI_FULLREP) { if (reptype != LMI_INTEGRITY && reptype != LMI_FULLREP) {
printk(KERN_INFO "%s: Unsupported LMI Report type (0x%02X)\n", netdev_info(dev, "Unsupported LMI Report type (0x%02X)\n",
dev->name, reptype); reptype);
return 1; return 1;
} }
if (skb->data[++i] != (lmi == LMI_CCITT ? LMI_CCITT_ALIVE : if (skb->data[++i] != (lmi == LMI_CCITT ? LMI_CCITT_ALIVE :
LMI_ANSI_CISCO_ALIVE)) { LMI_ANSI_CISCO_ALIVE)) {
printk(KERN_INFO "%s: Not an LMI Link integrity verification" netdev_info(dev, "Not an LMI Link integrity verification IE (0x%02X)\n",
" IE (0x%02X)\n", dev->name, skb->data[i]); skb->data[i]);
return 1; return 1;
} }
if (skb->data[++i] != LMI_INTEG_LEN) { if (skb->data[++i] != LMI_INTEG_LEN) {
printk(KERN_INFO "%s: Invalid LMI Link integrity verification" netdev_info(dev, "Invalid LMI Link integrity verification IE length (%u)\n",
" IE length (%u)\n", dev->name, skb->data[i]); skb->data[i]);
return 1; return 1;
} }
i++; 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 : if (skb->data[i] != (lmi == LMI_CCITT ? LMI_CCITT_PVCSTAT :
LMI_ANSI_CISCO_PVCSTAT)) { LMI_ANSI_CISCO_PVCSTAT)) {
printk(KERN_INFO "%s: Not an LMI PVC status IE" netdev_info(dev, "Not an LMI PVC status IE (0x%02X)\n",
" (0x%02X)\n", dev->name, skb->data[i]); skb->data[i]);
return 1; return 1;
} }
if (skb->data[++i] != stat_len) { if (skb->data[++i] != stat_len) {
printk(KERN_INFO "%s: Invalid LMI PVC status IE length" netdev_info(dev, "Invalid LMI PVC status IE length (%u)\n",
" (%u)\n", dev->name, skb->data[i]); skb->data[i]);
return 1; return 1;
} }
i++; i++;
@ -829,9 +823,7 @@ static int fr_lmi_recv(struct net_device *dev, struct sk_buff *skb)
pvc = add_pvc(dev, dlci); pvc = add_pvc(dev, dlci);
if (!pvc && !no_ram) { if (!pvc && !no_ram) {
printk(KERN_WARNING netdev_warn(dev, "Memory squeeze on fr_lmi_recv()\n");
"%s: Memory squeeze on fr_lmi_recv()\n",
dev->name);
no_ram = 1; no_ram = 1;
} }
@ -902,8 +894,8 @@ static int fr_rx(struct sk_buff *skb)
pvc = find_pvc(hdlc, dlci); pvc = find_pvc(hdlc, dlci);
if (!pvc) { if (!pvc) {
#ifdef DEBUG_PKT #ifdef DEBUG_PKT
printk(KERN_INFO "%s: No PVC for received frame's DLCI %d\n", netdev_info(frad, "No PVC for received frame's DLCI %d\n",
frad->name, dlci); dlci);
#endif #endif
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
return NET_RX_DROP; return NET_RX_DROP;
@ -962,14 +954,14 @@ static int fr_rx(struct sk_buff *skb)
break; break;
default: default:
printk(KERN_INFO "%s: Unsupported protocol, OUI=%x " netdev_info(frad, "Unsupported protocol, OUI=%x PID=%x\n",
"PID=%x\n", frad->name, oui, pid); oui, pid);
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
return NET_RX_DROP; return NET_RX_DROP;
} }
} else { } else {
printk(KERN_INFO "%s: Unsupported protocol, NLPID=%x " netdev_info(frad, "Unsupported protocol, NLPID=%x length=%i\n",
"length = %i\n", frad->name, data[3], skb->len); data[3], skb->len);
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
return NET_RX_DROP; return NET_RX_DROP;
} }
@ -1073,8 +1065,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
int used; int used;
if ((pvc = add_pvc(frad, dlci)) == NULL) { if ((pvc = add_pvc(frad, dlci)) == NULL) {
printk(KERN_WARNING "%s: Memory squeeze on fr_add_pvc()\n", netdev_warn(frad, "Memory squeeze on fr_add_pvc()\n");
frad->name);
return -ENOBUFS; 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); dev = alloc_netdev(0, "pvc%d", pvc_setup);
if (!dev) { if (!dev) {
printk(KERN_WARNING "%s: Memory squeeze on fr_pvc()\n", netdev_warn(frad, "Memory squeeze on fr_pvc()\n");
frad->name);
delete_unused_pvcs(hdlc); delete_unused_pvcs(hdlc);
return -ENOBUFS; return -ENOBUFS;
} }

View File

@ -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) + skb = dev_alloc_skb(sizeof(struct hdlc_header) +
sizeof(struct cp_header) + magic_len + len); sizeof(struct cp_header) + magic_len + len);
if (!skb) { if (!skb) {
printk(KERN_WARNING "%s: out of memory in ppp_tx_cp()\n", netdev_warn(dev, "out of memory in ppp_tx_cp()\n");
dev->name);
return; return;
} }
skb_reserve(skb, sizeof(struct hdlc_header)); 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); ppp_tx_cp(dev, pid, CP_CODE_REJ, ++ppp->seq, len, data);
if (old_state != OPENED && proto->state == OPENED) { 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) { if (pid == PID_LCP) {
netif_dormant_off(dev); netif_dormant_off(dev);
ppp_cp_event(dev, PID_IPCP, START, 0, 0, 0, NULL); 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) { 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) { if (pid == PID_LCP) {
netif_dormant_on(dev); netif_dormant_on(dev);
ppp_cp_event(dev, PID_IPCP, STOP, 0, 0, 0, NULL); ppp_cp_event(dev, PID_IPCP, STOP, 0, 0, 0, NULL);
@ -585,7 +584,7 @@ static void ppp_timer(unsigned long arg)
break; break;
if (time_after(jiffies, ppp->last_pong + if (time_after(jiffies, ppp->last_pong +
ppp->keepalive_timeout * HZ)) { 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, STOP, 0, 0, 0, NULL);
ppp_cp_event(proto->dev, PID_LCP, START, 0, 0, 0, NULL); ppp_cp_event(proto->dev, PID_LCP, START, 0, 0, 0, NULL);
} else { /* send keep-alive packet */ } else { /* send keep-alive packet */

View File

@ -34,7 +34,7 @@ static void x25_connect_disconnect(struct net_device *dev, int reason, int code)
unsigned char *ptr; unsigned char *ptr;
if ((skb = dev_alloc_skb(1)) == NULL) { 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; 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 */ /* Send connect confirm. msg to level 3 */
x25_connected(dev, 0); x25_connected(dev, 0);
else else
printk(KERN_ERR "%s: LAPB connect request " netdev_err(dev, "LAPB connect request failed, error code = %i\n",
"failed, error code = %i\n", result);
dev->name, result);
} }
break; 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 */ /* Send disconnect confirm. msg to level 3 */
x25_disconnected(dev, 0); x25_disconnected(dev, 0);
else else
printk(KERN_ERR "%s: LAPB disconnect request " netdev_err(dev, "LAPB disconnect request failed, error code = %i\n",
"failed, error code = %i\n", result);
dev->name, result);
} }
break; break;

View File

@ -16,6 +16,8 @@
* SDL Inc. PPP/HDLC/CISCO driver * SDL Inc. PPP/HDLC/CISCO driver
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/capability.h> #include <linux/capability.h>
@ -341,57 +343,57 @@ static int __init n2_run(unsigned long io, unsigned long irq,
int i; int i;
if (io < 0x200 || io > 0x3FF || (io % N2_IOPORTS) != 0) { 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; return -ENODEV;
} }
if (irq < 3 || irq > 15 || irq == 6) /* FIXME */ { if (irq < 3 || irq > 15 || irq == 6) /* FIXME */ {
printk(KERN_ERR "n2: invalid IRQ value\n"); pr_err("invalid IRQ value\n");
return -ENODEV; return -ENODEV;
} }
if (winbase < 0xA0000 || winbase > 0xFFFFF || (winbase & 0xFFF) != 0) { if (winbase < 0xA0000 || winbase > 0xFFFFF || (winbase & 0xFFF) != 0) {
printk(KERN_ERR "n2: invalid RAM value\n"); pr_err("invalid RAM value\n");
return -ENODEV; return -ENODEV;
} }
card = kzalloc(sizeof(card_t), GFP_KERNEL); card = kzalloc(sizeof(card_t), GFP_KERNEL);
if (card == NULL) { if (card == NULL) {
printk(KERN_ERR "n2: unable to allocate memory\n"); pr_err("unable to allocate memory\n");
return -ENOBUFS; return -ENOBUFS;
} }
card->ports[0].dev = alloc_hdlcdev(&card->ports[0]); card->ports[0].dev = alloc_hdlcdev(&card->ports[0]);
card->ports[1].dev = alloc_hdlcdev(&card->ports[1]); card->ports[1].dev = alloc_hdlcdev(&card->ports[1]);
if (!card->ports[0].dev || !card->ports[1].dev) { 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); n2_destroy_card(card);
return -ENOMEM; return -ENOMEM;
} }
if (!request_region(io, N2_IOPORTS, devname)) { 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); n2_destroy_card(card);
return -EBUSY; return -EBUSY;
} }
card->io = io; card->io = io;
if (request_irq(irq, sca_intr, 0, devname, card)) { 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); n2_destroy_card(card);
return -EBUSY; return -EBUSY;
} }
card->irq = irq; card->irq = irq;
if (!request_mem_region(winbase, USE_WINDOWSIZE, devname)) { 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); n2_destroy_card(card);
return -EBUSY; return -EBUSY;
} }
card->phy_winbase = winbase; card->phy_winbase = winbase;
card->winbase = ioremap(winbase, USE_WINDOWSIZE); card->winbase = ioremap(winbase, USE_WINDOWSIZE);
if (!card->winbase) { if (!card->winbase) {
printk(KERN_ERR "n2: ioremap() failed\n"); pr_err("ioremap() failed\n");
n2_destroy_card(card); n2_destroy_card(card);
return -EFAULT; return -EFAULT;
} }
@ -413,7 +415,7 @@ static int __init n2_run(unsigned long io, unsigned long irq,
break; break;
default: default:
printk(KERN_ERR "n2: invalid window size\n"); pr_err("invalid window size\n");
n2_destroy_card(card); n2_destroy_card(card);
return -ENODEV; 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->buff_offset = (valid0 + valid1) * sizeof(pkt_desc) *
(card->tx_ring_buffers + card->rx_ring_buffers); (card->tx_ring_buffers + card->rx_ring_buffers);
printk(KERN_INFO "n2: RISCom/N2 %u KB RAM, IRQ%u, " pr_info("RISCom/N2 %u KB RAM, IRQ%u, using %u TX + %u RX packets rings\n",
"using %u TX + %u RX packets rings\n", card->ram_size / 1024, card->ram_size / 1024, card->irq,
card->irq, card->tx_ring_buffers, card->rx_ring_buffers); card->tx_ring_buffers, card->rx_ring_buffers);
if (card->tx_ring_buffers < 1) { if (card->tx_ring_buffers < 1) {
printk(KERN_ERR "n2: RAM test failed\n"); pr_err("RAM test failed\n");
n2_destroy_card(card); n2_destroy_card(card);
return -EIO; return -EIO;
} }
@ -474,16 +476,14 @@ static int __init n2_run(unsigned long io, unsigned long irq,
port->card = card; port->card = card;
if (register_hdlc_device(dev)) { if (register_hdlc_device(dev)) {
printk(KERN_WARNING "n2: unable to register hdlc " pr_warn("unable to register hdlc device\n");
"device\n");
port->card = NULL; port->card = NULL;
n2_destroy_card(card); n2_destroy_card(card);
return -ENOBUFS; return -ENOBUFS;
} }
sca_init_port(port); /* Set up SCA memory */ sca_init_port(port); /* Set up SCA memory */
printk(KERN_INFO "%s: RISCom/N2 node %d\n", netdev_info(dev, "RISCom/N2 node %d\n", port->phy_node);
dev->name, port->phy_node);
} }
*new_card = card; *new_card = card;
@ -498,12 +498,12 @@ static int __init n2_init(void)
{ {
if (hw==NULL) { if (hw==NULL) {
#ifdef MODULE #ifdef MODULE
printk(KERN_INFO "n2: no card initialized\n"); pr_info("no card initialized\n");
#endif #endif
return -EINVAL; /* no parameters specified, abort */ return -EINVAL; /* no parameters specified, abort */
} }
printk(KERN_INFO "%s\n", version); pr_info("%s\n", version);
do { do {
unsigned long io, irq, ram; unsigned long io, irq, ram;
@ -541,7 +541,7 @@ static int __init n2_init(void)
return first_card ? 0 : -EINVAL; return first_card ? 0 : -EINVAL;
}while(*hw++ == ':'); }while(*hw++ == ':');
printk(KERN_ERR "n2: invalid hardware parameters\n"); pr_err("invalid hardware parameters\n");
return first_card ? 0 : -EINVAL; return first_card ? 0 : -EINVAL;
} }

View File

@ -17,6 +17,8 @@
* PC300/X21 cards. * PC300/X21 cards.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/slab.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); card = kzalloc(sizeof(card_t), GFP_KERNEL);
if (card == NULL) { if (card == NULL) {
printk(KERN_ERR "pc300: unable to allocate memory\n"); pr_err("unable to allocate memory\n");
pci_release_regions(pdev); pci_release_regions(pdev);
pci_disable_device(pdev); pci_disable_device(pdev);
return -ENOBUFS; 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 || if (pci_resource_len(pdev, 0) != PC300_PLX_SIZE ||
pci_resource_len(pdev, 2) != PC300_SCA_SIZE || pci_resource_len(pdev, 2) != PC300_SCA_SIZE ||
pci_resource_len(pdev, 3) < 16384) { 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); pc300_pci_remove_one(pdev);
return -EFAULT; return -EFAULT;
} }
@ -345,7 +347,7 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev,
if (card->plxbase == NULL || if (card->plxbase == NULL ||
card->scabase == NULL || card->scabase == NULL ||
card->rambase == NULL) { card->rambase == NULL) {
printk(KERN_ERR "pc300: ioremap() failed\n"); pr_err("ioremap() failed\n");
pc300_pci_remove_one(pdev); 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++) for (i = 0; i < card->n_ports; i++)
if (!(card->ports[i].netdev = alloc_hdlcdev(&card->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); pc300_pci_remove_one(pdev);
return -ENOMEM; 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->buff_offset = card->n_ports * sizeof(pkt_desc) *
(card->tx_ring_buffers + card->rx_ring_buffers); (card->tx_ring_buffers + card->rx_ring_buffers);
printk(KERN_INFO "pc300: PC300/%s, %u KB RAM at 0x%x, IRQ%u, " pr_info("PC300/%s, %u KB RAM at 0x%x, IRQ%u, using %u TX + %u RX packets rings\n",
"using %u TX + %u RX packets rings\n", card->type == PC300_X21 ? "X21" :
card->type == PC300_X21 ? "X21" : card->type == PC300_TE ? "TE" : "RSV",
card->type == PC300_TE ? "TE" : "RSV", ramsize / 1024, ramphys, pdev->irq,
ramsize / 1024, ramphys, pdev->irq, card->tx_ring_buffers, card->rx_ring_buffers);
card->tx_ring_buffers, card->rx_ring_buffers);
if (card->tx_ring_buffers < 1) { 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); pc300_pci_remove_one(pdev);
return -EFAULT; return -EFAULT;
} }
@ -429,8 +430,7 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev,
/* Allocate IRQ */ /* Allocate IRQ */
if (request_irq(pdev->irq, sca_intr, IRQF_SHARED, "pc300", card)) { if (request_irq(pdev->irq, sca_intr, IRQF_SHARED, "pc300", card)) {
printk(KERN_WARNING "pc300: could not allocate IRQ%d.\n", pr_warn("could not allocate IRQ%d\n", pdev->irq);
pdev->irq);
pc300_pci_remove_one(pdev); pc300_pci_remove_one(pdev);
return -EBUSY; return -EBUSY;
} }
@ -466,15 +466,13 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev,
sca_init_port(port); sca_init_port(port);
if (register_hdlc_device(dev)) { if (register_hdlc_device(dev)) {
printk(KERN_ERR "pc300: unable to register hdlc " pr_err("unable to register hdlc device\n");
"device\n");
port->card = NULL; port->card = NULL;
pc300_pci_remove_one(pdev); pc300_pci_remove_one(pdev);
return -ENOBUFS; return -ENOBUFS;
} }
printk(KERN_INFO "%s: PC300 channel %d\n", netdev_info(dev, "PC300 channel %d\n", port->chan);
dev->name, port->chan);
} }
return 0; return 0;
} }
@ -505,11 +503,11 @@ static struct pci_driver pc300_pci_driver = {
static int __init pc300_init_module(void) static int __init pc300_init_module(void)
{ {
if (pci_clock_freq < 1000000 || pci_clock_freq > 80000000) { 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; return -EINVAL;
} }
if (use_crystal_clock != 0 && use_crystal_clock != 1) { 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; return -EINVAL;
} }

View File

@ -14,6 +14,8 @@
* PLX Technology Inc. PCI9052 Data Book * PLX Technology Inc. PCI9052 Data Book
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/capability.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); card = kzalloc(sizeof(card_t), GFP_KERNEL);
if (card == NULL) { if (card == NULL) {
printk(KERN_ERR "pci200syn: unable to allocate memory\n"); pr_err("unable to allocate memory\n");
pci_release_regions(pdev); pci_release_regions(pdev);
pci_disable_device(pdev); pci_disable_device(pdev);
return -ENOBUFS; 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[0].netdev = alloc_hdlcdev(&card->ports[0]);
card->ports[1].netdev = alloc_hdlcdev(&card->ports[1]); card->ports[1].netdev = alloc_hdlcdev(&card->ports[1]);
if (!card->ports[0].netdev || !card->ports[1].netdev) { 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); pci200_pci_remove_one(pdev);
return -ENOMEM; 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 || if (pci_resource_len(pdev, 0) != PCI200SYN_PLX_SIZE ||
pci_resource_len(pdev, 2) != PCI200SYN_SCA_SIZE || pci_resource_len(pdev, 2) != PCI200SYN_SCA_SIZE ||
pci_resource_len(pdev, 3) < 16384) { 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); pci200_pci_remove_one(pdev);
return -EFAULT; return -EFAULT;
} }
@ -331,7 +333,7 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev,
if (card->plxbase == NULL || if (card->plxbase == NULL ||
card->scabase == NULL || card->scabase == NULL ||
card->rambase == NULL) { card->rambase == NULL) {
printk(KERN_ERR "pci200syn: ioremap() failed\n"); pr_err("ioremap() failed\n");
pci200_pci_remove_one(pdev); pci200_pci_remove_one(pdev);
return -EFAULT; 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->buff_offset = 2 * sizeof(pkt_desc) * (card->tx_ring_buffers +
card->rx_ring_buffers); card->rx_ring_buffers);
printk(KERN_INFO "pci200syn: %u KB RAM at 0x%x, IRQ%u, using %u TX +" pr_info("%u KB RAM at 0x%x, IRQ%u, using %u TX + %u RX packets rings\n",
" %u RX packets rings\n", ramsize / 1024, ramphys, ramsize / 1024, ramphys,
pdev->irq, card->tx_ring_buffers, card->rx_ring_buffers); pdev->irq, card->tx_ring_buffers, card->rx_ring_buffers);
if (card->tx_ring_buffers < 1) { 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); pci200_pci_remove_one(pdev);
return -EFAULT; return -EFAULT;
} }
@ -373,8 +375,7 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev,
/* Allocate IRQ */ /* Allocate IRQ */
if (request_irq(pdev->irq, sca_intr, IRQF_SHARED, "pci200syn", card)) { if (request_irq(pdev->irq, sca_intr, IRQF_SHARED, "pci200syn", card)) {
printk(KERN_WARNING "pci200syn: could not allocate IRQ%d.\n", pr_warn("could not allocate IRQ%d\n", pdev->irq);
pdev->irq);
pci200_pci_remove_one(pdev); pci200_pci_remove_one(pdev);
return -EBUSY; return -EBUSY;
} }
@ -400,15 +401,13 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev,
port->card = card; port->card = card;
sca_init_port(port); sca_init_port(port);
if (register_hdlc_device(dev)) { if (register_hdlc_device(dev)) {
printk(KERN_ERR "pci200syn: unable to register hdlc " pr_err("unable to register hdlc device\n");
"device\n");
port->card = NULL; port->card = NULL;
pci200_pci_remove_one(pdev); pci200_pci_remove_one(pdev);
return -ENOBUFS; return -ENOBUFS;
} }
printk(KERN_INFO "%s: PCI200SYN channel %d\n", netdev_info(dev, "PCI200SYN channel %d\n", port->chan);
dev->name, port->chan);
} }
sca_flush(card); sca_flush(card);
@ -435,7 +434,7 @@ static struct pci_driver pci200_pci_driver = {
static int __init pci200_init_module(void) static int __init pci200_init_module(void)
{ {
if (pci_clock_freq < 1000000 || pci_clock_freq > 80000000) { 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 -EINVAL;
} }
return pci_register_driver(&pci200_pci_driver); return pci_register_driver(&pci200_pci_driver);

View File

@ -13,6 +13,8 @@
* - wanXL100 will require minor driver modifications, no access to hw * - wanXL100 will require minor driver modifications, no access to hw
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/slab.h> #include <linux/slab.h>
@ -102,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); dma_addr_t addr = pci_map_single(pdev, ptr, size, direction);
if (addr + size > 0x100000000LL) if (addr + size > 0x100000000LL)
printk(KERN_CRIT "wanXL %s: pci_map_single() returned memory" pr_crit("%s: pci_map_single() returned memory at 0x%llx!\n",
" at 0x%LX!\n", pci_name(pdev), pci_name(pdev), (unsigned long long)addr);
(unsigned long long)addr);
return addr; return addr;
} }
@ -147,8 +148,8 @@ static inline void wanxl_cable_intr(port_t *port)
} }
dte = (value & STATUS_CABLE_DCE) ? " DCE" : " DTE"; dte = (value & STATUS_CABLE_DCE) ? " DCE" : " DTE";
} }
printk(KERN_INFO "%s: %s%s module, %s cable%s%s\n", netdev_info(port->dev, "%s%s module, %s cable%s%s\n",
port->dev->name, pm, dte, cable, dsr, dcd); pm, dte, cable, dsr, dcd);
if (value & STATUS_CABLE_DCD) if (value & STATUS_CABLE_DCD)
netif_carrier_on(port->dev); netif_carrier_on(port->dev);
@ -198,8 +199,8 @@ static inline void wanxl_rx_intr(card_t *card)
while (desc = &card->status->rx_descs[card->rx_in], while (desc = &card->status->rx_descs[card->rx_in],
desc->stat != PACKET_EMPTY) { desc->stat != PACKET_EMPTY) {
if ((desc->stat & PACKET_PORT_MASK) > card->n_ports) if ((desc->stat & PACKET_PORT_MASK) > card->n_ports)
printk(KERN_CRIT "wanXL %s: received packet for" pr_crit("%s: received packet for nonexistent port\n",
" nonexistent port\n", pci_name(card->pdev)); pci_name(card->pdev));
else { else {
struct sk_buff *skb = card->rx_skbs[card->rx_in]; struct sk_buff *skb = card->rx_skbs[card->rx_in];
port_t *port = &card->ports[desc->stat & port_t *port = &card->ports[desc->stat &
@ -397,7 +398,7 @@ static int wanxl_open(struct net_device *dev)
int i; int i;
if (get_status(port)->open) { if (get_status(port)->open) {
printk(KERN_ERR "%s: port already open\n", dev->name); netdev_err(dev, "port already open\n");
return -EIO; return -EIO;
} }
if ((i = hdlc_open(dev)) != 0) if ((i = hdlc_open(dev)) != 0)
@ -417,7 +418,7 @@ static int wanxl_open(struct net_device *dev)
} }
} while (time_after(timeout, jiffies)); } 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 */ /* ask the card to close the port, should it be still alive */
writel(1 << (DOORBELL_TO_CARD_CLOSE_0 + port->node), dbr); writel(1 << (DOORBELL_TO_CARD_CLOSE_0 + port->node), dbr);
return -EFAULT; return -EFAULT;
@ -443,7 +444,7 @@ static int wanxl_close(struct net_device *dev)
} while (time_after(timeout, jiffies)); } while (time_after(timeout, jiffies));
if (get_status(port)->open) 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); netif_stop_queue(dev);
@ -568,11 +569,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
int i, ports, alloc_size; int i, ports, alloc_size;
#ifndef MODULE #ifndef MODULE
static int printed_version; pr_info_once("%s\n", version);
if (!printed_version) {
printed_version++;
printk(KERN_INFO "%s\n", version);
}
#endif #endif
i = pci_enable_device(pdev); i = pci_enable_device(pdev);
@ -588,7 +585,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
work on most platforms */ work on most platforms */
if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(28)) || if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(28)) ||
pci_set_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; return -EIO;
} }
@ -607,8 +604,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
alloc_size = sizeof(card_t) + ports * sizeof(port_t); alloc_size = sizeof(card_t) + ports * sizeof(port_t);
card = kzalloc(alloc_size, GFP_KERNEL); card = kzalloc(alloc_size, GFP_KERNEL);
if (card == NULL) { if (card == NULL) {
printk(KERN_ERR "wanXL %s: unable to allocate memory\n", pr_err("%s: unable to allocate memory\n", pci_name(pdev));
pci_name(pdev));
pci_release_regions(pdev); pci_release_regions(pdev);
pci_disable_device(pdev); pci_disable_device(pdev);
return -ENOBUFS; return -ENOBUFS;
@ -635,7 +631,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
to indicate the card can do 32-bit DMA addressing */ to indicate the card can do 32-bit DMA addressing */
if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)) || if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)) ||
pci_set_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); wanxl_pci_remove_one(pdev);
return -EIO; return -EIO;
} }
@ -645,7 +641,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
card->plx = ioremap_nocache(plx_phy, 0x70); card->plx = ioremap_nocache(plx_phy, 0x70);
if (!card->plx) { if (!card->plx) {
printk(KERN_ERR "wanxl: ioremap() failed\n"); pr_err("ioremap() failed\n");
wanxl_pci_remove_one(pdev); wanxl_pci_remove_one(pdev);
return -EFAULT; return -EFAULT;
} }
@ -657,8 +653,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
timeout = jiffies + 20 * HZ; timeout = jiffies + 20 * HZ;
while ((stat = readl(card->plx + PLX_MAILBOX_0)) != 0) { while ((stat = readl(card->plx + PLX_MAILBOX_0)) != 0) {
if (time_before(timeout, jiffies)) { if (time_before(timeout, jiffies)) {
printk(KERN_WARNING "wanXL %s: timeout waiting for" pr_warn("%s: timeout waiting for PUTS to complete\n",
" PUTS to complete\n", pci_name(pdev)); pci_name(pdev));
wanxl_pci_remove_one(pdev); wanxl_pci_remove_one(pdev);
return -ENODEV; return -ENODEV;
} }
@ -669,8 +665,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
break; break;
default: default:
printk(KERN_WARNING "wanXL %s: PUTS test 0x%X" pr_warn("%s: PUTS test 0x%X failed\n",
" failed\n", pci_name(pdev), stat & 0x30); pci_name(pdev), stat & 0x30);
wanxl_pci_remove_one(pdev); wanxl_pci_remove_one(pdev);
return -ENODEV; return -ENODEV;
} }
@ -688,17 +684,16 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
/* sanity check the board's reported memory size */ /* sanity check the board's reported memory size */
if (ramsize < BUFFERS_ADDR + if (ramsize < BUFFERS_ADDR +
(TX_BUFFERS + RX_BUFFERS) * BUFFER_LENGTH * ports) { (TX_BUFFERS + RX_BUFFERS) * BUFFER_LENGTH * ports) {
printk(KERN_WARNING "wanXL %s: no enough on-board RAM" pr_warn("%s: no enough on-board RAM (%u bytes detected, %u bytes required)\n",
" (%u bytes detected, %u bytes required)\n", pci_name(pdev), ramsize,
pci_name(pdev), ramsize, BUFFERS_ADDR + BUFFERS_ADDR +
(TX_BUFFERS + RX_BUFFERS) * BUFFER_LENGTH * ports); (TX_BUFFERS + RX_BUFFERS) * BUFFER_LENGTH * ports);
wanxl_pci_remove_one(pdev); wanxl_pci_remove_one(pdev);
return -ENODEV; return -ENODEV;
} }
if (wanxl_puts_command(card, MBX1_CMD_BSWAP)) { if (wanxl_puts_command(card, MBX1_CMD_BSWAP)) {
printk(KERN_WARNING "wanXL %s: unable to Set Byte Swap" pr_warn("%s: unable to Set Byte Swap Mode\n", pci_name(pdev));
" Mode\n", pci_name(pdev));
wanxl_pci_remove_one(pdev); wanxl_pci_remove_one(pdev);
return -ENODEV; return -ENODEV;
} }
@ -715,7 +710,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
mem = ioremap_nocache(mem_phy, PDM_OFFSET + sizeof(firmware)); mem = ioremap_nocache(mem_phy, PDM_OFFSET + sizeof(firmware));
if (!mem) { if (!mem) {
printk(KERN_ERR "wanxl: ioremap() failed\n"); pr_err("ioremap() failed\n");
wanxl_pci_remove_one(pdev); wanxl_pci_remove_one(pdev);
return -EFAULT; return -EFAULT;
} }
@ -734,8 +729,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
writel(0, card->plx + PLX_MAILBOX_5); writel(0, card->plx + PLX_MAILBOX_5);
if (wanxl_puts_command(card, MBX1_CMD_ABORTJ)) { if (wanxl_puts_command(card, MBX1_CMD_ABORTJ)) {
printk(KERN_WARNING "wanXL %s: unable to Abort and Jump\n", pr_warn("%s: unable to Abort and Jump\n", pci_name(pdev));
pci_name(pdev));
wanxl_pci_remove_one(pdev); wanxl_pci_remove_one(pdev);
return -ENODEV; return -ENODEV;
} }
@ -749,8 +743,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
}while (time_after(timeout, jiffies)); }while (time_after(timeout, jiffies));
if (!stat) { if (!stat) {
printk(KERN_WARNING "wanXL %s: timeout while initializing card " pr_warn("%s: timeout while initializing card firmware\n",
"firmware\n", pci_name(pdev)); pci_name(pdev));
wanxl_pci_remove_one(pdev); wanxl_pci_remove_one(pdev);
return -ENODEV; return -ENODEV;
} }
@ -759,13 +753,13 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
ramsize = stat; ramsize = stat;
#endif #endif
printk(KERN_INFO "wanXL %s: at 0x%X, %u KB of RAM at 0x%X, irq %u\n", 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); pci_name(pdev), plx_phy, ramsize / 1024, mem_phy, pdev->irq);
/* Allocate IRQ */ /* Allocate IRQ */
if (request_irq(pdev->irq, wanxl_intr, IRQF_SHARED, "wanXL", card)) { if (request_irq(pdev->irq, wanxl_intr, IRQF_SHARED, "wanXL", card)) {
printk(KERN_WARNING "wanXL %s: could not allocate IRQ%i.\n", pr_warn("%s: could not allocate IRQ%i\n",
pci_name(pdev), pdev->irq); pci_name(pdev), pdev->irq);
wanxl_pci_remove_one(pdev); wanxl_pci_remove_one(pdev);
return -EBUSY; return -EBUSY;
} }
@ -776,8 +770,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
port_t *port = &card->ports[i]; port_t *port = &card->ports[i];
struct net_device *dev = alloc_hdlcdev(port); struct net_device *dev = alloc_hdlcdev(port);
if (!dev) { if (!dev) {
printk(KERN_ERR "wanXL %s: unable to allocate" pr_err("%s: unable to allocate memory\n",
" memory\n", pci_name(pdev)); pci_name(pdev));
wanxl_pci_remove_one(pdev); wanxl_pci_remove_one(pdev);
return -ENOMEM; return -ENOMEM;
} }
@ -793,8 +787,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
port->node = i; port->node = i;
get_status(port)->clocking = CLOCK_EXT; get_status(port)->clocking = CLOCK_EXT;
if (register_hdlc_device(dev)) { if (register_hdlc_device(dev)) {
printk(KERN_ERR "wanXL %s: unable to register hdlc" pr_err("%s: unable to register hdlc device\n",
" device\n", pci_name(pdev)); pci_name(pdev));
free_netdev(dev); free_netdev(dev);
wanxl_pci_remove_one(pdev); wanxl_pci_remove_one(pdev);
return -ENOBUFS; return -ENOBUFS;
@ -802,11 +796,11 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
card->n_ports++; 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++) for (i = 0; i < ports; i++)
printk("%s #%i: %s", i ? "," : "", i, pr_cont("%s #%i: %s",
card->ports[i].dev->name); i ? "," : "", i, card->ports[i].dev->name);
printk("\n"); pr_cont("\n");
for (i = 0; i < ports; i++) for (i = 0; i < ports; i++)
wanxl_cable_intr(&card->ports[i]); /* get carrier status etc.*/ wanxl_cable_intr(&card->ports[i]); /* get carrier status etc.*/
@ -836,7 +830,7 @@ static struct pci_driver wanxl_pci_driver = {
static int __init wanxl_init_module(void) static int __init wanxl_init_module(void)
{ {
#ifdef MODULE #ifdef MODULE
printk(KERN_INFO "%s\n", version); pr_info("%s\n", version);
#endif #endif
return pci_register_driver(&wanxl_pci_driver); return pci_register_driver(&wanxl_pci_driver);
} }