aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tulip/xircom_cb.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-05-09 05:45:21 -0400
committerDavid S. Miller <davem@davemloft.net>2011-05-09 15:51:15 -0400
commit163ef0b5922b14751e93218bdf2c9fe8f74b9c9d (patch)
tree9a4179070e26d63170ec005e1f9ffff48b0e541b /drivers/net/tulip/xircom_cb.c
parent54668b84bd2ee808e6b43ed9bd7aa3338fa95857 (diff)
tulip: Convert printks to netdev_<level>
Use the current more descriptive logging styles. Add pr_fmt and remove PFX where appropriate. Use netif_<level>, netdev_<level> Indent a few blocks in xircom_cb where appropriate. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tulip/xircom_cb.c')
-rw-r--r--drivers/net/tulip/xircom_cb.c132
1 files changed, 71 insertions, 61 deletions
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
index d0d0cbe3dc17..7e8287260c2f 100644
--- a/drivers/net/tulip/xircom_cb.c
+++ b/drivers/net/tulip/xircom_cb.c
@@ -262,8 +262,8 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
262 goto reg_fail; 262 goto reg_fail;
263 } 263 }
264 264
265 dev_info(&dev->dev, "Xircom cardbus revision %i at irq %i\n", 265 netdev_info(dev, "Xircom cardbus revision %i at irq %i\n",
266 pdev->revision, pdev->irq); 266 pdev->revision, pdev->irq);
267 /* start the transmitter to get a heartbeat */ 267 /* start the transmitter to get a heartbeat */
268 /* TODO: send 2 dummy packets here */ 268 /* TODO: send 2 dummy packets here */
269 transceiver_voodoo(private); 269 transceiver_voodoo(private);
@@ -335,7 +335,7 @@ static irqreturn_t xircom_interrupt(int irq, void *dev_instance)
335 int newlink; 335 int newlink;
336 printk(KERN_DEBUG "xircom_cb: Link status has changed\n"); 336 printk(KERN_DEBUG "xircom_cb: Link status has changed\n");
337 newlink = link_status(card); 337 newlink = link_status(card);
338 dev_info(&dev->dev, "Link is %i mbit\n", newlink); 338 netdev_info(dev, "Link is %d mbit\n", newlink);
339 if (newlink) 339 if (newlink)
340 netif_carrier_on(dev); 340 netif_carrier_on(dev);
341 else 341 else
@@ -426,8 +426,8 @@ static int xircom_open(struct net_device *dev)
426 struct xircom_private *xp = netdev_priv(dev); 426 struct xircom_private *xp = netdev_priv(dev);
427 int retval; 427 int retval;
428 428
429 pr_info("xircom cardbus adaptor found, registering as %s, using irq %i\n", 429 netdev_info(dev, "xircom cardbus adaptor found, using irq %i\n",
430 dev->name, dev->irq); 430 dev->irq);
431 retval = request_irq(dev->irq, xircom_interrupt, IRQF_SHARED, dev->name, dev); 431 retval = request_irq(dev->irq, xircom_interrupt, IRQF_SHARED, dev->name, dev);
432 if (retval) 432 if (retval)
433 return retval; 433 return retval;
@@ -703,7 +703,7 @@ static void activate_receiver(struct xircom_private *card)
703 udelay(50); 703 udelay(50);
704 counter--; 704 counter--;
705 if (counter <= 0) 705 if (counter <= 0)
706 pr_err("Receiver failed to deactivate\n"); 706 netdev_err(card->dev, "Receiver failed to deactivate\n");
707 } 707 }
708 708
709 /* enable the receiver */ 709 /* enable the receiver */
@@ -720,7 +720,8 @@ static void activate_receiver(struct xircom_private *card)
720 udelay(50); 720 udelay(50);
721 counter--; 721 counter--;
722 if (counter <= 0) 722 if (counter <= 0)
723 pr_err("Receiver failed to re-activate\n"); 723 netdev_err(card->dev,
724 "Receiver failed to re-activate\n");
724 } 725 }
725} 726}
726 727
@@ -748,7 +749,7 @@ static void deactivate_receiver(struct xircom_private *card)
748 udelay(50); 749 udelay(50);
749 counter--; 750 counter--;
750 if (counter <= 0) 751 if (counter <= 0)
751 pr_err("Receiver failed to deactivate\n"); 752 netdev_err(card->dev, "Receiver failed to deactivate\n");
752 } 753 }
753} 754}
754 755
@@ -786,7 +787,8 @@ static void activate_transmitter(struct xircom_private *card)
786 udelay(50); 787 udelay(50);
787 counter--; 788 counter--;
788 if (counter <= 0) 789 if (counter <= 0)
789 pr_err("Transmitter failed to deactivate\n"); 790 netdev_err(card->dev,
791 "Transmitter failed to deactivate\n");
790 } 792 }
791 793
792 /* enable the transmitter */ 794 /* enable the transmitter */
@@ -803,7 +805,8 @@ static void activate_transmitter(struct xircom_private *card)
803 udelay(50); 805 udelay(50);
804 counter--; 806 counter--;
805 if (counter <= 0) 807 if (counter <= 0)
806 pr_err("Transmitter failed to re-activate\n"); 808 netdev_err(card->dev,
809 "Transmitter failed to re-activate\n");
807 } 810 }
808} 811}
809 812
@@ -831,7 +834,8 @@ static void deactivate_transmitter(struct xircom_private *card)
831 udelay(50); 834 udelay(50);
832 counter--; 835 counter--;
833 if (counter <= 0) 836 if (counter <= 0)
834 pr_err("Transmitter failed to deactivate\n"); 837 netdev_err(card->dev,
838 "Transmitter failed to deactivate\n");
835 } 839 }
836} 840}
837 841
@@ -1060,75 +1064,81 @@ static void xircom_up(struct xircom_private *card)
1060} 1064}
1061 1065
1062/* Bufferoffset is in BYTES */ 1066/* Bufferoffset is in BYTES */
1063static void investigate_read_descriptor(struct net_device *dev,struct xircom_private *card, int descnr, unsigned int bufferoffset) 1067static void
1068investigate_read_descriptor(struct net_device *dev, struct xircom_private *card,
1069 int descnr, unsigned int bufferoffset)
1064{ 1070{
1065 int status; 1071 int status;
1066 1072
1067 status = le32_to_cpu(card->rx_buffer[4*descnr]); 1073 status = le32_to_cpu(card->rx_buffer[4*descnr]);
1068 1074
1069 if ((status > 0)) { /* packet received */ 1075 if (status > 0) { /* packet received */
1070 1076
1071 /* TODO: discard error packets */ 1077 /* TODO: discard error packets */
1072 1078
1073 short pkt_len = ((status >> 16) & 0x7ff) - 4; /* minus 4, we don't want the CRC */ 1079 short pkt_len = ((status >> 16) & 0x7ff) - 4;
1074 struct sk_buff *skb; 1080 /* minus 4, we don't want the CRC */
1081 struct sk_buff *skb;
1075 1082
1076 if (pkt_len > 1518) { 1083 if (pkt_len > 1518) {
1077 pr_err("Packet length %i is bogus\n", pkt_len); 1084 netdev_err(dev, "Packet length %i is bogus\n", pkt_len);
1078 pkt_len = 1518; 1085 pkt_len = 1518;
1079 } 1086 }
1080 1087
1081 skb = dev_alloc_skb(pkt_len + 2); 1088 skb = dev_alloc_skb(pkt_len + 2);
1082 if (skb == NULL) { 1089 if (skb == NULL) {
1083 dev->stats.rx_dropped++; 1090 dev->stats.rx_dropped++;
1084 goto out; 1091 goto out;
1085 }
1086 skb_reserve(skb, 2);
1087 skb_copy_to_linear_data(skb, (unsigned char*)&card->rx_buffer[bufferoffset / 4], pkt_len);
1088 skb_put(skb, pkt_len);
1089 skb->protocol = eth_type_trans(skb, dev);
1090 netif_rx(skb);
1091 dev->stats.rx_packets++;
1092 dev->stats.rx_bytes += pkt_len;
1093
1094 out:
1095 /* give the buffer back to the card */
1096 card->rx_buffer[4*descnr] = cpu_to_le32(0x80000000);
1097 trigger_receive(card);
1098 } 1092 }
1093 skb_reserve(skb, 2);
1094 skb_copy_to_linear_data(skb,
1095 &card->rx_buffer[bufferoffset / 4],
1096 pkt_len);
1097 skb_put(skb, pkt_len);
1098 skb->protocol = eth_type_trans(skb, dev);
1099 netif_rx(skb);
1100 dev->stats.rx_packets++;
1101 dev->stats.rx_bytes += pkt_len;
1102
1103out:
1104 /* give the buffer back to the card */
1105 card->rx_buffer[4*descnr] = cpu_to_le32(0x80000000);
1106 trigger_receive(card);
1107 }
1099} 1108}
1100 1109
1101 1110
1102/* Bufferoffset is in BYTES */ 1111/* Bufferoffset is in BYTES */
1103static void investigate_write_descriptor(struct net_device *dev, struct xircom_private *card, int descnr, unsigned int bufferoffset) 1112static void
1113investigate_write_descriptor(struct net_device *dev,
1114 struct xircom_private *card,
1115 int descnr, unsigned int bufferoffset)
1104{ 1116{
1105 int status; 1117 int status;
1106 1118
1107 status = le32_to_cpu(card->tx_buffer[4*descnr]); 1119 status = le32_to_cpu(card->tx_buffer[4*descnr]);
1108#if 0 1120#if 0
1109 if (status & 0x8000) { /* Major error */ 1121 if (status & 0x8000) { /* Major error */
1110 pr_err("Major transmit error status %x\n", status); 1122 pr_err("Major transmit error status %x\n", status);
1111 card->tx_buffer[4*descnr] = 0; 1123 card->tx_buffer[4*descnr] = 0;
1112 netif_wake_queue (dev); 1124 netif_wake_queue (dev);
1113 } 1125 }
1114#endif 1126#endif
1115 if (status > 0) { /* bit 31 is 0 when done */ 1127 if (status > 0) { /* bit 31 is 0 when done */
1116 if (card->tx_skb[descnr]!=NULL) { 1128 if (card->tx_skb[descnr]!=NULL) {
1117 dev->stats.tx_bytes += card->tx_skb[descnr]->len; 1129 dev->stats.tx_bytes += card->tx_skb[descnr]->len;
1118 dev_kfree_skb_irq(card->tx_skb[descnr]); 1130 dev_kfree_skb_irq(card->tx_skb[descnr]);
1119 }
1120 card->tx_skb[descnr] = NULL;
1121 /* Bit 8 in the status field is 1 if there was a collision */
1122 if (status&(1<<8))
1123 dev->stats.collisions++;
1124 card->tx_buffer[4*descnr] = 0; /* descriptor is free again */
1125 netif_wake_queue (dev);
1126 dev->stats.tx_packets++;
1127 } 1131 }
1128 1132 card->tx_skb[descnr] = NULL;
1133 /* Bit 8 in the status field is 1 if there was a collision */
1134 if (status & (1 << 8))
1135 dev->stats.collisions++;
1136 card->tx_buffer[4*descnr] = 0; /* descriptor is free again */
1137 netif_wake_queue (dev);
1138 dev->stats.tx_packets++;
1139 }
1129} 1140}
1130 1141
1131
1132static int __init xircom_init(void) 1142static int __init xircom_init(void)
1133{ 1143{
1134 return pci_register_driver(&xircom_ops); 1144 return pci_register_driver(&xircom_ops);