Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec...
[cascardo/linux.git] / drivers / net / irda / via-ircc.c
index b07b4cc..6960d4c 100644 (file)
@@ -144,12 +144,10 @@ static int __init via_ircc_init(void)
 {
        int rc;
 
-       IRDA_DEBUG(3, "%s()\n", __func__);
-
        rc = pci_register_driver(&via_driver);
        if (rc < 0) {
-               IRDA_DEBUG(0, "%s(): error rc = %d, returning  -ENODEV...\n",
-                          __func__, rc);
+               pr_debug("%s(): error rc = %d, returning  -ENODEV...\n",
+                        __func__, rc);
                return -ENODEV;
        }
        return 0;
@@ -162,11 +160,11 @@ static int via_init_one(struct pci_dev *pcidev, const struct pci_device_id *id)
        u16 Chipset,FirDRQ1,FirDRQ0,FirIRQ,FirIOBase;
        chipio_t info;
 
-       IRDA_DEBUG(2, "%s(): Device ID=(0X%X)\n", __func__, id->device);
+       pr_debug("%s(): Device ID=(0X%X)\n", __func__, id->device);
 
        rc = pci_enable_device (pcidev);
        if (rc) {
-               IRDA_DEBUG(0, "%s(): error rc = %d\n", __func__, rc);
+               pr_debug("%s(): error rc = %d\n", __func__, rc);
                return -ENODEV;
        }
 
@@ -177,7 +175,7 @@ static int via_init_one(struct pci_dev *pcidev, const struct pci_device_id *id)
                Chipset=0x3076;
 
        if (Chipset==0x3076) {
-               IRDA_DEBUG(2, "%s(): Chipset = 3076\n", __func__);
+               pr_debug("%s(): Chipset = 3076\n", __func__);
 
                WriteLPCReg(7,0x0c );
                temp=ReadLPCReg(0x30);//check if BIOS Enable Fir
@@ -213,7 +211,7 @@ static int via_init_one(struct pci_dev *pcidev, const struct pci_device_id *id)
                } else
                        rc = -ENODEV; //IR not turn on   
        } else { //Not VT1211
-               IRDA_DEBUG(2, "%s(): Chipset = 3096\n", __func__);
+               pr_debug("%s(): Chipset = 3096\n", __func__);
 
                pci_read_config_byte(pcidev,0x67,&bTmp);//check if BIOS Enable Fir
                if((bTmp&0x01)==1) {  // BIOS enable FIR
@@ -252,14 +250,12 @@ static int via_init_one(struct pci_dev *pcidev, const struct pci_device_id *id)
                        rc = -ENODEV; //IR not turn on !!!!!
        }//Not VT1211
 
-       IRDA_DEBUG(2, "%s(): End - rc = %d\n", __func__, rc);
+       pr_debug("%s(): End - rc = %d\n", __func__, rc);
        return rc;
 }
 
 static void __exit via_ircc_cleanup(void)
 {
-       IRDA_DEBUG(3, "%s()\n", __func__);
-
        /* Cleanup all instances of the driver */
        pci_unregister_driver (&via_driver); 
 }
@@ -289,8 +285,6 @@ static int via_ircc_open(struct pci_dev *pdev, chipio_t *info, unsigned int id)
        struct via_ircc_cb *self;
        int err;
 
-       IRDA_DEBUG(3, "%s()\n", __func__);
-
        /* Allocate new instance of the driver */
        dev = alloc_irdadev(sizeof(struct via_ircc_cb));
        if (dev == NULL) 
@@ -316,8 +310,8 @@ static int via_ircc_open(struct pci_dev *pdev, chipio_t *info, unsigned int id)
 
        /* Reserve the ioports that we need */
        if (!request_region(self->io.fir_base, self->io.fir_ext, driver_name)) {
-               IRDA_DEBUG(0, "%s(), can't get iobase of 0x%03x\n",
-                          __func__, self->io.fir_base);
+               pr_debug("%s(), can't get iobase of 0x%03x\n",
+                        __func__, self->io.fir_base);
                err = -ENODEV;
                goto err_out1;
        }
@@ -423,8 +417,6 @@ static void via_remove_one(struct pci_dev *pdev)
        struct via_ircc_cb *self = pci_get_drvdata(pdev);
        int iobase;
 
-       IRDA_DEBUG(3, "%s()\n", __func__);
-
        iobase = self->io.fir_base;
 
        ResetChip(iobase, 5);   //hardware reset.
@@ -432,8 +424,8 @@ static void via_remove_one(struct pci_dev *pdev)
        unregister_netdev(self->netdev);
 
        /* Release the PORT that this driver is using */
-       IRDA_DEBUG(2, "%s(), Releasing Region %03x\n",
-                  __func__, self->io.fir_base);
+       pr_debug("%s(), Releasing Region %03x\n",
+                __func__, self->io.fir_base);
        release_region(self->io.fir_base, self->io.fir_ext);
        if (self->tx_buff.head)
                dma_free_coherent(&pdev->dev, self->tx_buff.truesize,
@@ -458,8 +450,6 @@ static void via_hw_init(struct via_ircc_cb *self)
 {
        int iobase = self->io.fir_base;
 
-       IRDA_DEBUG(3, "%s()\n", __func__);
-
        SetMaxRxPacketSize(iobase, 0x0fff);     //set to max:4095
        // FIFO Init
        EnRXFIFOReadyInt(iobase, OFF);
@@ -528,8 +518,8 @@ static void via_ircc_change_dongle_speed(int iobase, int speed,
        /* speed is unused, as we use IsSIROn()/IsMIROn() */
        speed = speed;
 
-       IRDA_DEBUG(1, "%s(): change_dongle_speed to %d for 0x%x, %d\n",
-                  __func__, speed, iobase, dongle_id);
+       pr_debug("%s(): change_dongle_speed to %d for 0x%x, %d\n",
+                __func__, speed, iobase, dongle_id);
 
        switch (dongle_id) {
 
@@ -618,7 +608,8 @@ static void via_ircc_change_dongle_speed(int iobase, int speed,
 
        case 0x11:              /* Temic TFDS4500 */
 
-               IRDA_DEBUG(2, "%s: Temic TFDS4500: One RX pin, TX normal, RX inverted.\n", __func__);
+               pr_debug("%s: Temic TFDS4500: One RX pin, TX normal, RX inverted\n",
+                        __func__);
 
                UseOneRX(iobase, ON);   //use ONE RX....RX1
                InvertTX(iobase, OFF);
@@ -636,7 +627,8 @@ static void via_ircc_change_dongle_speed(int iobase, int speed,
                        SlowIRRXLowActive(iobase, OFF);
 
                } else{
-                       IRDA_DEBUG(0, "%s: Warning: TFDS4500 not running in SIR mode !\n", __func__);
+                       pr_debug("%s: Warning: TFDS4500 not running in SIR mode !\n",
+                                __func__);
                }
                break;
 
@@ -673,7 +665,7 @@ static void via_ircc_change_speed(struct via_ircc_cb *self, __u32 speed)
        iobase = self->io.fir_base;
        /* Update accounting for new speed */
        self->io.speed = speed;
-       IRDA_DEBUG(1, "%s: change_speed to %d bps.\n", __func__, speed);
+       pr_debug("%s: change_speed to %d bps.\n", __func__, speed);
 
        WriteReg(iobase, I_ST_CT_0, 0x0);
 
@@ -903,10 +895,10 @@ static int via_ircc_dma_xmit(struct via_ircc_cb *self, u16 iobase)
                       ((u8 *)self->tx_fifo.queue[self->tx_fifo.ptr].start -
                        self->tx_buff.head) + self->tx_buff_dma,
                       self->tx_fifo.queue[self->tx_fifo.ptr].len, DMA_TX_MODE);
-       IRDA_DEBUG(1, "%s: tx_fifo.ptr=%x,len=%x,tx_fifo.len=%x..\n",
-                  __func__, self->tx_fifo.ptr,
-                  self->tx_fifo.queue[self->tx_fifo.ptr].len,
-                  self->tx_fifo.len);
+       pr_debug("%s: tx_fifo.ptr=%x,len=%x,tx_fifo.len=%x..\n",
+                __func__, self->tx_fifo.ptr,
+                self->tx_fifo.queue[self->tx_fifo.ptr].len,
+                self->tx_fifo.len);
 
        SetSendByte(iobase, self->tx_fifo.queue[self->tx_fifo.ptr].len);
        RXStart(iobase, OFF);
@@ -927,8 +919,6 @@ static int via_ircc_dma_xmit_complete(struct via_ircc_cb *self)
        int iobase;
        u8 Tx_status;
 
-       IRDA_DEBUG(3, "%s()\n", __func__);
-
        iobase = self->io.fir_base;
        /* Disable DMA */
 //      DisableDmaChannel(self->io.dma);
@@ -958,10 +948,9 @@ static int via_ircc_dma_xmit_complete(struct via_ircc_cb *self)
                        self->tx_fifo.ptr++;
                }
        }
-       IRDA_DEBUG(1,
-                  "%s: tx_fifo.len=%x ,tx_fifo.ptr=%x,tx_fifo.free=%x...\n",
-                  __func__,
-                  self->tx_fifo.len, self->tx_fifo.ptr, self->tx_fifo.free);
+       pr_debug("%s: tx_fifo.len=%x ,tx_fifo.ptr=%x,tx_fifo.free=%x...\n",
+                __func__,
+                self->tx_fifo.len, self->tx_fifo.ptr, self->tx_fifo.free);
 /* F01_S
        // Any frames to be sent back-to-back? 
        if (self->tx_fifo.len) {
@@ -996,8 +985,6 @@ static int via_ircc_dma_receive(struct via_ircc_cb *self)
 
        iobase = self->io.fir_base;
 
-       IRDA_DEBUG(3, "%s()\n", __func__);
-
        self->tx_fifo.len = self->tx_fifo.ptr = self->tx_fifo.free = 0;
        self->tx_fifo.tail = self->tx_buff.head;
        self->RxDataReady = 0;
@@ -1079,15 +1066,15 @@ static int via_ircc_dma_receive_complete(struct via_ircc_cb *self,
                if (len == 0)
                        return TRUE;    //interrupt only, data maybe move by RxT  
                if (((len - 4) < 2) || ((len - 4) > 2048)) {
-                       IRDA_DEBUG(1, "%s(): Trouble:len=%x,CurCount=%x,LastCount=%x..\n",
-                                  __func__, len, RxCurCount(iobase, self),
-                                  self->RxLastCount);
+                       pr_debug("%s(): Trouble:len=%x,CurCount=%x,LastCount=%x\n",
+                                __func__, len, RxCurCount(iobase, self),
+                                self->RxLastCount);
                        hwreset(self);
                        return FALSE;
                }
-               IRDA_DEBUG(2, "%s(): fifo.len=%x,len=%x,CurCount=%x..\n",
-                          __func__,
-                          st_fifo->len, len - 4, RxCurCount(iobase, self));
+               pr_debug("%s(): fifo.len=%x,len=%x,CurCount=%x..\n",
+                        __func__,
+                        st_fifo->len, len - 4, RxCurCount(iobase, self));
 
                st_fifo->entries[st_fifo->tail].status = status;
                st_fifo->entries[st_fifo->tail].len = len;
@@ -1134,8 +1121,8 @@ F01_E */
                skb_put(skb, len - 4);
 
                skb_copy_to_linear_data(skb, self->rx_buff.data, len - 4);
-               IRDA_DEBUG(2, "%s(): len=%x.rx_buff=%p\n", __func__,
-                          len - 4, self->rx_buff.data);
+               pr_debug("%s(): len=%x.rx_buff=%p\n", __func__,
+                        len - 4, self->rx_buff.data);
 
                // Move to next frame 
                self->rx_buff.data += len;
@@ -1164,7 +1151,7 @@ static int upload_rxdata(struct via_ircc_cb *self, int iobase)
 
        len = GetRecvByte(iobase, self);
 
-       IRDA_DEBUG(2, "%s(): len=%x\n", __func__, len);
+       pr_debug("%s(): len=%x\n", __func__, len);
 
        if ((len - 4) < 2) {
                self->netdev->stats.rx_dropped++;
@@ -1249,8 +1236,8 @@ static int RxTimerHandler(struct via_ircc_cb *self, int iobase)
                        skb_put(skb, len - 4);
                        skb_copy_to_linear_data(skb, self->rx_buff.data, len - 4);
 
-                       IRDA_DEBUG(2, "%s(): len=%x.head=%x\n", __func__,
-                                  len - 4, st_fifo->head);
+                       pr_debug("%s(): len=%x.head=%x\n", __func__,
+                                len - 4, st_fifo->head);
 
                        // Move to next frame 
                        self->rx_buff.data += len;
@@ -1263,10 +1250,8 @@ static int RxTimerHandler(struct via_ircc_cb *self, int iobase)
                }               //while
                self->RetryCount = 0;
 
-               IRDA_DEBUG(2,
-                          "%s(): End of upload HostStatus=%x,RxStatus=%x\n",
-                          __func__,
-                          GetHostStatus(iobase), GetRXStatus(iobase));
+               pr_debug("%s(): End of upload HostStatus=%x,RxStatus=%x\n",
+                        __func__, GetHostStatus(iobase), GetRXStatus(iobase));
 
                /*
                 * if frame is receive complete at this routine ,then upload
@@ -1304,12 +1289,12 @@ static irqreturn_t via_ircc_interrupt(int dummy, void *dev_id)
        spin_lock(&self->lock);
        iHostIntType = GetHostStatus(iobase);
 
-       IRDA_DEBUG(4, "%s(): iHostIntType %02x:  %s %s %s  %02x\n",
-                  __func__, iHostIntType,
-                  (iHostIntType & 0x40) ? "Timer" : "",
-                  (iHostIntType & 0x20) ? "Tx" : "",
-                  (iHostIntType & 0x10) ? "Rx" : "",
-                  (iHostIntType & 0x0e) >> 1);
+       pr_debug("%s(): iHostIntType %02x:  %s %s %s  %02x\n",
+                __func__, iHostIntType,
+                (iHostIntType & 0x40) ? "Timer" : "",
+                (iHostIntType & 0x20) ? "Tx" : "",
+                (iHostIntType & 0x10) ? "Rx" : "",
+                (iHostIntType & 0x0e) >> 1);
 
        if ((iHostIntType & 0x40) != 0) {       //Timer Event
                self->EventFlag.TimeOut++;
@@ -1334,12 +1319,12 @@ static irqreturn_t via_ircc_interrupt(int dummy, void *dev_id)
        if ((iHostIntType & 0x20) != 0) {       //Tx Event
                iTxIntType = GetTXStatus(iobase);
 
-               IRDA_DEBUG(4, "%s(): iTxIntType %02x:  %s %s %s %s\n",
-                          __func__, iTxIntType,
-                          (iTxIntType & 0x08) ? "FIFO underr." : "",
-                          (iTxIntType & 0x04) ? "EOM" : "",
-                          (iTxIntType & 0x02) ? "FIFO ready" : "",
-                          (iTxIntType & 0x01) ? "Early EOM" : "");
+               pr_debug("%s(): iTxIntType %02x:  %s %s %s %s\n",
+                        __func__, iTxIntType,
+                        (iTxIntType & 0x08) ? "FIFO underr." : "",
+                        (iTxIntType & 0x04) ? "EOM" : "",
+                        (iTxIntType & 0x02) ? "FIFO ready" : "",
+                        (iTxIntType & 0x01) ? "Early EOM" : "");
 
                if (iTxIntType & 0x4) {
                        self->EventFlag.EOMessage++;    // read and will auto clean
@@ -1358,17 +1343,17 @@ static irqreturn_t via_ircc_interrupt(int dummy, void *dev_id)
                /* Check if DMA has finished */
                iRxIntType = GetRXStatus(iobase);
 
-               IRDA_DEBUG(4, "%s(): iRxIntType %02x:  %s %s %s %s %s %s %s\n",
-                          __func__, iRxIntType,
-                          (iRxIntType & 0x80) ? "PHY err."     : "",
-                          (iRxIntType & 0x40) ? "CRC err"      : "",
-                          (iRxIntType & 0x20) ? "FIFO overr."  : "",
-                          (iRxIntType & 0x10) ? "EOF"          : "",
-                          (iRxIntType & 0x08) ? "RxData"       : "",
-                          (iRxIntType & 0x02) ? "RxMaxLen"     : "",
-                          (iRxIntType & 0x01) ? "SIR bad"      : "");
+               pr_debug("%s(): iRxIntType %02x:  %s %s %s %s %s %s %s\n",
+                        __func__, iRxIntType,
+                        (iRxIntType & 0x80) ? "PHY err."       : "",
+                        (iRxIntType & 0x40) ? "CRC err"        : "",
+                        (iRxIntType & 0x20) ? "FIFO overr."    : "",
+                        (iRxIntType & 0x10) ? "EOF"            : "",
+                        (iRxIntType & 0x08) ? "RxData"         : "",
+                        (iRxIntType & 0x02) ? "RxMaxLen"       : "",
+                        (iRxIntType & 0x01) ? "SIR bad"        : "");
                if (!iRxIntType)
-                       IRDA_DEBUG(3, "%s(): RxIRQ =0\n", __func__);
+                       pr_debug("%s(): RxIRQ =0\n", __func__);
 
                if (iRxIntType & 0x10) {
                        if (via_ircc_dma_receive_complete(self, iobase)) {
@@ -1377,10 +1362,9 @@ static irqreturn_t via_ircc_interrupt(int dummy, void *dev_id)
                        }
                }               // No ERR     
                else {          //ERR
-                       IRDA_DEBUG(4, "%s(): RxIRQ ERR:iRxIntType=%x,HostIntType=%x,CurCount=%x,RxLastCount=%x_____\n",
-                                  __func__, iRxIntType, iHostIntType,
-                                  RxCurCount(iobase, self),
-                                  self->RxLastCount);
+                       pr_debug("%s(): RxIRQ ERR:iRxIntType=%x,HostIntType=%x,CurCount=%x,RxLastCount=%x_____\n",
+                                __func__, iRxIntType, iHostIntType,
+                                RxCurCount(iobase, self), self->RxLastCount);
 
                        if (iRxIntType & 0x20) {        //FIFO OverRun ERR
                                ResetChip(iobase, 0);
@@ -1403,8 +1387,6 @@ static void hwreset(struct via_ircc_cb *self)
        int iobase;
        iobase = self->io.fir_base;
 
-       IRDA_DEBUG(3, "%s()\n", __func__);
-
        ResetChip(iobase, 5);
        EnableDMA(iobase, OFF);
        EnableTX(iobase, OFF);
@@ -1448,7 +1430,7 @@ static int via_ircc_is_receiving(struct via_ircc_cb *self)
        if (CkRxRecv(iobase, self))
                status = TRUE;
 
-       IRDA_DEBUG(2, "%s(): status=%x....\n", __func__, status);
+       pr_debug("%s(): status=%x....\n", __func__, status);
 
        return status;
 }
@@ -1466,8 +1448,6 @@ static int via_ircc_net_open(struct net_device *dev)
        int iobase;
        char hwname[32];
 
-       IRDA_DEBUG(3, "%s()\n", __func__);
-
        IRDA_ASSERT(dev != NULL, return -1;);
        self = netdev_priv(dev);
        dev->stats.rx_packets = 0;
@@ -1533,8 +1513,6 @@ static int via_ircc_net_close(struct net_device *dev)
        struct via_ircc_cb *self;
        int iobase;
 
-       IRDA_DEBUG(3, "%s()\n", __func__);
-
        IRDA_ASSERT(dev != NULL, return -1;);
        self = netdev_priv(dev);
        IRDA_ASSERT(self != NULL, return 0;);
@@ -1577,8 +1555,8 @@ static int via_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq,
        IRDA_ASSERT(dev != NULL, return -1;);
        self = netdev_priv(dev);
        IRDA_ASSERT(self != NULL, return -1;);
-       IRDA_DEBUG(1, "%s(), %s, (cmd=0x%X)\n", __func__, dev->name,
-                  cmd);
+       pr_debug("%s(), %s, (cmd=0x%X)\n", __func__, dev->name,
+                cmd);
        /* Disable interrupts & save flags */
        spin_lock_irqsave(&self->lock, flags);
        switch (cmd) {