vserver 2.0 rc7
[linux-2.6.git] / drivers / net / irda / vlsi_ir.c
index f7cd226..006e4f5 100644 (file)
@@ -435,8 +435,8 @@ static struct vlsi_ring *vlsi_alloc_ring(struct pci_dev *pdev, struct ring_descr
                if (rd->buf == NULL
                    ||  !(busaddr = pci_map_single(pdev, rd->buf, len, dir))) {
                        if (rd->buf) {
-                               ERROR("%s: failed to create PCI-MAP for %p",
-                                       __FUNCTION__, rd->buf);
+                               IRDA_ERROR("%s: failed to create PCI-MAP for %p",
+                                          __FUNCTION__, rd->buf);
                                kfree(rd->buf);
                                rd->buf = NULL;
                        }
@@ -490,7 +490,8 @@ static int vlsi_create_hwif(vlsi_irda_dev_t *idev)
 
        ringarea = pci_alloc_consistent(idev->pdev, HW_RING_AREA_SIZE, &idev->busaddr);
        if (!ringarea) {
-               ERROR("%s: insufficient memory for descriptor rings\n", __FUNCTION__);
+               IRDA_ERROR("%s: insufficient memory for descriptor rings\n",
+                          __FUNCTION__);
                goto out;
        }
        memset(ringarea, 0, HW_RING_AREA_SIZE);
@@ -587,7 +588,7 @@ static int vlsi_process_rx(struct vlsi_ring *r, struct ring_descr *rd)
        }
 
        if (!rd->skb) {
-               WARNING("%s: rx packet lost\n", __FUNCTION__);
+               IRDA_WARNING("%s: rx packet lost\n", __FUNCTION__);
                ret |= VLSI_RX_DROP;
                goto done;
        }
@@ -617,8 +618,8 @@ static void vlsi_fill_rx(struct vlsi_ring *r)
 
        for (rd = ring_last(r); rd != NULL; rd = ring_put(r)) {
                if (rd_is_active(rd)) {
-                       WARNING("%s: driver bug: rx descr race with hw\n",
-                               __FUNCTION__);
+                       IRDA_WARNING("%s: driver bug: rx descr race with hw\n",
+                                    __FUNCTION__);
                        vlsi_ring_debug(r);
                        break;
                }
@@ -677,7 +678,7 @@ static void vlsi_rx_interrupt(struct net_device *ndev)
 
        if (ring_first(r) == NULL) {
                /* we are in big trouble, if this should ever happen */
-               ERROR("%s: rx ring exhausted!\n", __FUNCTION__);
+               IRDA_ERROR("%s: rx ring exhausted!\n", __FUNCTION__);
                vlsi_ring_debug(r);
        }
        else
@@ -789,8 +790,8 @@ static int vlsi_set_baud(vlsi_irda_dev_t *idev, unsigned iobase)
                config = IRCFG_SIR | IRCFG_SIRFILT  | IRCFG_RXANY;
                switch(baudrate) {
                        default:
-                               WARNING("%s: undefined baudrate %d - fallback to 9600!\n",
-                                       __FUNCTION__, baudrate);
+                               IRDA_WARNING("%s: undefined baudrate %d - fallback to 9600!\n",
+                                            __FUNCTION__, baudrate);
                                baudrate = 9600;
                                /* fallthru */
                        case 2400:
@@ -831,14 +832,14 @@ static int vlsi_set_baud(vlsi_irda_dev_t *idev, unsigned iobase)
                config ^= IRENABLE_SIR_ON;
 
        if (config != (IRENABLE_PHYANDCLOCK|IRENABLE_ENRXST)) {
-               WARNING("%s: failed to set %s mode!\n", __FUNCTION__,
+               IRDA_WARNING("%s: failed to set %s mode!\n", __FUNCTION__,
                        (mode==IFF_SIR)?"SIR":((mode==IFF_MIR)?"MIR":"FIR"));
                ret = -1;
        }
        else {
                if (inw(iobase+VLSI_PIO_PHYCTL) != nphyctl) {
-                       WARNING("%s: failed to apply baudrate %d\n",
-                               __FUNCTION__, baudrate);
+                       IRDA_WARNING("%s: failed to apply baudrate %d\n",
+                                    __FUNCTION__, baudrate);
                        ret = -1;
                }
                else {
@@ -982,8 +983,8 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
                 */
 
                if (len >= r->len-5)
-                        WARNING("%s: possible buffer overflow with SIR wrapping!\n",
-                               __FUNCTION__);
+                        IRDA_WARNING("%s: possible buffer overflow with SIR wrapping!\n",
+                                     __FUNCTION__);
        }
        else {
                /* hw deals with MIR/FIR mode wrapping */
@@ -1050,7 +1051,7 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 drop_unlock:
        spin_unlock_irqrestore(&idev->lock, flags);
 drop:
-       WARNING("%s: dropping packet - %s\n", __FUNCTION__, msg);
+       IRDA_WARNING("%s: dropping packet - %s\n", __FUNCTION__, msg);
        dev_kfree_skb_any(skb);
        idev->stats.tx_errors++;
        idev->stats.tx_dropped++;
@@ -1188,7 +1189,8 @@ static int vlsi_start_clock(struct pci_dev *pdev)
                }
                if (count < 3) {
                        if (clksrc == 1) { /* explicitly asked for PLL hence bail out */
-                               ERROR("%s: no PLL or failed to lock!\n", __FUNCTION__);
+                               IRDA_ERROR("%s: no PLL or failed to lock!\n",
+                                          __FUNCTION__);
                                clkctl = CLKCTL_CLKSTP;
                                pci_write_config_byte(pdev, VLSI_PCI_CLKCTL, clkctl);
                                return -1;
@@ -1269,7 +1271,7 @@ static int vlsi_init_chip(struct pci_dev *pdev)
        /* start the clock and clean the registers */
 
        if (vlsi_start_clock(pdev)) {
-               ERROR("%s: no valid clock source\n", __FUNCTION__);
+               IRDA_ERROR("%s: no valid clock source\n", __FUNCTION__);
                return -1;
        }
        iobase = ndev->base_addr;
@@ -1400,8 +1402,8 @@ static void vlsi_tx_timeout(struct net_device *ndev)
                idev->new_baud = idev->baud;            /* keep current baudrate */
 
        if (vlsi_start_hw(idev))
-               ERROR("%s: failed to restart hw - %s(%s) unusable!\n",
-                       __FUNCTION__, PCIDEV_NAME(idev->pdev), ndev->name);
+               IRDA_ERROR("%s: failed to restart hw - %s(%s) unusable!\n",
+                          __FUNCTION__, PCIDEV_NAME(idev->pdev), ndev->name);
        else
                netif_start_queue(ndev);
 }
@@ -1445,7 +1447,8 @@ static int vlsi_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
                        irq->ifr_receiving = (fifocnt!=0) ? 1 : 0;
                        break;
                default:
-                       WARNING("%s: notsupp - cmd=%04x\n", __FUNCTION__, cmd);
+                       IRDA_WARNING("%s: notsupp - cmd=%04x\n",
+                                    __FUNCTION__, cmd);
                        ret = -EOPNOTSUPP;
        }       
        
@@ -1490,7 +1493,8 @@ static irqreturn_t vlsi_interrupt(int irq, void *dev_instance,
        spin_unlock_irqrestore(&idev->lock,flags);
 
        if (boguscount <= 0)
-               MESSAGE("%s: too much work in interrupt!\n", __FUNCTION__);
+               IRDA_MESSAGE("%s: too much work in interrupt!\n",
+                            __FUNCTION__);
        return IRQ_RETVAL(handled);
 }
 
@@ -1503,7 +1507,7 @@ static int vlsi_open(struct net_device *ndev)
        char    hwname[32];
 
        if (pci_request_regions(idev->pdev, drivername)) {
-               WARNING("%s: io resource busy\n", __FUNCTION__);
+               IRDA_WARNING("%s: io resource busy\n", __FUNCTION__);
                goto errout;
        }
        ndev->base_addr = pci_resource_start(idev->pdev,0);
@@ -1517,7 +1521,8 @@ static int vlsi_open(struct net_device *ndev)
 
        if (request_irq(ndev->irq, vlsi_interrupt, SA_SHIRQ,
                        drivername, ndev)) {
-               WARNING("%s: couldn't get IRQ: %d\n", __FUNCTION__, ndev->irq);
+               IRDA_WARNING("%s: couldn't get IRQ: %d\n",
+                            __FUNCTION__, ndev->irq);
                goto errout_io;
        }
 
@@ -1538,7 +1543,7 @@ static int vlsi_open(struct net_device *ndev)
 
        netif_start_queue(ndev);
 
-       MESSAGE("%s: device %s operational\n", __FUNCTION__, ndev->name);
+       IRDA_MESSAGE("%s: device %s operational\n", __FUNCTION__, ndev->name);
 
        return 0;
 
@@ -1572,7 +1577,7 @@ static int vlsi_close(struct net_device *ndev)
 
        pci_release_regions(idev->pdev);
 
-       MESSAGE("%s: device %s stopped\n", __FUNCTION__, ndev->name);
+       IRDA_MESSAGE("%s: device %s stopped\n", __FUNCTION__, ndev->name);
 
        return 0;
 }
@@ -1593,7 +1598,7 @@ static int vlsi_irda_init(struct net_device *ndev)
 
        if (pci_set_dma_mask(pdev,DMA_MASK_USED_BY_HW)
            || pci_set_dma_mask(pdev,DMA_MASK_MSTRPAGE)) {
-               ERROR("%s: aborting due to PCI BM-DMA address limitations\n", __FUNCTION__);
+               IRDA_ERROR("%s: aborting due to PCI BM-DMA address limitations\n", __FUNCTION__);
                return -1;
        }
 
@@ -1640,18 +1645,19 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        else
                pdev->current_state = 0; /* hw must be running now */
 
-       MESSAGE("%s: IrDA PCI controller %s detected\n",
-               drivername, PCIDEV_NAME(pdev));
+       IRDA_MESSAGE("%s: IrDA PCI controller %s detected\n",
+                    drivername, PCIDEV_NAME(pdev));
 
        if ( !pci_resource_start(pdev,0)
             || !(pci_resource_flags(pdev,0) & IORESOURCE_IO) ) {
-               ERROR("%s: bar 0 invalid", __FUNCTION__);
+               IRDA_ERROR("%s: bar 0 invalid", __FUNCTION__);
                goto out_disable;
        }
 
        ndev = alloc_irdadev(sizeof(*idev));
        if (ndev==NULL) {
-               ERROR("%s: Unable to allocate device memory.\n", __FUNCTION__);
+               IRDA_ERROR("%s: Unable to allocate device memory.\n",
+                          __FUNCTION__);
                goto out_disable;
        }
 
@@ -1666,7 +1672,7 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                goto out_freedev;
 
        if (register_netdev(ndev) < 0) {
-               ERROR("%s: register_netdev failed\n", __FUNCTION__);
+               IRDA_ERROR("%s: register_netdev failed\n", __FUNCTION__);
                goto out_freedev;
        }
 
@@ -1675,7 +1681,8 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
                ent = create_proc_entry(ndev->name, S_IFREG|S_IRUGO, vlsi_proc_root);
                if (!ent) {
-                       WARNING("%s: failed to create proc entry\n", __FUNCTION__);
+                       IRDA_WARNING("%s: failed to create proc entry\n",
+                                    __FUNCTION__);
                } else {
                        ent->data = ndev;
                        ent->proc_fops = VLSI_PROC_FOPS;
@@ -1683,7 +1690,7 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                }
                idev->proc_entry = ent;
        }
-       MESSAGE("%s: registered device %s\n", drivername, ndev->name);
+       IRDA_MESSAGE("%s: registered device %s\n", drivername, ndev->name);
 
        pci_set_drvdata(pdev, ndev);
        up(&idev->sem);
@@ -1706,7 +1713,7 @@ static void __devexit vlsi_irda_remove(struct pci_dev *pdev)
        vlsi_irda_dev_t *idev;
 
        if (!ndev) {
-               ERROR("%s: lost netdevice?\n", drivername);
+               IRDA_ERROR("%s: lost netdevice?\n", drivername);
                return;
        }
 
@@ -1724,7 +1731,7 @@ static void __devexit vlsi_irda_remove(struct pci_dev *pdev)
 
        pci_set_drvdata(pdev, NULL);
 
-       MESSAGE("%s: %s removed\n", drivername, PCIDEV_NAME(pdev));
+       IRDA_MESSAGE("%s: %s removed\n", drivername, PCIDEV_NAME(pdev));
 }
 
 #ifdef CONFIG_PM
@@ -1737,18 +1744,19 @@ static void __devexit vlsi_irda_remove(struct pci_dev *pdev)
  */
 
 
-static int vlsi_irda_suspend(struct pci_dev *pdev, u32 state)
+static int vlsi_irda_suspend(struct pci_dev *pdev, pm_message_t state)
 {
        struct net_device *ndev = pci_get_drvdata(pdev);
        vlsi_irda_dev_t *idev;
 
        if (state < 1 || state > 3 ) {
-               ERROR("%s - %s: invalid pm state request: %u\n",
-                       __FUNCTION__, PCIDEV_NAME(pdev), state);
+               IRDA_ERROR("%s - %s: invalid pm state request: %u\n",
+                          __FUNCTION__, PCIDEV_NAME(pdev), state);
                return 0;
        }
        if (!ndev) {
-               ERROR("%s - %s: no netdevice \n", __FUNCTION__, PCIDEV_NAME(pdev));
+               IRDA_ERROR("%s - %s: no netdevice \n",
+                          __FUNCTION__, PCIDEV_NAME(pdev));
                return 0;
        }
        idev = ndev->priv;      
@@ -1759,8 +1767,7 @@ static int vlsi_irda_suspend(struct pci_dev *pdev, u32 state)
                        pdev->current_state = state;
                }
                else
-                       ERROR("%s - %s: invalid suspend request %u -> %u\n",
-                               __FUNCTION__, PCIDEV_NAME(pdev), pdev->current_state, state);
+                       IRDA_ERROR("%s - %s: invalid suspend request %u -> %u\n", __FUNCTION__, PCIDEV_NAME(pdev), pdev->current_state, state);
                up(&idev->sem);
                return 0;
        }
@@ -1787,14 +1794,16 @@ static int vlsi_irda_resume(struct pci_dev *pdev)
        vlsi_irda_dev_t *idev;
 
        if (!ndev) {
-               ERROR("%s - %s: no netdevice \n", __FUNCTION__, PCIDEV_NAME(pdev));
+               IRDA_ERROR("%s - %s: no netdevice \n",
+                          __FUNCTION__, PCIDEV_NAME(pdev));
                return 0;
        }
        idev = ndev->priv;      
        down(&idev->sem);
        if (pdev->current_state == 0) {
                up(&idev->sem);
-               WARNING("%s - %s: already resumed\n", __FUNCTION__, PCIDEV_NAME(pdev));
+               IRDA_WARNING("%s - %s: already resumed\n",
+                            __FUNCTION__, PCIDEV_NAME(pdev));
                return 0;
        }
        
@@ -1813,7 +1822,7 @@ static int vlsi_irda_resume(struct pci_dev *pdev)
                 * now we explicitly set pdev->current_state = 0 after enabling the
                 * device and independently resume_ok should catch any garbage config.
                 */
-               WARNING("%s - hm, nothing to resume?\n", __FUNCTION__);
+               IRDA_WARNING("%s - hm, nothing to resume?\n", __FUNCTION__);
                up(&idev->sem);
                return 0;
        }
@@ -1850,7 +1859,7 @@ static int __init vlsi_mod_init(void)
        int     i, ret;
 
        if (clksrc < 0  ||  clksrc > 3) {
-               ERROR("%s: invalid clksrc=%d\n", drivername, clksrc);
+               IRDA_ERROR("%s: invalid clksrc=%d\n", drivername, clksrc);
                return -1;
        }
 
@@ -1863,8 +1872,7 @@ static int __init vlsi_mod_init(void)
                        case 64:
                                break;
                        default:
-                               WARNING("%s: invalid %s ringsize %d, using default=8",
-                                       drivername, (i)?"rx":"tx", ringsize[i]);
+                               IRDA_WARNING("%s: invalid %s ringsize %d, using default=8", drivername, (i)?"rx":"tx", ringsize[i]);
                                ringsize[i] = 8;
                                break;
                }