Commit bd1f6990 authored by Martin Diehl's avatar Martin Diehl Committed by Stephen Hemminger

[IRDA]: vlsi_ir v0.5 update, 2/7.

* don't fail without procfs - it's only needed for diagnostics
* get rid of printk in favour of IRDA_DEBUG and friends wherever possible
* reduce kernellog noise depending on irda debuglevel
parent a0dbc715
...@@ -200,13 +200,13 @@ static int vlsi_proc_ndev(struct net_device *ndev, char *buf, int len) ...@@ -200,13 +200,13 @@ static int vlsi_proc_ndev(struct net_device *ndev, char *buf, int len)
out += sprintf(out, "\nhw-state:\n"); out += sprintf(out, "\nhw-state:\n");
pci_read_config_byte(idev->pdev, VLSI_PCI_IRMISC, &byte); pci_read_config_byte(idev->pdev, VLSI_PCI_IRMISC, &byte);
out += sprintf(out, "IRMISC:%s%s%s UART%s", out += sprintf(out, "IRMISC:%s%s%s uart%s",
(byte&IRMISC_IRRAIL) ? " irrail" : "", (byte&IRMISC_IRRAIL) ? " irrail" : "",
(byte&IRMISC_IRPD) ? " irpd" : "", (byte&IRMISC_IRPD) ? " irpd" : "",
(byte&IRMISC_UARTTST) ? " uarttest" : "", (byte&IRMISC_UARTTST) ? " uarttest" : "",
(byte&IRMISC_UARTEN) ? "" : " disabled\n"); (byte&IRMISC_UARTEN) ? "@" : " disabled\n");
if (byte&IRMISC_UARTEN) { if (byte&IRMISC_UARTEN) {
out += sprintf(out, "@0x%s\n", out += sprintf(out, "0x%s\n",
(byte&2) ? ((byte&1) ? "3e8" : "2e8") (byte&2) ? ((byte&1) ? "3e8" : "2e8")
: ((byte&1) ? "3f8" : "2f8")); : ((byte&1) ? "3f8" : "2f8"));
} }
...@@ -360,7 +360,7 @@ static int vlsi_proc_print(struct net_device *ndev, char *buf, int len) ...@@ -360,7 +360,7 @@ static int vlsi_proc_print(struct net_device *ndev, char *buf, int len)
char *out = buf; char *out = buf;
if (!ndev || !ndev->priv) { if (!ndev || !ndev->priv) {
printk(KERN_ERR "%s: invalid ptr!\n", __FUNCTION__); ERROR("%s: invalid ptr!\n", __FUNCTION__);
return 0; return 0;
} }
...@@ -556,7 +556,7 @@ static struct vlsi_ring *vlsi_alloc_ring(struct pci_dev *pdev, struct ring_descr ...@@ -556,7 +556,7 @@ static struct vlsi_ring *vlsi_alloc_ring(struct pci_dev *pdev, struct ring_descr
} }
busaddr = pci_map_single(pdev, rd->buf, len, dir); busaddr = pci_map_single(pdev, rd->buf, len, dir);
if (!busaddr) { if (!busaddr) {
printk(KERN_ERR "%s: failed to create PCI-MAP for %p", ERROR("%s: failed to create PCI-MAP for %p",
__FUNCTION__, rd->buf); __FUNCTION__, rd->buf);
BUG(); BUG();
} }
...@@ -599,8 +599,7 @@ static int vlsi_create_hwif(vlsi_irda_dev_t *idev) ...@@ -599,8 +599,7 @@ static int vlsi_create_hwif(vlsi_irda_dev_t *idev)
ringarea = pci_alloc_consistent(idev->pdev, HW_RING_AREA_SIZE, &idev->busaddr); ringarea = pci_alloc_consistent(idev->pdev, HW_RING_AREA_SIZE, &idev->busaddr);
if (!ringarea) { if (!ringarea) {
printk(KERN_ERR "%s: insufficient memory for descriptor rings\n", ERROR("%s: insufficient memory for descriptor rings\n", __FUNCTION__);
__FUNCTION__);
goto out; goto out;
} }
memset(ringarea, 0, HW_RING_AREA_SIZE); memset(ringarea, 0, HW_RING_AREA_SIZE);
...@@ -674,12 +673,11 @@ static int vlsi_process_rx(struct vlsi_ring *r, struct ring_descr *rd) ...@@ -674,12 +673,11 @@ static int vlsi_process_rx(struct vlsi_ring *r, struct ring_descr *rd)
crclen = (idev->mode==IFF_FIR) ? sizeof(u32) : sizeof(u16); crclen = (idev->mode==IFF_FIR) ? sizeof(u32) : sizeof(u16);
len -= crclen; /* remove trailing CRC */ len -= crclen; /* remove trailing CRC */
if (len <= 0) { if (len <= 0) {
printk(KERN_ERR "%s: strange frame (len=%d)\n", WARNING("%s: strange frame (len=%d)\n", __FUNCTION__, len);
__FUNCTION__, len);
ret |= VLSI_RX_DROP; ret |= VLSI_RX_DROP;
} }
else if (!rd->skb) { else if (!rd->skb) {
printk(KERN_ERR "%s: rx packet dropped\n", __FUNCTION__); WARNING("%s: rx packet dropped\n", __FUNCTION__);
ret |= VLSI_RX_DROP; ret |= VLSI_RX_DROP;
} }
else { else {
...@@ -766,7 +764,7 @@ static void vlsi_rx_interrupt(struct net_device *ndev) ...@@ -766,7 +764,7 @@ static void vlsi_rx_interrupt(struct net_device *ndev)
if (ring_first(r) == NULL) { if (ring_first(r) == NULL) {
/* we are in big trouble, if this should ever happen */ /* we are in big trouble, if this should ever happen */
printk(KERN_ERR "%s: rx ring exhausted!\n", __FUNCTION__); ERROR("%s: rx ring exhausted!\n", __FUNCTION__);
vlsi_ring_debug(r); vlsi_ring_debug(r);
} }
else else
...@@ -787,7 +785,7 @@ static void vlsi_unarm_rx(vlsi_irda_dev_t *idev) ...@@ -787,7 +785,7 @@ static void vlsi_unarm_rx(vlsi_irda_dev_t *idev)
if (rd_is_active(rd)) { if (rd_is_active(rd)) {
rd_set_status(rd, 0); rd_set_status(rd, 0);
if (rd_get_count(rd)) { if (rd_get_count(rd)) {
printk(KERN_INFO "%s - dropping rx packet\n", __FUNCTION__); IRDA_DEBUG(0, "%s - dropping rx packet\n", __FUNCTION__);
ret = -VLSI_RX_DROP; ret = -VLSI_RX_DROP;
} }
rd_set_count(rd, 0); rd_set_count(rd, 0);
...@@ -867,9 +865,7 @@ static int vlsi_set_baud(struct net_device *ndev, int dolock) ...@@ -867,9 +865,7 @@ static int vlsi_set_baud(struct net_device *ndev, int dolock)
baudrate = idev->new_baud; baudrate = idev->new_baud;
iobase = ndev->base_addr; iobase = ndev->base_addr;
#if 0 IRDA_DEBUG(2, "%s: %d -> %d\n", __FUNCTION__, idev->baud, idev->new_baud);
printk(KERN_DEBUG "%s: %d -> %d\n", __FUNCTION__, idev->baud, idev->new_baud);
#endif
if (baudrate == 4000000) { if (baudrate == 4000000) {
mode = IFF_FIR; mode = IFF_FIR;
config = IRCFG_FIR; config = IRCFG_FIR;
...@@ -885,7 +881,7 @@ static int vlsi_set_baud(struct net_device *ndev, int dolock) ...@@ -885,7 +881,7 @@ static int vlsi_set_baud(struct net_device *ndev, int dolock)
config = IRCFG_SIR | IRCFG_SIRFILT | IRCFG_RXANY; config = IRCFG_SIR | IRCFG_SIRFILT | IRCFG_RXANY;
switch(baudrate) { switch(baudrate) {
default: default:
printk(KERN_ERR "%s: undefined baudrate %d - fallback to 9600!\n", WARNING("%s: undefined baudrate %d - fallback to 9600!\n",
__FUNCTION__, baudrate); __FUNCTION__, baudrate);
baudrate = 9600; baudrate = 9600;
/* fallthru */ /* fallthru */
...@@ -910,7 +906,7 @@ static int vlsi_set_baud(struct net_device *ndev, int dolock) ...@@ -910,7 +906,7 @@ static int vlsi_set_baud(struct net_device *ndev, int dolock)
if (fifocnt == 0) if (fifocnt == 0)
break; break;
if (!idle_retry) if (!idle_retry)
printk(KERN_WARNING "%s: waiting for rx fifo to become empty(%d)\n", IRDA_DEBUG(0, "%s: waiting for rx fifo to become empty(%d)\n",
__FUNCTION__, fifocnt); __FUNCTION__, fifocnt);
if (dolock) { if (dolock) {
spin_unlock_irqrestore(&idev->lock, flags); spin_unlock_irqrestore(&idev->lock, flags);
...@@ -921,7 +917,7 @@ static int vlsi_set_baud(struct net_device *ndev, int dolock) ...@@ -921,7 +917,7 @@ static int vlsi_set_baud(struct net_device *ndev, int dolock)
udelay(100); udelay(100);
} }
if (fifocnt != 0) if (fifocnt != 0)
printk(KERN_ERR "%s: rx fifo not empty(%d)\n", __FUNCTION__, fifocnt); IRDA_DEBUG(0, "%s: rx fifo not empty(%d)\n", __FUNCTION__, fifocnt);
outw(0, iobase+VLSI_PIO_IRENABLE); outw(0, iobase+VLSI_PIO_IRENABLE);
wmb(); wmb();
...@@ -949,13 +945,13 @@ static int vlsi_set_baud(struct net_device *ndev, int dolock) ...@@ -949,13 +945,13 @@ static int vlsi_set_baud(struct net_device *ndev, int dolock)
config ^= IRENABLE_SIR_ON; config ^= IRENABLE_SIR_ON;
if (config != (IRENABLE_IREN|IRENABLE_ENRXST)) { if (config != (IRENABLE_IREN|IRENABLE_ENRXST)) {
printk(KERN_ERR "%s: failed to set %s mode!\n", __FUNCTION__, WARNING("%s: failed to set %s mode!\n", __FUNCTION__,
(mode==IFF_SIR)?"SIR":((mode==IFF_MIR)?"MIR":"FIR")); (mode==IFF_SIR)?"SIR":((mode==IFF_MIR)?"MIR":"FIR"));
ret = -1; ret = -1;
} }
else { else {
if (inw(iobase+VLSI_PIO_PHYCTL) != nphyctl) { if (inw(iobase+VLSI_PIO_PHYCTL) != nphyctl) {
printk(KERN_ERR "%s: failed to apply baudrate %d\n", WARNING("%s: failed to apply baudrate %d\n",
__FUNCTION__, baudrate); __FUNCTION__, baudrate);
ret = -1; ret = -1;
} }
...@@ -1043,7 +1039,7 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev) ...@@ -1043,7 +1039,7 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
status = 0; status = 0;
if (skb->len == 0) { if (skb->len == 0) {
printk(KERN_ERR "%s: dropping len=0 packet\n", __FUNCTION__); WARNING("%s: dropping len=0 packet\n", __FUNCTION__);
goto drop; goto drop;
} }
...@@ -1091,7 +1087,7 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev) ...@@ -1091,7 +1087,7 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
*/ */
if (len >= r->len-5) if (len >= r->len-5)
printk(KERN_WARNING "%s: possible buffer overflow with SIR wrapping!\n", WARNING("%s: possible buffer overflow with SIR wrapping!\n",
__FUNCTION__); __FUNCTION__);
} }
else { else {
...@@ -1099,7 +1095,7 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev) ...@@ -1099,7 +1095,7 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
status |= RD_TX_PULSE; /* send 2 us highspeed indication pulse */ status |= RD_TX_PULSE; /* send 2 us highspeed indication pulse */
len = skb->len; len = skb->len;
if (len > r->len) { if (len > r->len) {
printk(KERN_ERR "%s: no space - skb too big (%d)\n", WARNING("%s: no space - skb too big (%d)\n",
__FUNCTION__, skb->len); __FUNCTION__, skb->len);
goto drop; goto drop;
} }
...@@ -1160,9 +1156,9 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev) ...@@ -1160,9 +1156,9 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
int fifocnt; int fifocnt;
fifocnt = inw(ndev->base_addr+VLSI_PIO_RCVBCNT) & RCVBCNT_MASK; fifocnt = inw(ndev->base_addr+VLSI_PIO_RCVBCNT) & RCVBCNT_MASK;
if (fifocnt != 0) if (fifocnt != 0) {
printk(KERN_WARNING "%s: rx fifo not empty(%d)\n", IRDA_DEBUG(0, "%s: rx fifo not empty(%d)\n", __FUNCTION__, fifocnt);
__FUNCTION__, fifocnt); }
config = inw(iobase+VLSI_PIO_IRCFG); config = inw(iobase+VLSI_PIO_IRCFG);
rmb(); rmb();
...@@ -1174,7 +1170,7 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev) ...@@ -1174,7 +1170,7 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
if (ring_put(r) == NULL) { if (ring_put(r) == NULL) {
netif_stop_queue(ndev); netif_stop_queue(ndev);
printk(KERN_DEBUG "%s: tx ring full - queue stopped\n", __FUNCTION__); IRDA_DEBUG(3, "%s: tx ring full - queue stopped\n", __FUNCTION__);
} }
spin_unlock_irqrestore(&idev->lock, flags); spin_unlock_irqrestore(&idev->lock, flags);
...@@ -1230,9 +1226,10 @@ static void vlsi_tx_interrupt(struct net_device *ndev) ...@@ -1230,9 +1226,10 @@ static void vlsi_tx_interrupt(struct net_device *ndev)
int fifocnt; int fifocnt;
fifocnt = inw(iobase+VLSI_PIO_RCVBCNT) & RCVBCNT_MASK; fifocnt = inw(iobase+VLSI_PIO_RCVBCNT) & RCVBCNT_MASK;
if (fifocnt != 0) if (fifocnt != 0) {
printk(KERN_WARNING "%s: rx fifo not empty(%d)\n", IRDA_DEBUG(0, "%s: rx fifo not empty(%d)\n",
__FUNCTION__, fifocnt); __FUNCTION__, fifocnt);
}
outw(config | IRCFG_ENTX, iobase+VLSI_PIO_IRCFG); outw(config | IRCFG_ENTX, iobase+VLSI_PIO_IRCFG);
} }
...@@ -1240,7 +1237,7 @@ static void vlsi_tx_interrupt(struct net_device *ndev) ...@@ -1240,7 +1237,7 @@ static void vlsi_tx_interrupt(struct net_device *ndev)
if (netif_queue_stopped(ndev) && !idev->new_baud) { if (netif_queue_stopped(ndev) && !idev->new_baud) {
netif_wake_queue(ndev); netif_wake_queue(ndev);
printk(KERN_DEBUG "%s: queue awoken\n", __FUNCTION__); IRDA_DEBUG(3, "%s: queue awoken\n", __FUNCTION__);
} }
} }
...@@ -1263,7 +1260,7 @@ static void vlsi_unarm_tx(vlsi_irda_dev_t *idev) ...@@ -1263,7 +1260,7 @@ static void vlsi_unarm_tx(vlsi_irda_dev_t *idev)
dev_kfree_skb_any(rd->skb); dev_kfree_skb_any(rd->skb);
rd->skb = NULL; rd->skb = NULL;
} }
printk(KERN_INFO "%s - dropping tx packet\n", __FUNCTION__); IRDA_DEBUG(0, "%s - dropping tx packet\n", __FUNCTION__);
ret = -VLSI_TX_DROP; ret = -VLSI_TX_DROP;
} }
else else
...@@ -1312,8 +1309,7 @@ static int vlsi_start_clock(struct pci_dev *pdev) ...@@ -1312,8 +1309,7 @@ static int vlsi_start_clock(struct pci_dev *pdev)
} }
if (count < 3) { if (count < 3) {
if (clksrc == 1) { /* explicitly asked for PLL hence bail out */ if (clksrc == 1) { /* explicitly asked for PLL hence bail out */
printk(KERN_ERR "%s: no PLL or failed to lock!\n", ERROR("%s: no PLL or failed to lock!\n", __FUNCTION__);
__FUNCTION__);
clkctl = CLKCTL_CLKSTP; clkctl = CLKCTL_CLKSTP;
pci_write_config_byte(pdev, VLSI_PCI_CLKCTL, clkctl); pci_write_config_byte(pdev, VLSI_PCI_CLKCTL, clkctl);
return -1; return -1;
...@@ -1321,7 +1317,7 @@ static int vlsi_start_clock(struct pci_dev *pdev) ...@@ -1321,7 +1317,7 @@ static int vlsi_start_clock(struct pci_dev *pdev)
else /* was: clksrc=0(auto) */ else /* was: clksrc=0(auto) */
clksrc = 3; /* fallback to 40MHz XCLK (OB800) */ clksrc = 3; /* fallback to 40MHz XCLK (OB800) */
printk(KERN_INFO "%s: PLL not locked, fallback to clksrc=%d\n", IRDA_DEBUG(0, "%s: PLL not locked, fallback to clksrc=%d\n",
__FUNCTION__, clksrc); __FUNCTION__, clksrc);
} }
else else
...@@ -1569,8 +1565,7 @@ static int vlsi_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd) ...@@ -1569,8 +1565,7 @@ static int vlsi_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
irq->ifr_receiving = (fifocnt!=0) ? 1 : 0; irq->ifr_receiving = (fifocnt!=0) ? 1 : 0;
break; break;
default: default:
printk(KERN_ERR "%s: notsupp - cmd=%04x\n", WARNING("%s: notsupp - cmd=%04x\n", __FUNCTION__, cmd);
__FUNCTION__, cmd);
ret = -EOPNOTSUPP; ret = -EOPNOTSUPP;
} }
...@@ -1613,14 +1608,14 @@ static irqreturn_t vlsi_interrupt(int irq, void *dev_instance, ...@@ -1613,14 +1608,14 @@ static irqreturn_t vlsi_interrupt(int irq, void *dev_instance,
break; /* done if only activity remaining */ break; /* done if only activity remaining */
if (irintr & ~(IRINTR_RPKTINT|IRINTR_TPKTINT|IRINTR_ACTIVITY)) { if (irintr & ~(IRINTR_RPKTINT|IRINTR_TPKTINT|IRINTR_ACTIVITY)) {
printk(KERN_DEBUG "%s: IRINTR = %02x\n", IRDA_DEBUG(1, "%s: IRINTR = %02x\n",
__FUNCTION__, (unsigned)irintr); __FUNCTION__, (unsigned)irintr);
vlsi_reg_debug(iobase,__FUNCTION__); vlsi_reg_debug(iobase,__FUNCTION__);
} }
} while (--boguscount > 0); } while (--boguscount > 0);
if (boguscount <= 0) if (boguscount <= 0)
printk(KERN_WARNING "%s: too much work in interrupt!\n", __FUNCTION__); MESSAGE("%s: too much work in interrupt!\n", __FUNCTION__);
return IRQ_RETVAL(handled); return IRQ_RETVAL(handled);
} }
...@@ -1633,7 +1628,7 @@ static int vlsi_open(struct net_device *ndev) ...@@ -1633,7 +1628,7 @@ static int vlsi_open(struct net_device *ndev)
char hwname[32]; char hwname[32];
if (pci_request_regions(idev->pdev, drivername)) { if (pci_request_regions(idev->pdev, drivername)) {
printk(KERN_ERR "%s: io resource busy\n", __FUNCTION__); WARNING("%s: io resource busy\n", __FUNCTION__);
goto errout; goto errout;
} }
ndev->base_addr = pci_resource_start(idev->pdev,0); ndev->base_addr = pci_resource_start(idev->pdev,0);
...@@ -1647,8 +1642,7 @@ static int vlsi_open(struct net_device *ndev) ...@@ -1647,8 +1642,7 @@ static int vlsi_open(struct net_device *ndev)
if (request_irq(ndev->irq, vlsi_interrupt, SA_SHIRQ, if (request_irq(ndev->irq, vlsi_interrupt, SA_SHIRQ,
drivername, ndev)) { drivername, ndev)) {
printk(KERN_ERR "%s: couldn't get IRQ: %d\n", WARNING("%s: couldn't get IRQ: %d\n", __FUNCTION__, ndev->irq);
__FUNCTION__, ndev->irq);
goto errout_io; goto errout_io;
} }
...@@ -1669,7 +1663,7 @@ static int vlsi_open(struct net_device *ndev) ...@@ -1669,7 +1663,7 @@ static int vlsi_open(struct net_device *ndev)
netif_start_queue(ndev); netif_start_queue(ndev);
printk(KERN_INFO "%s: device %s operational\n", __FUNCTION__, ndev->name); MESSAGE("%s: device %s operational\n", __FUNCTION__, ndev->name);
return 0; return 0;
...@@ -1703,7 +1697,7 @@ static int vlsi_close(struct net_device *ndev) ...@@ -1703,7 +1697,7 @@ static int vlsi_close(struct net_device *ndev)
pci_release_regions(idev->pdev); pci_release_regions(idev->pdev);
printk(KERN_INFO "%s: device %s stopped\n", __FUNCTION__, ndev->name); MESSAGE("%s: device %s stopped\n", __FUNCTION__, ndev->name);
return 0; return 0;
} }
...@@ -1724,8 +1718,7 @@ static int vlsi_irda_init(struct net_device *ndev) ...@@ -1724,8 +1718,7 @@ static int vlsi_irda_init(struct net_device *ndev)
if (pci_set_dma_mask(pdev,DMA_MASK_USED_BY_HW) if (pci_set_dma_mask(pdev,DMA_MASK_USED_BY_HW)
|| pci_set_dma_mask(pdev,DMA_MASK_MSTRPAGE)) { || pci_set_dma_mask(pdev,DMA_MASK_MSTRPAGE)) {
printk(KERN_ERR "%s: aborting due to PCI BM-DMA address limitations\n", ERROR("%s: aborting due to PCI BM-DMA address limitations\n", __FUNCTION__);
__FUNCTION__);
return -1; return -1;
} }
...@@ -1779,7 +1772,7 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1779,7 +1772,7 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if ( !pci_resource_start(pdev,0) if ( !pci_resource_start(pdev,0)
|| !(pci_resource_flags(pdev,0) & IORESOURCE_IO) ) { || !(pci_resource_flags(pdev,0) & IORESOURCE_IO) ) {
printk(KERN_ERR "%s: bar 0 invalid", __FUNCTION__); ERROR("%s: bar 0 invalid", __FUNCTION__);
goto out_disable; goto out_disable;
} }
...@@ -1787,8 +1780,7 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1787,8 +1780,7 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)
ndev = (struct net_device *) kmalloc (alloc_size, GFP_KERNEL); ndev = (struct net_device *) kmalloc (alloc_size, GFP_KERNEL);
if (ndev==NULL) { if (ndev==NULL) {
printk(KERN_ERR "%s: Unable to allocate device memory.\n", ERROR("%s: Unable to allocate device memory.\n", __FUNCTION__);
__FUNCTION__);
goto out_disable; goto out_disable;
} }
...@@ -1804,37 +1796,33 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1804,37 +1796,33 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)
ndev->init = vlsi_irda_init; ndev->init = vlsi_irda_init;
strcpy(ndev->name,"irda%d"); strcpy(ndev->name,"irda%d");
if (register_netdev(ndev)) { if (register_netdev(ndev)) {
printk(KERN_ERR "%s: register_netdev failed\n", ERROR("%s: register_netdev failed\n", __FUNCTION__);
__FUNCTION__);
goto out_freedev; goto out_freedev;
} }
idev->proc_entry = NULL;
if (vlsi_proc_root != NULL) { if (vlsi_proc_root != NULL) {
struct proc_dir_entry *ent; struct proc_dir_entry *ent;
ent = create_proc_entry(ndev->name, S_IFREG|S_IRUGO, vlsi_proc_root); ent = create_proc_entry(ndev->name, S_IFREG|S_IRUGO, vlsi_proc_root);
if (!ent) { if (!ent) {
printk(KERN_ERR "%s: failed to create proc entry\n", __FUNCTION__); WARNING("%s: failed to create proc entry\n", __FUNCTION__);
goto out_unregister; idev->proc_entry = NULL;
} }
ent->data = ndev; else {
ent->proc_fops = VLSI_PROC_FOPS; ent->data = ndev;
ent->size = 0; ent->proc_fops = VLSI_PROC_FOPS;
idev->proc_entry = ent; ent->size = 0;
} else idev->proc_entry = ent;
idev->proc_entry = NULL; }
}
printk(KERN_INFO "%s: registered device %s\n", drivername, ndev->name); MESSAGE("%s: registered device %s\n", drivername, ndev->name);
pci_set_drvdata(pdev, ndev); pci_set_drvdata(pdev, ndev);
up(&idev->sem); up(&idev->sem);
return 0; return 0;
out_unregister:
up(&idev->sem);
unregister_netdev(ndev);
goto out_disable;
out_freedev: out_freedev:
up(&idev->sem); up(&idev->sem);
kfree(ndev); kfree(ndev);
...@@ -1851,7 +1839,7 @@ static void __devexit vlsi_irda_remove(struct pci_dev *pdev) ...@@ -1851,7 +1839,7 @@ static void __devexit vlsi_irda_remove(struct pci_dev *pdev)
vlsi_irda_dev_t *idev; vlsi_irda_dev_t *idev;
if (!ndev) { if (!ndev) {
printk(KERN_CRIT "%s: lost netdevice?\n", drivername); ERROR("%s: lost netdevice?\n", drivername);
return; return;
} }
...@@ -1968,7 +1956,7 @@ static int vlsi_irda_resume(struct pci_dev *pdev) ...@@ -1968,7 +1956,7 @@ static int vlsi_irda_resume(struct pci_dev *pdev)
* now we explicitly set pdev->current_state = 0 after enabling the * now we explicitly set pdev->current_state = 0 after enabling the
* device and independently resume_ok should catch any garbage config. * device and independently resume_ok should catch any garbage config.
*/ */
printk(KERN_ERR "%s - hm, nothing to resume?\n", __FUNCTION__); WARNING("%s - hm, nothing to resume?\n", __FUNCTION__);
up(&idev->sem); up(&idev->sem);
return 0; return 0;
} }
...@@ -2006,7 +1994,7 @@ static int __init vlsi_mod_init(void) ...@@ -2006,7 +1994,7 @@ static int __init vlsi_mod_init(void)
int i, ret; int i, ret;
if (clksrc < 0 || clksrc > 3) { if (clksrc < 0 || clksrc > 3) {
printk(KERN_ERR "%s: invalid clksrc=%d\n", drivername, clksrc); ERROR("%s: invalid clksrc=%d\n", drivername, clksrc);
return -1; return -1;
} }
...@@ -2019,9 +2007,8 @@ static int __init vlsi_mod_init(void) ...@@ -2019,9 +2007,8 @@ static int __init vlsi_mod_init(void)
case 64: case 64:
break; break;
default: default:
printk(KERN_WARNING "%s: invalid %s ringsize %d", WARNING("%s: invalid %s ringsize %d, using default=8",
drivername, (i)?"rx":"tx", ringsize[i]); drivername, (i)?"rx":"tx", ringsize[i]);
printk(", using default=8\n");
ringsize[i] = 8; ringsize[i] = 8;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment