aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2009-10-24 09:51:05 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2009-11-09 02:30:00 -0500
commitdd0fab5b940c0b65f26ac5b01485bac1f690ace6 (patch)
tree5730c0c243949e935ea982efa79ed1cd06cc2297
parente773cfe167c320d07b9423bc51fc4ab0221775a4 (diff)
pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (net)
Convert PCMCIA drivers to use the dynamic debug infrastructure, instead of requiring manual settings of PCMCIA_DEBUG. Only some rare debug checks are now hidden behind "#ifdef DEBUG" or "#if 0". Also, remove all usages of the CS_CHECK macro and replace them with proper Linux style calling and return value checking. The extra error reporting may be dropped, as the PCMCIA core already complains about any (non-driver-author) errors. CC: netdev@vger.kernel.org Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
-rw-r--r--drivers/net/pcmcia/3c574_cs.c66
-rw-r--r--drivers/net/pcmcia/3c589_cs.c75
-rw-r--r--drivers/net/pcmcia/axnet_cs.c53
-rw-r--r--drivers/net/pcmcia/com20020_cs.c55
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c109
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c54
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c148
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c67
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c85
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c109
10 files changed, 315 insertions, 506 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 6449290c62ff..dbef5d9cc9db 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -118,14 +118,6 @@ INT_MODULE_PARM(full_duplex, 0);
118/* Autodetect link polarity reversal? */ 118/* Autodetect link polarity reversal? */
119INT_MODULE_PARM(auto_polarity, 1); 119INT_MODULE_PARM(auto_polarity, 1);
120 120
121#ifdef PCMCIA_DEBUG
122INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
123#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
124static char *version =
125"3c574_cs.c 1.65ac1 2003/04/07 Donald Becker/David Hinds, becker@scyld.com.\n";
126#else
127#define DEBUG(n, args...)
128#endif
129 121
130/*====================================================================*/ 122/*====================================================================*/
131 123
@@ -278,7 +270,7 @@ static int tc574_probe(struct pcmcia_device *link)
278 struct el3_private *lp; 270 struct el3_private *lp;
279 struct net_device *dev; 271 struct net_device *dev;
280 272
281 DEBUG(0, "3c574_attach()\n"); 273 dev_dbg(&link->dev, "3c574_attach()\n");
282 274
283 /* Create the PC card device object. */ 275 /* Create the PC card device object. */
284 dev = alloc_etherdev(sizeof(struct el3_private)); 276 dev = alloc_etherdev(sizeof(struct el3_private));
@@ -319,7 +311,7 @@ static void tc574_detach(struct pcmcia_device *link)
319{ 311{
320 struct net_device *dev = link->priv; 312 struct net_device *dev = link->priv;
321 313
322 DEBUG(0, "3c574_detach(0x%p)\n", link); 314 dev_dbg(&link->dev, "3c574_detach()\n");
323 315
324 if (link->dev_node) 316 if (link->dev_node)
325 unregister_netdev(dev); 317 unregister_netdev(dev);
@@ -335,16 +327,13 @@ static void tc574_detach(struct pcmcia_device *link)
335 ethernet device available to the system. 327 ethernet device available to the system.
336*/ 328*/
337 329
338#define CS_CHECK(fn, ret) \
339 do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
340
341static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; 330static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
342 331
343static int tc574_config(struct pcmcia_device *link) 332static int tc574_config(struct pcmcia_device *link)
344{ 333{
345 struct net_device *dev = link->priv; 334 struct net_device *dev = link->priv;
346 struct el3_private *lp = netdev_priv(dev); 335 struct el3_private *lp = netdev_priv(dev);
347 int last_fn, last_ret, i, j; 336 int ret, i, j;
348 unsigned int ioaddr; 337 unsigned int ioaddr;
349 __be16 *phys_addr; 338 __be16 *phys_addr;
350 char *cardname; 339 char *cardname;
@@ -354,7 +343,7 @@ static int tc574_config(struct pcmcia_device *link)
354 343
355 phys_addr = (__be16 *)dev->dev_addr; 344 phys_addr = (__be16 *)dev->dev_addr;
356 345
357 DEBUG(0, "3c574_config(0x%p)\n", link); 346 dev_dbg(&link->dev, "3c574_config()\n");
358 347
359 link->io.IOAddrLines = 16; 348 link->io.IOAddrLines = 16;
360 for (i = j = 0; j < 0x400; j += 0x20) { 349 for (i = j = 0; j < 0x400; j += 0x20) {
@@ -363,12 +352,16 @@ static int tc574_config(struct pcmcia_device *link)
363 if (i == 0) 352 if (i == 0)
364 break; 353 break;
365 } 354 }
366 if (i != 0) { 355 if (i != 0)
367 cs_error(link, RequestIO, i); 356 goto failed;
357
358 ret = pcmcia_request_irq(link, &link->irq);
359 if (ret)
360 goto failed;
361
362 ret = pcmcia_request_configuration(link, &link->conf);
363 if (ret)
368 goto failed; 364 goto failed;
369 }
370 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
371 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
372 365
373 dev->irq = link->irq.AssignedIRQ; 366 dev->irq = link->irq.AssignedIRQ;
374 dev->base_addr = link->io.BasePort1; 367 dev->base_addr = link->io.BasePort1;
@@ -433,7 +426,8 @@ static int tc574_config(struct pcmcia_device *link)
433 mii_status = mdio_read(ioaddr, phy & 0x1f, 1); 426 mii_status = mdio_read(ioaddr, phy & 0x1f, 1);
434 if (mii_status != 0xffff) { 427 if (mii_status != 0xffff) {
435 lp->phys = phy & 0x1f; 428 lp->phys = phy & 0x1f;
436 DEBUG(0, " MII transceiver at index %d, status %x.\n", 429 dev_dbg(&link->dev, " MII transceiver at "
430 "index %d, status %x.\n",
437 phy, mii_status); 431 phy, mii_status);
438 if ((mii_status & 0x0040) == 0) 432 if ((mii_status & 0x0040) == 0)
439 mii_preamble_required = 1; 433 mii_preamble_required = 1;
@@ -476,8 +470,6 @@ static int tc574_config(struct pcmcia_device *link)
476 470
477 return 0; 471 return 0;
478 472
479cs_failed:
480 cs_error(link, last_fn, last_ret);
481failed: 473failed:
482 tc574_release(link); 474 tc574_release(link);
483 return -ENODEV; 475 return -ENODEV;
@@ -736,7 +728,7 @@ static int el3_open(struct net_device *dev)
736 lp->media.expires = jiffies + HZ; 728 lp->media.expires = jiffies + HZ;
737 add_timer(&lp->media); 729 add_timer(&lp->media);
738 730
739 DEBUG(2, "%s: opened, status %4.4x.\n", 731 dev_dbg(&link->dev, "%s: opened, status %4.4x.\n",
740 dev->name, inw(dev->base_addr + EL3_STATUS)); 732 dev->name, inw(dev->base_addr + EL3_STATUS));
741 733
742 return 0; 734 return 0;
@@ -770,7 +762,7 @@ static void pop_tx_status(struct net_device *dev)
770 if (tx_status & 0x30) 762 if (tx_status & 0x30)
771 tc574_wait_for_completion(dev, TxReset); 763 tc574_wait_for_completion(dev, TxReset);
772 if (tx_status & 0x38) { 764 if (tx_status & 0x38) {
773 DEBUG(1, "%s: transmit error: status 0x%02x\n", 765 pr_debug("%s: transmit error: status 0x%02x\n",
774 dev->name, tx_status); 766 dev->name, tx_status);
775 outw(TxEnable, ioaddr + EL3_CMD); 767 outw(TxEnable, ioaddr + EL3_CMD);
776 dev->stats.tx_aborted_errors++; 768 dev->stats.tx_aborted_errors++;
@@ -786,7 +778,7 @@ static netdev_tx_t el3_start_xmit(struct sk_buff *skb,
786 struct el3_private *lp = netdev_priv(dev); 778 struct el3_private *lp = netdev_priv(dev);
787 unsigned long flags; 779 unsigned long flags;
788 780
789 DEBUG(3, "%s: el3_start_xmit(length = %ld) called, " 781 pr_debug("%s: el3_start_xmit(length = %ld) called, "
790 "status %4.4x.\n", dev->name, (long)skb->len, 782 "status %4.4x.\n", dev->name, (long)skb->len,
791 inw(ioaddr + EL3_STATUS)); 783 inw(ioaddr + EL3_STATUS));
792 784
@@ -825,7 +817,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
825 return IRQ_NONE; 817 return IRQ_NONE;
826 ioaddr = dev->base_addr; 818 ioaddr = dev->base_addr;
827 819
828 DEBUG(3, "%s: interrupt, status %4.4x.\n", 820 pr_debug("%s: interrupt, status %4.4x.\n",
829 dev->name, inw(ioaddr + EL3_STATUS)); 821 dev->name, inw(ioaddr + EL3_STATUS));
830 822
831 spin_lock(&lp->window_lock); 823 spin_lock(&lp->window_lock);
@@ -834,7 +826,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
834 (IntLatch | RxComplete | RxEarly | StatsFull)) { 826 (IntLatch | RxComplete | RxEarly | StatsFull)) {
835 if (!netif_device_present(dev) || 827 if (!netif_device_present(dev) ||
836 ((status & 0xe000) != 0x2000)) { 828 ((status & 0xe000) != 0x2000)) {
837 DEBUG(1, "%s: Interrupt from dead card\n", dev->name); 829 pr_debug("%s: Interrupt from dead card\n", dev->name);
838 break; 830 break;
839 } 831 }
840 832
@@ -844,7 +836,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
844 work_budget = el3_rx(dev, work_budget); 836 work_budget = el3_rx(dev, work_budget);
845 837
846 if (status & TxAvailable) { 838 if (status & TxAvailable) {
847 DEBUG(3, " TX room bit was handled.\n"); 839 pr_debug(" TX room bit was handled.\n");
848 /* There's room in the FIFO for a full-sized packet. */ 840 /* There's room in the FIFO for a full-sized packet. */
849 outw(AckIntr | TxAvailable, ioaddr + EL3_CMD); 841 outw(AckIntr | TxAvailable, ioaddr + EL3_CMD);
850 netif_wake_queue(dev); 842 netif_wake_queue(dev);
@@ -884,7 +876,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
884 } 876 }
885 877
886 if (--work_budget < 0) { 878 if (--work_budget < 0) {
887 DEBUG(0, "%s: Too much work in interrupt, " 879 pr_debug("%s: Too much work in interrupt, "
888 "status %4.4x.\n", dev->name, status); 880 "status %4.4x.\n", dev->name, status);
889 /* Clear all interrupts */ 881 /* Clear all interrupts */
890 outw(AckIntr | 0xFF, ioaddr + EL3_CMD); 882 outw(AckIntr | 0xFF, ioaddr + EL3_CMD);
@@ -894,7 +886,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
894 outw(AckIntr | IntReq | IntLatch, ioaddr + EL3_CMD); 886 outw(AckIntr | IntReq | IntLatch, ioaddr + EL3_CMD);
895 } 887 }
896 888
897 DEBUG(3, "%s: exiting interrupt, status %4.4x.\n", 889 pr_debug("%s: exiting interrupt, status %4.4x.\n",
898 dev->name, inw(ioaddr + EL3_STATUS)); 890 dev->name, inw(ioaddr + EL3_STATUS));
899 891
900 spin_unlock(&lp->window_lock); 892 spin_unlock(&lp->window_lock);
@@ -1001,7 +993,7 @@ static void update_stats(struct net_device *dev)
1001 unsigned int ioaddr = dev->base_addr; 993 unsigned int ioaddr = dev->base_addr;
1002 u8 rx, tx, up; 994 u8 rx, tx, up;
1003 995
1004 DEBUG(2, "%s: updating the statistics.\n", dev->name); 996 pr_debug("%s: updating the statistics.\n", dev->name);
1005 997
1006 if (inw(ioaddr+EL3_STATUS) == 0xffff) /* No card. */ 998 if (inw(ioaddr+EL3_STATUS) == 0xffff) /* No card. */
1007 return; 999 return;
@@ -1037,7 +1029,7 @@ static int el3_rx(struct net_device *dev, int worklimit)
1037 unsigned int ioaddr = dev->base_addr; 1029 unsigned int ioaddr = dev->base_addr;
1038 short rx_status; 1030 short rx_status;
1039 1031
1040 DEBUG(3, "%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n", 1032 pr_debug("%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n",
1041 dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RxStatus)); 1033 dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RxStatus));
1042 while (!((rx_status = inw(ioaddr + RxStatus)) & 0x8000) && 1034 while (!((rx_status = inw(ioaddr + RxStatus)) & 0x8000) &&
1043 worklimit > 0) { 1035 worklimit > 0) {
@@ -1059,7 +1051,7 @@ static int el3_rx(struct net_device *dev, int worklimit)
1059 1051
1060 skb = dev_alloc_skb(pkt_len+5); 1052 skb = dev_alloc_skb(pkt_len+5);
1061 1053
1062 DEBUG(3, " Receiving packet size %d status %4.4x.\n", 1054 pr_debug(" Receiving packet size %d status %4.4x.\n",
1063 pkt_len, rx_status); 1055 pkt_len, rx_status);
1064 if (skb != NULL) { 1056 if (skb != NULL) {
1065 skb_reserve(skb, 2); 1057 skb_reserve(skb, 2);
@@ -1070,7 +1062,7 @@ static int el3_rx(struct net_device *dev, int worklimit)
1070 dev->stats.rx_packets++; 1062 dev->stats.rx_packets++;
1071 dev->stats.rx_bytes += pkt_len; 1063 dev->stats.rx_bytes += pkt_len;
1072 } else { 1064 } else {
1073 DEBUG(1, "%s: couldn't allocate a sk_buff of" 1065 pr_debug("%s: couldn't allocate a sk_buff of"
1074 " size %d.\n", dev->name, pkt_len); 1066 " size %d.\n", dev->name, pkt_len);
1075 dev->stats.rx_dropped++; 1067 dev->stats.rx_dropped++;
1076 } 1068 }
@@ -1099,7 +1091,7 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1099 struct mii_ioctl_data *data = if_mii(rq); 1091 struct mii_ioctl_data *data = if_mii(rq);
1100 int phy = lp->phys & 0x1f; 1092 int phy = lp->phys & 0x1f;
1101 1093
1102 DEBUG(2, "%s: In ioct(%-.6s, %#4.4x) %4.4x %4.4x %4.4x %4.4x.\n", 1094 pr_debug("%s: In ioct(%-.6s, %#4.4x) %4.4x %4.4x %4.4x %4.4x.\n",
1103 dev->name, rq->ifr_ifrn.ifrn_name, cmd, 1095 dev->name, rq->ifr_ifrn.ifrn_name, cmd,
1104 data->phy_id, data->reg_num, data->val_in, data->val_out); 1096 data->phy_id, data->reg_num, data->val_in, data->val_out);
1105 1097
@@ -1176,7 +1168,7 @@ static int el3_close(struct net_device *dev)
1176 struct el3_private *lp = netdev_priv(dev); 1168 struct el3_private *lp = netdev_priv(dev);
1177 struct pcmcia_device *link = lp->p_dev; 1169 struct pcmcia_device *link = lp->p_dev;
1178 1170
1179 DEBUG(2, "%s: shutting down ethercard.\n", dev->name); 1171 dev_dbg(&link->dev, "%s: shutting down ethercard.\n", dev->name);
1180 1172
1181 if (pcmcia_dev_present(link)) { 1173 if (pcmcia_dev_present(link)) {
1182 unsigned long flags; 1174 unsigned long flags;
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index fc6123ea6fa7..6eac62b7143c 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -130,14 +130,6 @@ MODULE_LICENSE("GPL");
130/* Special hook for setting if_port when module is loaded */ 130/* Special hook for setting if_port when module is loaded */
131INT_MODULE_PARM(if_port, 0); 131INT_MODULE_PARM(if_port, 0);
132 132
133#ifdef PCMCIA_DEBUG
134INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
135#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
136static char *version =
137DRV_NAME ".c " DRV_VERSION " 2001/10/13 00:08:50 (David Hinds)";
138#else
139#define DEBUG(n, args...)
140#endif
141 133
142/*====================================================================*/ 134/*====================================================================*/
143 135
@@ -189,7 +181,7 @@ static int tc589_probe(struct pcmcia_device *link)
189 struct el3_private *lp; 181 struct el3_private *lp;
190 struct net_device *dev; 182 struct net_device *dev;
191 183
192 DEBUG(0, "3c589_attach()\n"); 184 dev_dbg(&link->dev, "3c589_attach()\n");
193 185
194 /* Create new ethernet device */ 186 /* Create new ethernet device */
195 dev = alloc_etherdev(sizeof(struct el3_private)); 187 dev = alloc_etherdev(sizeof(struct el3_private));
@@ -231,7 +223,7 @@ static void tc589_detach(struct pcmcia_device *link)
231{ 223{
232 struct net_device *dev = link->priv; 224 struct net_device *dev = link->priv;
233 225
234 DEBUG(0, "3c589_detach(0x%p)\n", link); 226 dev_dbg(&link->dev, "3c589_detach\n");
235 227
236 if (link->dev_node) 228 if (link->dev_node)
237 unregister_netdev(dev); 229 unregister_netdev(dev);
@@ -249,21 +241,18 @@ static void tc589_detach(struct pcmcia_device *link)
249 241
250======================================================================*/ 242======================================================================*/
251 243
252#define CS_CHECK(fn, ret) \
253do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
254
255static int tc589_config(struct pcmcia_device *link) 244static int tc589_config(struct pcmcia_device *link)
256{ 245{
257 struct net_device *dev = link->priv; 246 struct net_device *dev = link->priv;
258 struct el3_private *lp = netdev_priv(dev); 247 struct el3_private *lp = netdev_priv(dev);
259 __be16 *phys_addr; 248 __be16 *phys_addr;
260 int last_fn, last_ret, i, j, multi = 0, fifo; 249 int ret, i, j, multi = 0, fifo;
261 unsigned int ioaddr; 250 unsigned int ioaddr;
262 char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; 251 char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
263 u8 *buf; 252 u8 *buf;
264 size_t len; 253 size_t len;
265 254
266 DEBUG(0, "3c589_config(0x%p)\n", link); 255 dev_dbg(&link->dev, "3c589_config\n");
267 256
268 phys_addr = (__be16 *)dev->dev_addr; 257 phys_addr = (__be16 *)dev->dev_addr;
269 /* Is this a 3c562? */ 258 /* Is this a 3c562? */
@@ -281,12 +270,16 @@ static int tc589_config(struct pcmcia_device *link)
281 if (i == 0) 270 if (i == 0)
282 break; 271 break;
283 } 272 }
284 if (i != 0) { 273 if (i != 0)
285 cs_error(link, RequestIO, i);
286 goto failed; 274 goto failed;
287 } 275
288 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 276 ret = pcmcia_request_irq(link, &link->irq);
289 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 277 if (ret)
278 goto failed;
279
280 ret = pcmcia_request_configuration(link, &link->conf);
281 if (ret)
282 goto failed;
290 283
291 dev->irq = link->irq.AssignedIRQ; 284 dev->irq = link->irq.AssignedIRQ;
292 dev->base_addr = link->io.BasePort1; 285 dev->base_addr = link->io.BasePort1;
@@ -342,8 +335,6 @@ static int tc589_config(struct pcmcia_device *link)
342 if_names[dev->if_port]); 335 if_names[dev->if_port]);
343 return 0; 336 return 0;
344 337
345cs_failed:
346 cs_error(link, last_fn, last_ret);
347failed: 338failed:
348 tc589_release(link); 339 tc589_release(link);
349 return -ENODEV; 340 return -ENODEV;
@@ -506,24 +497,8 @@ static void netdev_get_drvinfo(struct net_device *dev,
506 sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); 497 sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr);
507} 498}
508 499
509#ifdef PCMCIA_DEBUG
510static u32 netdev_get_msglevel(struct net_device *dev)
511{
512 return pc_debug;
513}
514
515static void netdev_set_msglevel(struct net_device *dev, u32 level)
516{
517 pc_debug = level;
518}
519#endif /* PCMCIA_DEBUG */
520
521static const struct ethtool_ops netdev_ethtool_ops = { 500static const struct ethtool_ops netdev_ethtool_ops = {
522 .get_drvinfo = netdev_get_drvinfo, 501 .get_drvinfo = netdev_get_drvinfo,
523#ifdef PCMCIA_DEBUG
524 .get_msglevel = netdev_get_msglevel,
525 .set_msglevel = netdev_set_msglevel,
526#endif /* PCMCIA_DEBUG */
527}; 502};
528 503
529static int el3_config(struct net_device *dev, struct ifmap *map) 504static int el3_config(struct net_device *dev, struct ifmap *map)
@@ -558,7 +533,7 @@ static int el3_open(struct net_device *dev)
558 lp->media.expires = jiffies + HZ; 533 lp->media.expires = jiffies + HZ;
559 add_timer(&lp->media); 534 add_timer(&lp->media);
560 535
561 DEBUG(1, "%s: opened, status %4.4x.\n", 536 dev_dbg(&link->dev, "%s: opened, status %4.4x.\n",
562 dev->name, inw(dev->base_addr + EL3_STATUS)); 537 dev->name, inw(dev->base_addr + EL3_STATUS));
563 538
564 return 0; 539 return 0;
@@ -591,7 +566,7 @@ static void pop_tx_status(struct net_device *dev)
591 if (tx_status & 0x30) 566 if (tx_status & 0x30)
592 tc589_wait_for_completion(dev, TxReset); 567 tc589_wait_for_completion(dev, TxReset);
593 if (tx_status & 0x38) { 568 if (tx_status & 0x38) {
594 DEBUG(1, "%s: transmit error: status 0x%02x\n", 569 pr_debug("%s: transmit error: status 0x%02x\n",
595 dev->name, tx_status); 570 dev->name, tx_status);
596 outw(TxEnable, ioaddr + EL3_CMD); 571 outw(TxEnable, ioaddr + EL3_CMD);
597 dev->stats.tx_aborted_errors++; 572 dev->stats.tx_aborted_errors++;
@@ -607,7 +582,7 @@ static netdev_tx_t el3_start_xmit(struct sk_buff *skb,
607 struct el3_private *priv = netdev_priv(dev); 582 struct el3_private *priv = netdev_priv(dev);
608 unsigned long flags; 583 unsigned long flags;
609 584
610 DEBUG(3, "%s: el3_start_xmit(length = %ld) called, " 585 pr_debug("%s: el3_start_xmit(length = %ld) called, "
611 "status %4.4x.\n", dev->name, (long)skb->len, 586 "status %4.4x.\n", dev->name, (long)skb->len,
612 inw(ioaddr + EL3_STATUS)); 587 inw(ioaddr + EL3_STATUS));
613 588
@@ -649,14 +624,14 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
649 624
650 ioaddr = dev->base_addr; 625 ioaddr = dev->base_addr;
651 626
652 DEBUG(3, "%s: interrupt, status %4.4x.\n", 627 pr_debug("%s: interrupt, status %4.4x.\n",
653 dev->name, inw(ioaddr + EL3_STATUS)); 628 dev->name, inw(ioaddr + EL3_STATUS));
654 629
655 spin_lock(&lp->lock); 630 spin_lock(&lp->lock);
656 while ((status = inw(ioaddr + EL3_STATUS)) & 631 while ((status = inw(ioaddr + EL3_STATUS)) &
657 (IntLatch | RxComplete | StatsFull)) { 632 (IntLatch | RxComplete | StatsFull)) {
658 if ((status & 0xe000) != 0x2000) { 633 if ((status & 0xe000) != 0x2000) {
659 DEBUG(1, "%s: interrupt from dead card\n", dev->name); 634 pr_debug("%s: interrupt from dead card\n", dev->name);
660 handled = 0; 635 handled = 0;
661 break; 636 break;
662 } 637 }
@@ -665,7 +640,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
665 el3_rx(dev); 640 el3_rx(dev);
666 641
667 if (status & TxAvailable) { 642 if (status & TxAvailable) {
668 DEBUG(3, " TX room bit was handled.\n"); 643 pr_debug(" TX room bit was handled.\n");
669 /* There's room in the FIFO for a full-sized packet. */ 644 /* There's room in the FIFO for a full-sized packet. */
670 outw(AckIntr | TxAvailable, ioaddr + EL3_CMD); 645 outw(AckIntr | TxAvailable, ioaddr + EL3_CMD);
671 netif_wake_queue(dev); 646 netif_wake_queue(dev);
@@ -717,7 +692,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
717 692
718 lp->last_irq = jiffies; 693 lp->last_irq = jiffies;
719 spin_unlock(&lp->lock); 694 spin_unlock(&lp->lock);
720 DEBUG(3, "%s: exiting interrupt, status %4.4x.\n", 695 pr_debug("%s: exiting interrupt, status %4.4x.\n",
721 dev->name, inw(ioaddr + EL3_STATUS)); 696 dev->name, inw(ioaddr + EL3_STATUS));
722 return IRQ_RETVAL(handled); 697 return IRQ_RETVAL(handled);
723} 698}
@@ -828,7 +803,7 @@ static void update_stats(struct net_device *dev)
828{ 803{
829 unsigned int ioaddr = dev->base_addr; 804 unsigned int ioaddr = dev->base_addr;
830 805
831 DEBUG(2, "%s: updating the statistics.\n", dev->name); 806 pr_debug("%s: updating the statistics.\n", dev->name);
832 /* Turn off statistics updates while reading. */ 807 /* Turn off statistics updates while reading. */
833 outw(StatsDisable, ioaddr + EL3_CMD); 808 outw(StatsDisable, ioaddr + EL3_CMD);
834 /* Switch to the stats window, and read everything. */ 809 /* Switch to the stats window, and read everything. */
@@ -856,7 +831,7 @@ static int el3_rx(struct net_device *dev)
856 int worklimit = 32; 831 int worklimit = 32;
857 short rx_status; 832 short rx_status;
858 833
859 DEBUG(3, "%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n", 834 pr_debug("%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n",
860 dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS)); 835 dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS));
861 while (!((rx_status = inw(ioaddr + RX_STATUS)) & 0x8000) && 836 while (!((rx_status = inw(ioaddr + RX_STATUS)) & 0x8000) &&
862 worklimit > 0) { 837 worklimit > 0) {
@@ -878,7 +853,7 @@ static int el3_rx(struct net_device *dev)
878 853
879 skb = dev_alloc_skb(pkt_len+5); 854 skb = dev_alloc_skb(pkt_len+5);
880 855
881 DEBUG(3, " Receiving packet size %d status %4.4x.\n", 856 pr_debug(" Receiving packet size %d status %4.4x.\n",
882 pkt_len, rx_status); 857 pkt_len, rx_status);
883 if (skb != NULL) { 858 if (skb != NULL) {
884 skb_reserve(skb, 2); 859 skb_reserve(skb, 2);
@@ -889,7 +864,7 @@ static int el3_rx(struct net_device *dev)
889 dev->stats.rx_packets++; 864 dev->stats.rx_packets++;
890 dev->stats.rx_bytes += pkt_len; 865 dev->stats.rx_bytes += pkt_len;
891 } else { 866 } else {
892 DEBUG(1, "%s: couldn't allocate a sk_buff of" 867 pr_debug("%s: couldn't allocate a sk_buff of"
893 " size %d.\n", dev->name, pkt_len); 868 " size %d.\n", dev->name, pkt_len);
894 dev->stats.rx_dropped++; 869 dev->stats.rx_dropped++;
895 } 870 }
@@ -930,7 +905,7 @@ static int el3_close(struct net_device *dev)
930 struct pcmcia_device *link = lp->p_dev; 905 struct pcmcia_device *link = lp->p_dev;
931 unsigned int ioaddr = dev->base_addr; 906 unsigned int ioaddr = dev->base_addr;
932 907
933 DEBUG(1, "%s: shutting down ethercard.\n", dev->name); 908 dev_dbg(&link->dev, "%s: shutting down ethercard.\n", dev->name);
934 909
935 if (pcmcia_dev_present(link)) { 910 if (pcmcia_dev_present(link)) {
936 /* Turn off statistics ASAP. We update dev->stats below. */ 911 /* Turn off statistics ASAP. We update dev->stats below. */
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 3131a59a8d32..5af2ccfdb52d 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -75,16 +75,6 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
75MODULE_DESCRIPTION("Asix AX88190 PCMCIA ethernet driver"); 75MODULE_DESCRIPTION("Asix AX88190 PCMCIA ethernet driver");
76MODULE_LICENSE("GPL"); 76MODULE_LICENSE("GPL");
77 77
78#ifdef PCMCIA_DEBUG
79#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0)
80
81INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
82#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
83static char *version =
84"axnet_cs.c 1.28 2002/06/29 06:27:37 (David Hinds)";
85#else
86#define DEBUG(n, args...)
87#endif
88 78
89/*====================================================================*/ 79/*====================================================================*/
90 80
@@ -167,7 +157,7 @@ static int axnet_probe(struct pcmcia_device *link)
167 struct net_device *dev; 157 struct net_device *dev;
168 struct ei_device *ei_local; 158 struct ei_device *ei_local;
169 159
170 DEBUG(0, "axnet_attach()\n"); 160 dev_dbg(&link->dev, "axnet_attach()\n");
171 161
172 dev = alloc_etherdev(sizeof(struct ei_device) + sizeof(axnet_dev_t)); 162 dev = alloc_etherdev(sizeof(struct ei_device) + sizeof(axnet_dev_t));
173 if (!dev) 163 if (!dev)
@@ -205,7 +195,7 @@ static void axnet_detach(struct pcmcia_device *link)
205{ 195{
206 struct net_device *dev = link->priv; 196 struct net_device *dev = link->priv;
207 197
208 DEBUG(0, "axnet_detach(0x%p)\n", link); 198 dev_dbg(&link->dev, "axnet_detach(0x%p)\n", link);
209 199
210 if (link->dev_node) 200 if (link->dev_node)
211 unregister_netdev(dev); 201 unregister_netdev(dev);
@@ -272,9 +262,6 @@ static int get_prom(struct pcmcia_device *link)
272 262
273======================================================================*/ 263======================================================================*/
274 264
275#define CS_CHECK(fn, ret) \
276do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
277
278static int try_io_port(struct pcmcia_device *link) 265static int try_io_port(struct pcmcia_device *link)
279{ 266{
280 int j, ret; 267 int j, ret;
@@ -341,26 +328,29 @@ static int axnet_config(struct pcmcia_device *link)
341{ 328{
342 struct net_device *dev = link->priv; 329 struct net_device *dev = link->priv;
343 axnet_dev_t *info = PRIV(dev); 330 axnet_dev_t *info = PRIV(dev);
344 int i, j, j2, last_ret, last_fn; 331 int i, j, j2, ret;
345 332
346 DEBUG(0, "axnet_config(0x%p)\n", link); 333 dev_dbg(&link->dev, "axnet_config(0x%p)\n", link);
347 334
348 /* don't trust the CIS on this; Linksys got it wrong */ 335 /* don't trust the CIS on this; Linksys got it wrong */
349 link->conf.Present = 0x63; 336 link->conf.Present = 0x63;
350 last_ret = pcmcia_loop_config(link, axnet_configcheck, NULL); 337 ret = pcmcia_loop_config(link, axnet_configcheck, NULL);
351 if (last_ret != 0) { 338 if (ret != 0)
352 cs_error(link, RequestIO, last_ret);
353 goto failed; 339 goto failed;
354 }
355 340
356 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 341 ret = pcmcia_request_irq(link, &link->irq);
342 if (ret)
343 goto failed;
357 344
358 if (link->io.NumPorts2 == 8) { 345 if (link->io.NumPorts2 == 8) {
359 link->conf.Attributes |= CONF_ENABLE_SPKR; 346 link->conf.Attributes |= CONF_ENABLE_SPKR;
360 link->conf.Status = CCSR_AUDIO_ENA; 347 link->conf.Status = CCSR_AUDIO_ENA;
361 } 348 }
362 349
363 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 350 ret = pcmcia_request_configuration(link, &link->conf);
351 if (ret)
352 goto failed;
353
364 dev->irq = link->irq.AssignedIRQ; 354 dev->irq = link->irq.AssignedIRQ;
365 dev->base_addr = link->io.BasePort1; 355 dev->base_addr = link->io.BasePort1;
366 356
@@ -426,14 +416,12 @@ static int axnet_config(struct pcmcia_device *link)
426 dev->base_addr, dev->irq, 416 dev->base_addr, dev->irq,
427 dev->dev_addr); 417 dev->dev_addr);
428 if (info->phy_id != -1) { 418 if (info->phy_id != -1) {
429 DEBUG(0, " MII transceiver at index %d, status %x.\n", info->phy_id, j); 419 dev_dbg(&link->dev, " MII transceiver at index %d, status %x.\n", info->phy_id, j);
430 } else { 420 } else {
431 printk(KERN_NOTICE " No MII transceivers found!\n"); 421 printk(KERN_NOTICE " No MII transceivers found!\n");
432 } 422 }
433 return 0; 423 return 0;
434 424
435cs_failed:
436 cs_error(link, last_fn, last_ret);
437failed: 425failed:
438 axnet_release(link); 426 axnet_release(link);
439 return -ENODEV; 427 return -ENODEV;
@@ -543,7 +531,7 @@ static int axnet_open(struct net_device *dev)
543 struct pcmcia_device *link = info->p_dev; 531 struct pcmcia_device *link = info->p_dev;
544 unsigned int nic_base = dev->base_addr; 532 unsigned int nic_base = dev->base_addr;
545 533
546 DEBUG(2, "axnet_open('%s')\n", dev->name); 534 dev_dbg(&link->dev, "axnet_open('%s')\n", dev->name);
547 535
548 if (!pcmcia_dev_present(link)) 536 if (!pcmcia_dev_present(link))
549 return -ENODEV; 537 return -ENODEV;
@@ -572,7 +560,7 @@ static int axnet_close(struct net_device *dev)
572 axnet_dev_t *info = PRIV(dev); 560 axnet_dev_t *info = PRIV(dev);
573 struct pcmcia_device *link = info->p_dev; 561 struct pcmcia_device *link = info->p_dev;
574 562
575 DEBUG(2, "axnet_close('%s')\n", dev->name); 563 dev_dbg(&link->dev, "axnet_close('%s')\n", dev->name);
576 564
577 ax_close(dev); 565 ax_close(dev);
578 free_irq(dev->irq, dev); 566 free_irq(dev->irq, dev);
@@ -741,10 +729,8 @@ static void block_input(struct net_device *dev, int count,
741 int xfer_count = count; 729 int xfer_count = count;
742 char *buf = skb->data; 730 char *buf = skb->data;
743 731
744#ifdef PCMCIA_DEBUG
745 if ((ei_debug > 4) && (count != 4)) 732 if ((ei_debug > 4) && (count != 4))
746 printk(KERN_DEBUG "%s: [bi=%d]\n", dev->name, count+4); 733 pr_debug("%s: [bi=%d]\n", dev->name, count+4);
747#endif
748 outb_p(ring_offset & 0xff, nic_base + EN0_RSARLO); 734 outb_p(ring_offset & 0xff, nic_base + EN0_RSARLO);
749 outb_p(ring_offset >> 8, nic_base + EN0_RSARHI); 735 outb_p(ring_offset >> 8, nic_base + EN0_RSARHI);
750 outb_p(E8390_RREAD+E8390_START, nic_base + AXNET_CMD); 736 outb_p(E8390_RREAD+E8390_START, nic_base + AXNET_CMD);
@@ -762,10 +748,7 @@ static void block_output(struct net_device *dev, int count,
762{ 748{
763 unsigned int nic_base = dev->base_addr; 749 unsigned int nic_base = dev->base_addr;
764 750
765#ifdef PCMCIA_DEBUG 751 pr_debug("%s: [bo=%d]\n", dev->name, count);
766 if (ei_debug > 4)
767 printk(KERN_DEBUG "%s: [bo=%d]\n", dev->name, count);
768#endif
769 752
770 /* Round the count up for word writes. Do we need to do this? 753 /* Round the count up for word writes. Do we need to do this?
771 What effect will an odd byte count have on the 8390? 754 What effect will an odd byte count have on the 8390?
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c
index 7b5c77b7bd27..9a2e5006570b 100644
--- a/drivers/net/pcmcia/com20020_cs.c
+++ b/drivers/net/pcmcia/com20020_cs.c
@@ -53,11 +53,7 @@
53 53
54#define VERSION "arcnet: COM20020 PCMCIA support loaded.\n" 54#define VERSION "arcnet: COM20020 PCMCIA support loaded.\n"
55 55
56#ifdef PCMCIA_DEBUG 56#ifdef DEBUG
57
58static int pc_debug = PCMCIA_DEBUG;
59module_param(pc_debug, int, 0);
60#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
61 57
62static void regdump(struct net_device *dev) 58static void regdump(struct net_device *dev)
63{ 59{
@@ -92,7 +88,6 @@ static void regdump(struct net_device *dev)
92 88
93#else 89#else
94 90
95#define DEBUG(n, args...) do { } while (0)
96static inline void regdump(struct net_device *dev) { } 91static inline void regdump(struct net_device *dev) { }
97 92
98#endif 93#endif
@@ -144,7 +139,7 @@ static int com20020_probe(struct pcmcia_device *p_dev)
144 struct net_device *dev; 139 struct net_device *dev;
145 struct arcnet_local *lp; 140 struct arcnet_local *lp;
146 141
147 DEBUG(0, "com20020_attach()\n"); 142 dev_dbg(&p_dev->dev, "com20020_attach()\n");
148 143
149 /* Create new network device */ 144 /* Create new network device */
150 info = kzalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); 145 info = kzalloc(sizeof(struct com20020_dev_t), GFP_KERNEL);
@@ -198,12 +193,12 @@ static void com20020_detach(struct pcmcia_device *link)
198 struct com20020_dev_t *info = link->priv; 193 struct com20020_dev_t *info = link->priv;
199 struct net_device *dev = info->dev; 194 struct net_device *dev = info->dev;
200 195
201 DEBUG(1,"detach...\n"); 196 dev_dbg(&link->dev, "detach...\n");
202 197
203 DEBUG(0, "com20020_detach(0x%p)\n", link); 198 dev_dbg(&link->dev, "com20020_detach\n");
204 199
205 if (link->dev_node) { 200 if (link->dev_node) {
206 DEBUG(1,"unregister...\n"); 201 dev_dbg(&link->dev, "unregister...\n");
207 202
208 unregister_netdev(dev); 203 unregister_netdev(dev);
209 204
@@ -218,16 +213,16 @@ static void com20020_detach(struct pcmcia_device *link)
218 com20020_release(link); 213 com20020_release(link);
219 214
220 /* Unlink device structure, free bits */ 215 /* Unlink device structure, free bits */
221 DEBUG(1,"unlinking...\n"); 216 dev_dbg(&link->dev, "unlinking...\n");
222 if (link->priv) 217 if (link->priv)
223 { 218 {
224 dev = info->dev; 219 dev = info->dev;
225 if (dev) 220 if (dev)
226 { 221 {
227 DEBUG(1,"kfree...\n"); 222 dev_dbg(&link->dev, "kfree...\n");
228 free_netdev(dev); 223 free_netdev(dev);
229 } 224 }
230 DEBUG(1,"kfree2...\n"); 225 dev_dbg(&link->dev, "kfree2...\n");
231 kfree(info); 226 kfree(info);
232 } 227 }
233 228
@@ -241,25 +236,22 @@ static void com20020_detach(struct pcmcia_device *link)
241 236
242======================================================================*/ 237======================================================================*/
243 238
244#define CS_CHECK(fn, ret) \
245do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
246
247static int com20020_config(struct pcmcia_device *link) 239static int com20020_config(struct pcmcia_device *link)
248{ 240{
249 struct arcnet_local *lp; 241 struct arcnet_local *lp;
250 com20020_dev_t *info; 242 com20020_dev_t *info;
251 struct net_device *dev; 243 struct net_device *dev;
252 int i, last_ret, last_fn; 244 int i, ret;
253 int ioaddr; 245 int ioaddr;
254 246
255 info = link->priv; 247 info = link->priv;
256 dev = info->dev; 248 dev = info->dev;
257 249
258 DEBUG(1,"config...\n"); 250 dev_dbg(&link->dev, "config...\n");
259 251
260 DEBUG(0, "com20020_config(0x%p)\n", link); 252 dev_dbg(&link->dev, "com20020_config\n");
261 253
262 DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1); 254 dev_dbg(&link->dev, "baseport1 is %Xh\n", link->io.BasePort1);
263 i = -ENODEV; 255 i = -ENODEV;
264 if (!link->io.BasePort1) 256 if (!link->io.BasePort1)
265 { 257 {
@@ -276,26 +268,28 @@ static int com20020_config(struct pcmcia_device *link)
276 268
277 if (i != 0) 269 if (i != 0)
278 { 270 {
279 DEBUG(1,"arcnet: requestIO failed totally!\n"); 271 dev_dbg(&link->dev, "requestIO failed totally!\n");
280 goto failed; 272 goto failed;
281 } 273 }
282 274
283 ioaddr = dev->base_addr = link->io.BasePort1; 275 ioaddr = dev->base_addr = link->io.BasePort1;
284 DEBUG(1,"arcnet: got ioaddr %Xh\n", ioaddr); 276 dev_dbg(&link->dev, "got ioaddr %Xh\n", ioaddr);
285 277
286 DEBUG(1,"arcnet: request IRQ %d (%Xh/%Xh)\n", 278 dev_dbg(&link->dev, "request IRQ %d (%Xh/%Xh)\n",
287 link->irq.AssignedIRQ, 279 link->irq.AssignedIRQ,
288 link->irq.IRQInfo1, link->irq.IRQInfo2); 280 link->irq.IRQInfo1, link->irq.IRQInfo2);
289 i = pcmcia_request_irq(link, &link->irq); 281 i = pcmcia_request_irq(link, &link->irq);
290 if (i != 0) 282 if (i != 0)
291 { 283 {
292 DEBUG(1,"arcnet: requestIRQ failed totally!\n"); 284 dev_dbg(&link->dev, "requestIRQ failed totally!\n");
293 goto failed; 285 goto failed;
294 } 286 }
295 287
296 dev->irq = link->irq.AssignedIRQ; 288 dev->irq = link->irq.AssignedIRQ;
297 289
298 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 290 ret = pcmcia_request_configuration(link, &link->conf);
291 if (ret)
292 goto failed;
299 293
300 if (com20020_check(dev)) 294 if (com20020_check(dev))
301 { 295 {
@@ -313,21 +307,20 @@ static int com20020_config(struct pcmcia_device *link)
313 i = com20020_found(dev, 0); /* calls register_netdev */ 307 i = com20020_found(dev, 0); /* calls register_netdev */
314 308
315 if (i != 0) { 309 if (i != 0) {
316 DEBUG(1,KERN_NOTICE "com20020_cs: com20020_found() failed\n"); 310 dev_printk(KERN_NOTICE, &link->dev,
311 "com20020_cs: com20020_found() failed\n");
317 link->dev_node = NULL; 312 link->dev_node = NULL;
318 goto failed; 313 goto failed;
319 } 314 }
320 315
321 strcpy(info->node.dev_name, dev->name); 316 strcpy(info->node.dev_name, dev->name);
322 317
323 DEBUG(1,KERN_INFO "%s: port %#3lx, irq %d\n", 318 dev_dbg(&link->dev,KERN_INFO "%s: port %#3lx, irq %d\n",
324 dev->name, dev->base_addr, dev->irq); 319 dev->name, dev->base_addr, dev->irq);
325 return 0; 320 return 0;
326 321
327cs_failed:
328 cs_error(link, last_fn, last_ret);
329failed: 322failed:
330 DEBUG(1,"com20020_config failed...\n"); 323 dev_dbg(&link->dev, "com20020_config failed...\n");
331 com20020_release(link); 324 com20020_release(link);
332 return -ENODEV; 325 return -ENODEV;
333} /* com20020_config */ 326} /* com20020_config */
@@ -342,7 +335,7 @@ failed:
342 335
343static void com20020_release(struct pcmcia_device *link) 336static void com20020_release(struct pcmcia_device *link)
344{ 337{
345 DEBUG(0, "com20020_release(0x%p)\n", link); 338 dev_dbg(&link->dev, "com20020_release\n");
346 pcmcia_disable_device(link); 339 pcmcia_disable_device(link);
347} 340}
348 341
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index 5b73b11411c8..fdec5c333a2a 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -72,13 +72,6 @@ MODULE_LICENSE("GPL");
72/* 0:4KB*2 TX buffer else:8KB*2 TX buffer */ 72/* 0:4KB*2 TX buffer else:8KB*2 TX buffer */
73INT_MODULE_PARM(sram_config, 0); 73INT_MODULE_PARM(sram_config, 0);
74 74
75#ifdef PCMCIA_DEBUG
76INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
77#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
78static char *version = DRV_NAME ".c " DRV_VERSION " 2002/03/23";
79#else
80#define DEBUG(n, args...)
81#endif
82 75
83/*====================================================================*/ 76/*====================================================================*/
84/* 77/*
@@ -245,7 +238,7 @@ static int fmvj18x_probe(struct pcmcia_device *link)
245 local_info_t *lp; 238 local_info_t *lp;
246 struct net_device *dev; 239 struct net_device *dev;
247 240
248 DEBUG(0, "fmvj18x_attach()\n"); 241 dev_dbg(&link->dev, "fmvj18x_attach()\n");
249 242
250 /* Make up a FMVJ18x specific data structure */ 243 /* Make up a FMVJ18x specific data structure */
251 dev = alloc_etherdev(sizeof(local_info_t)); 244 dev = alloc_etherdev(sizeof(local_info_t));
@@ -285,7 +278,7 @@ static void fmvj18x_detach(struct pcmcia_device *link)
285{ 278{
286 struct net_device *dev = link->priv; 279 struct net_device *dev = link->priv;
287 280
288 DEBUG(0, "fmvj18x_detach(0x%p)\n", link); 281 dev_dbg(&link->dev, "fmvj18x_detach\n");
289 282
290 if (link->dev_node) 283 if (link->dev_node)
291 unregister_netdev(dev); 284 unregister_netdev(dev);
@@ -297,9 +290,6 @@ static void fmvj18x_detach(struct pcmcia_device *link)
297 290
298/*====================================================================*/ 291/*====================================================================*/
299 292
300#define CS_CHECK(fn, ret) \
301do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
302
303static int mfc_try_io_port(struct pcmcia_device *link) 293static int mfc_try_io_port(struct pcmcia_device *link)
304{ 294{
305 int i, ret; 295 int i, ret;
@@ -354,7 +344,7 @@ static int fmvj18x_config(struct pcmcia_device *link)
354{ 344{
355 struct net_device *dev = link->priv; 345 struct net_device *dev = link->priv;
356 local_info_t *lp = netdev_priv(dev); 346 local_info_t *lp = netdev_priv(dev);
357 int i, last_fn = RequestIO, last_ret = 0, ret; 347 int i, ret;
358 unsigned int ioaddr; 348 unsigned int ioaddr;
359 cardtype_t cardtype; 349 cardtype_t cardtype;
360 char *card_name = "unknown"; 350 char *card_name = "unknown";
@@ -362,16 +352,16 @@ static int fmvj18x_config(struct pcmcia_device *link)
362 size_t len; 352 size_t len;
363 u_char buggybuf[32]; 353 u_char buggybuf[32];
364 354
365 DEBUG(0, "fmvj18x_config(0x%p)\n", link); 355 dev_dbg(&link->dev, "fmvj18x_config\n");
366 356
367 len = pcmcia_get_tuple(link, CISTPL_FUNCE, &buf); 357 len = pcmcia_get_tuple(link, CISTPL_FUNCE, &buf);
368 kfree(buf); 358 kfree(buf);
369 359
370 if (len) { 360 if (len) {
371 /* Yes, I have CISTPL_FUNCE. Let's check CISTPL_MANFID */ 361 /* Yes, I have CISTPL_FUNCE. Let's check CISTPL_MANFID */
372 last_ret = pcmcia_loop_config(link, fmvj18x_ioprobe, NULL); 362 ret = pcmcia_loop_config(link, fmvj18x_ioprobe, NULL);
373 if (last_ret != 0) 363 if (ret != 0)
374 goto cs_failed; 364 goto failed;
375 365
376 switch (link->manf_id) { 366 switch (link->manf_id) {
377 case MANFID_TDK: 367 case MANFID_TDK:
@@ -440,15 +430,22 @@ static int fmvj18x_config(struct pcmcia_device *link)
440 link->irq.Attributes = 430 link->irq.Attributes =
441 IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED|IRQ_HANDLE_PRESENT; 431 IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED|IRQ_HANDLE_PRESENT;
442 ret = mfc_try_io_port(link); 432 ret = mfc_try_io_port(link);
443 if (ret != 0) goto cs_failed; 433 if (ret != 0) goto failed;
444 } else if (cardtype == UNGERMANN) { 434 } else if (cardtype == UNGERMANN) {
445 ret = ungermann_try_io_port(link); 435 ret = ungermann_try_io_port(link);
446 if (ret != 0) goto cs_failed; 436 if (ret != 0) goto failed;
447 } else { 437 } else {
448 CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); 438 ret = pcmcia_request_io(link, &link->io);
439 if (ret)
440 goto failed;
449 } 441 }
450 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 442 ret = pcmcia_request_irq(link, &link->irq);
451 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 443 if (ret)
444 goto failed;
445 ret = pcmcia_request_configuration(link, &link->conf);
446 if (ret)
447 goto failed;
448
452 dev->irq = link->irq.AssignedIRQ; 449 dev->irq = link->irq.AssignedIRQ;
453 dev->base_addr = link->io.BasePort1; 450 dev->base_addr = link->io.BasePort1;
454 451
@@ -553,9 +550,6 @@ static int fmvj18x_config(struct pcmcia_device *link)
553 550
554 return 0; 551 return 0;
555 552
556cs_failed:
557 /* All Card Services errors end up here */
558 cs_error(link, last_fn, last_ret);
559failed: 553failed:
560 fmvj18x_release(link); 554 fmvj18x_release(link);
561 return -ENODEV; 555 return -ENODEV;
@@ -574,10 +568,8 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
574 req.Base = 0; req.Size = 0; 568 req.Base = 0; req.Size = 0;
575 req.AccessSpeed = 0; 569 req.AccessSpeed = 0;
576 i = pcmcia_request_window(&link, &req, &link->win); 570 i = pcmcia_request_window(&link, &req, &link->win);
577 if (i != 0) { 571 if (i != 0)
578 cs_error(link, RequestWindow, i);
579 return -1; 572 return -1;
580 }
581 573
582 base = ioremap(req.Base, req.Size); 574 base = ioremap(req.Base, req.Size);
583 mem.Page = 0; 575 mem.Page = 0;
@@ -608,8 +600,6 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
608 600
609 iounmap(base); 601 iounmap(base);
610 j = pcmcia_release_window(link->win); 602 j = pcmcia_release_window(link->win);
611 if (j != 0)
612 cs_error(link, ReleaseWindow, j);
613 return (i != 0x200) ? 0 : -1; 603 return (i != 0x200) ? 0 : -1;
614 604
615} /* fmvj18x_get_hwinfo */ 605} /* fmvj18x_get_hwinfo */
@@ -629,10 +619,8 @@ static int fmvj18x_setup_mfc(struct pcmcia_device *link)
629 req.Base = 0; req.Size = 0; 619 req.Base = 0; req.Size = 0;
630 req.AccessSpeed = 0; 620 req.AccessSpeed = 0;
631 i = pcmcia_request_window(&link, &req, &link->win); 621 i = pcmcia_request_window(&link, &req, &link->win);
632 if (i != 0) { 622 if (i != 0)
633 cs_error(link, RequestWindow, i);
634 return -1; 623 return -1;
635 }
636 624
637 lp->base = ioremap(req.Base, req.Size); 625 lp->base = ioremap(req.Base, req.Size);
638 if (lp->base == NULL) { 626 if (lp->base == NULL) {
@@ -646,7 +634,6 @@ static int fmvj18x_setup_mfc(struct pcmcia_device *link)
646 if (i != 0) { 634 if (i != 0) {
647 iounmap(lp->base); 635 iounmap(lp->base);
648 lp->base = NULL; 636 lp->base = NULL;
649 cs_error(link, MapMemPage, i);
650 return -1; 637 return -1;
651 } 638 }
652 639
@@ -673,15 +660,13 @@ static void fmvj18x_release(struct pcmcia_device *link)
673 u_char __iomem *tmp; 660 u_char __iomem *tmp;
674 int j; 661 int j;
675 662
676 DEBUG(0, "fmvj18x_release(0x%p)\n", link); 663 dev_dbg(&link->dev, "fmvj18x_release\n");
677 664
678 if (lp->base != NULL) { 665 if (lp->base != NULL) {
679 tmp = lp->base; 666 tmp = lp->base;
680 lp->base = NULL; /* set NULL before iounmap */ 667 lp->base = NULL; /* set NULL before iounmap */
681 iounmap(tmp); 668 iounmap(tmp);
682 j = pcmcia_release_window(link->win); 669 j = pcmcia_release_window(link->win);
683 if (j != 0)
684 cs_error(link, ReleaseWindow, j);
685 } 670 }
686 671
687 pcmcia_disable_device(link); 672 pcmcia_disable_device(link);
@@ -790,8 +775,8 @@ static irqreturn_t fjn_interrupt(int dummy, void *dev_id)
790 outb(tx_stat, ioaddr + TX_STATUS); 775 outb(tx_stat, ioaddr + TX_STATUS);
791 outb(rx_stat, ioaddr + RX_STATUS); 776 outb(rx_stat, ioaddr + RX_STATUS);
792 777
793 DEBUG(4, "%s: interrupt, rx_status %02x.\n", dev->name, rx_stat); 778 pr_debug("%s: interrupt, rx_status %02x.\n", dev->name, rx_stat);
794 DEBUG(4, " tx_status %02x.\n", tx_stat); 779 pr_debug(" tx_status %02x.\n", tx_stat);
795 780
796 if (rx_stat || (inb(ioaddr + RX_MODE) & F_BUF_EMP) == 0) { 781 if (rx_stat || (inb(ioaddr + RX_MODE) & F_BUF_EMP) == 0) {
797 /* there is packet(s) in rx buffer */ 782 /* there is packet(s) in rx buffer */
@@ -811,8 +796,8 @@ static irqreturn_t fjn_interrupt(int dummy, void *dev_id)
811 } 796 }
812 netif_wake_queue(dev); 797 netif_wake_queue(dev);
813 } 798 }
814 DEBUG(4, "%s: exiting interrupt,\n", dev->name); 799 pr_debug("%s: exiting interrupt,\n", dev->name);
815 DEBUG(4, " tx_status %02x, rx_status %02x.\n", tx_stat, rx_stat); 800 pr_debug(" tx_status %02x, rx_status %02x.\n", tx_stat, rx_stat);
816 801
817 outb(D_TX_INTR, ioaddr + TX_INTR); 802 outb(D_TX_INTR, ioaddr + TX_INTR);
818 outb(D_RX_INTR, ioaddr + RX_INTR); 803 outb(D_RX_INTR, ioaddr + RX_INTR);
@@ -884,7 +869,7 @@ static netdev_tx_t fjn_start_xmit(struct sk_buff *skb,
884 return NETDEV_TX_BUSY; 869 return NETDEV_TX_BUSY;
885 } 870 }
886 871
887 DEBUG(4, "%s: Transmitting a packet of length %lu.\n", 872 pr_debug("%s: Transmitting a packet of length %lu.\n",
888 dev->name, (unsigned long)skb->len); 873 dev->name, (unsigned long)skb->len);
889 dev->stats.tx_bytes += skb->len; 874 dev->stats.tx_bytes += skb->len;
890 875
@@ -939,7 +924,7 @@ static void fjn_reset(struct net_device *dev)
939 unsigned int ioaddr = dev->base_addr; 924 unsigned int ioaddr = dev->base_addr;
940 int i; 925 int i;
941 926
942 DEBUG(4, "fjn_reset(%s) called.\n",dev->name); 927 pr_debug("fjn_reset(%s) called.\n",dev->name);
943 928
944 /* Reset controller */ 929 /* Reset controller */
945 if( sram_config == 0 ) 930 if( sram_config == 0 )
@@ -1017,13 +1002,13 @@ static void fjn_rx(struct net_device *dev)
1017 unsigned int ioaddr = dev->base_addr; 1002 unsigned int ioaddr = dev->base_addr;
1018 int boguscount = 10; /* 5 -> 10: by agy 19940922 */ 1003 int boguscount = 10; /* 5 -> 10: by agy 19940922 */
1019 1004
1020 DEBUG(4, "%s: in rx_packet(), rx_status %02x.\n", 1005 pr_debug("%s: in rx_packet(), rx_status %02x.\n",
1021 dev->name, inb(ioaddr + RX_STATUS)); 1006 dev->name, inb(ioaddr + RX_STATUS));
1022 1007
1023 while ((inb(ioaddr + RX_MODE) & F_BUF_EMP) == 0) { 1008 while ((inb(ioaddr + RX_MODE) & F_BUF_EMP) == 0) {
1024 u_short status = inw(ioaddr + DATAPORT); 1009 u_short status = inw(ioaddr + DATAPORT);
1025 1010
1026 DEBUG(4, "%s: Rxing packet mode %02x status %04x.\n", 1011 pr_debug("%s: Rxing packet mode %02x status %04x.\n",
1027 dev->name, inb(ioaddr + RX_MODE), status); 1012 dev->name, inb(ioaddr + RX_MODE), status);
1028#ifndef final_version 1013#ifndef final_version
1029 if (status == 0) { 1014 if (status == 0) {
@@ -1063,16 +1048,14 @@ static void fjn_rx(struct net_device *dev)
1063 (pkt_len + 1) >> 1); 1048 (pkt_len + 1) >> 1);
1064 skb->protocol = eth_type_trans(skb, dev); 1049 skb->protocol = eth_type_trans(skb, dev);
1065 1050
1066#ifdef PCMCIA_DEBUG 1051 {
1067 if (pc_debug > 5) {
1068 int i; 1052 int i;
1069 printk(KERN_DEBUG "%s: Rxed packet of length %d: ", 1053 pr_debug("%s: Rxed packet of length %d: ",
1070 dev->name, pkt_len); 1054 dev->name, pkt_len);
1071 for (i = 0; i < 14; i++) 1055 for (i = 0; i < 14; i++)
1072 printk(" %02x", skb->data[i]); 1056 pr_debug(" %02x", skb->data[i]);
1073 printk(".\n"); 1057 pr_debug(".\n");
1074 } 1058 }
1075#endif
1076 1059
1077 netif_rx(skb); 1060 netif_rx(skb);
1078 dev->stats.rx_packets++; 1061 dev->stats.rx_packets++;
@@ -1096,7 +1079,7 @@ static void fjn_rx(struct net_device *dev)
1096 } 1079 }
1097 1080
1098 if (i > 0) 1081 if (i > 0)
1099 DEBUG(5, "%s: Exint Rx packet with mode %02x after " 1082 pr_debug("%s: Exint Rx packet with mode %02x after "
1100 "%d ticks.\n", dev->name, inb(ioaddr + RX_MODE), i); 1083 "%d ticks.\n", dev->name, inb(ioaddr + RX_MODE), i);
1101 } 1084 }
1102*/ 1085*/
@@ -1114,24 +1097,8 @@ static void netdev_get_drvinfo(struct net_device *dev,
1114 sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); 1097 sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr);
1115} 1098}
1116 1099
1117#ifdef PCMCIA_DEBUG
1118static u32 netdev_get_msglevel(struct net_device *dev)
1119{
1120 return pc_debug;
1121}
1122
1123static void netdev_set_msglevel(struct net_device *dev, u32 level)
1124{
1125 pc_debug = level;
1126}
1127#endif /* PCMCIA_DEBUG */
1128
1129static const struct ethtool_ops netdev_ethtool_ops = { 1100static const struct ethtool_ops netdev_ethtool_ops = {
1130 .get_drvinfo = netdev_get_drvinfo, 1101 .get_drvinfo = netdev_get_drvinfo,
1131#ifdef PCMCIA_DEBUG
1132 .get_msglevel = netdev_get_msglevel,
1133 .set_msglevel = netdev_set_msglevel,
1134#endif /* PCMCIA_DEBUG */
1135}; 1102};
1136 1103
1137static int fjn_config(struct net_device *dev, struct ifmap *map){ 1104static int fjn_config(struct net_device *dev, struct ifmap *map){
@@ -1143,7 +1110,7 @@ static int fjn_open(struct net_device *dev)
1143 struct local_info_t *lp = netdev_priv(dev); 1110 struct local_info_t *lp = netdev_priv(dev);
1144 struct pcmcia_device *link = lp->p_dev; 1111 struct pcmcia_device *link = lp->p_dev;
1145 1112
1146 DEBUG(4, "fjn_open('%s').\n", dev->name); 1113 pr_debug("fjn_open('%s').\n", dev->name);
1147 1114
1148 if (!pcmcia_dev_present(link)) 1115 if (!pcmcia_dev_present(link))
1149 return -ENODEV; 1116 return -ENODEV;
@@ -1169,7 +1136,7 @@ static int fjn_close(struct net_device *dev)
1169 struct pcmcia_device *link = lp->p_dev; 1136 struct pcmcia_device *link = lp->p_dev;
1170 unsigned int ioaddr = dev->base_addr; 1137 unsigned int ioaddr = dev->base_addr;
1171 1138
1172 DEBUG(4, "fjn_close('%s').\n", dev->name); 1139 pr_debug("fjn_close('%s').\n", dev->name);
1173 1140
1174 lp->open_time = 0; 1141 lp->open_time = 0;
1175 netif_stop_queue(dev); 1142 netif_stop_queue(dev);
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index 06618af1a468..0d914f3b2941 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -69,17 +69,6 @@
69#define PCMCIA 69#define PCMCIA
70#include "../tokenring/ibmtr.c" 70#include "../tokenring/ibmtr.c"
71 71
72#ifdef PCMCIA_DEBUG
73static int pc_debug = PCMCIA_DEBUG;
74module_param(pc_debug, int, 0);
75#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
76static char *version =
77"ibmtr_cs.c 1.10 1996/01/06 05:19:00 (Steve Kipisz)\n"
78" 2.2.7 1999/05/03 12:00:00 (Mike Phillips)\n"
79" 2.4.2 2001/30/28 Midnight (Burt Silverman)\n";
80#else
81#define DEBUG(n, args...)
82#endif
83 72
84/*====================================================================*/ 73/*====================================================================*/
85 74
@@ -143,7 +132,7 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link)
143 ibmtr_dev_t *info; 132 ibmtr_dev_t *info;
144 struct net_device *dev; 133 struct net_device *dev;
145 134
146 DEBUG(0, "ibmtr_attach()\n"); 135 dev_dbg(&link->dev, "ibmtr_attach()\n");
147 136
148 /* Create new token-ring device */ 137 /* Create new token-ring device */
149 info = kzalloc(sizeof(*info), GFP_KERNEL); 138 info = kzalloc(sizeof(*info), GFP_KERNEL);
@@ -190,7 +179,7 @@ static void ibmtr_detach(struct pcmcia_device *link)
190 struct net_device *dev = info->dev; 179 struct net_device *dev = info->dev;
191 struct tok_info *ti = netdev_priv(dev); 180 struct tok_info *ti = netdev_priv(dev);
192 181
193 DEBUG(0, "ibmtr_detach(0x%p)\n", link); 182 dev_dbg(&link->dev, "ibmtr_detach\n");
194 183
195 /* 184 /*
196 * When the card removal interrupt hits tok_interrupt(), 185 * When the card removal interrupt hits tok_interrupt(),
@@ -217,9 +206,6 @@ static void ibmtr_detach(struct pcmcia_device *link)
217 206
218======================================================================*/ 207======================================================================*/
219 208
220#define CS_CHECK(fn, ret) \
221do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
222
223static int __devinit ibmtr_config(struct pcmcia_device *link) 209static int __devinit ibmtr_config(struct pcmcia_device *link)
224{ 210{
225 ibmtr_dev_t *info = link->priv; 211 ibmtr_dev_t *info = link->priv;
@@ -227,9 +213,9 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
227 struct tok_info *ti = netdev_priv(dev); 213 struct tok_info *ti = netdev_priv(dev);
228 win_req_t req; 214 win_req_t req;
229 memreq_t mem; 215 memreq_t mem;
230 int i, last_ret, last_fn; 216 int i, ret;
231 217
232 DEBUG(0, "ibmtr_config(0x%p)\n", link); 218 dev_dbg(&link->dev, "ibmtr_config\n");
233 219
234 link->conf.ConfigIndex = 0x61; 220 link->conf.ConfigIndex = 0x61;
235 221
@@ -241,11 +227,15 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
241 if (i != 0) { 227 if (i != 0) {
242 /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */ 228 /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */
243 link->io.BasePort1 = 0xA24; 229 link->io.BasePort1 = 0xA24;
244 CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); 230 ret = pcmcia_request_io(link, &link->io);
231 if (ret)
232 goto failed;
245 } 233 }
246 dev->base_addr = link->io.BasePort1; 234 dev->base_addr = link->io.BasePort1;
247 235
248 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 236 ret = pcmcia_request_irq(link, &link->irq);
237 if (ret)
238 goto failed;
249 dev->irq = link->irq.AssignedIRQ; 239 dev->irq = link->irq.AssignedIRQ;
250 ti->irq = link->irq.AssignedIRQ; 240 ti->irq = link->irq.AssignedIRQ;
251 ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); 241 ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq);
@@ -256,11 +246,15 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
256 req.Base = 0; 246 req.Base = 0;
257 req.Size = 0x2000; 247 req.Size = 0x2000;
258 req.AccessSpeed = 250; 248 req.AccessSpeed = 250;
259 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win)); 249 ret = pcmcia_request_window(&link, &req, &link->win);
250 if (ret)
251 goto failed;
260 252
261 mem.CardOffset = mmiobase; 253 mem.CardOffset = mmiobase;
262 mem.Page = 0; 254 mem.Page = 0;
263 CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); 255 ret = pcmcia_map_mem_page(link->win, &mem);
256 if (ret)
257 goto failed;
264 ti->mmio = ioremap(req.Base, req.Size); 258 ti->mmio = ioremap(req.Base, req.Size);
265 259
266 /* Allocate the SRAM memory window */ 260 /* Allocate the SRAM memory window */
@@ -269,17 +263,23 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
269 req.Base = 0; 263 req.Base = 0;
270 req.Size = sramsize * 1024; 264 req.Size = sramsize * 1024;
271 req.AccessSpeed = 250; 265 req.AccessSpeed = 250;
272 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &info->sram_win_handle)); 266 ret = pcmcia_request_window(&link, &req, &info->sram_win_handle);
267 if (ret)
268 goto failed;
273 269
274 mem.CardOffset = srambase; 270 mem.CardOffset = srambase;
275 mem.Page = 0; 271 mem.Page = 0;
276 CS_CHECK(MapMemPage, pcmcia_map_mem_page(info->sram_win_handle, &mem)); 272 ret = pcmcia_map_mem_page(info->sram_win_handle, &mem);
273 if (ret)
274 goto failed;
277 275
278 ti->sram_base = mem.CardOffset >> 12; 276 ti->sram_base = mem.CardOffset >> 12;
279 ti->sram_virt = ioremap(req.Base, req.Size); 277 ti->sram_virt = ioremap(req.Base, req.Size);
280 ti->sram_phys = req.Base; 278 ti->sram_phys = req.Base;
281 279
282 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 280 ret = pcmcia_request_configuration(link, &link->conf);
281 if (ret)
282 goto failed;
283 283
284 /* Set up the Token-Ring Controller Configuration Register and 284 /* Set up the Token-Ring Controller Configuration Register and
285 turn on the card. Check the "Local Area Network Credit Card 285 turn on the card. Check the "Local Area Network Credit Card
@@ -305,8 +305,6 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
305 dev->dev_addr); 305 dev->dev_addr);
306 return 0; 306 return 0;
307 307
308cs_failed:
309 cs_error(link, last_fn, last_ret);
310failed: 308failed:
311 ibmtr_release(link); 309 ibmtr_release(link);
312 return -ENODEV; 310 return -ENODEV;
@@ -325,7 +323,7 @@ static void ibmtr_release(struct pcmcia_device *link)
325 ibmtr_dev_t *info = link->priv; 323 ibmtr_dev_t *info = link->priv;
326 struct net_device *dev = info->dev; 324 struct net_device *dev = info->dev;
327 325
328 DEBUG(0, "ibmtr_release(0x%p)\n", link); 326 dev_dbg(&link->dev, "ibmtr_release\n");
329 327
330 if (link->win) { 328 if (link->win) {
331 struct tok_info *ti = netdev_priv(dev); 329 struct tok_info *ti = netdev_priv(dev);
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index 4b96b356d979..a5363483ec6f 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -381,13 +381,6 @@ typedef struct _mace_private {
381Private Global Variables 381Private Global Variables
382---------------------------------------------------------------------------- */ 382---------------------------------------------------------------------------- */
383 383
384#ifdef PCMCIA_DEBUG
385static char rcsid[] =
386"nmclan_cs.c,v 0.16 1995/07/01 06:42:17 rpao Exp rpao";
387static char *version =
388DRV_NAME " " DRV_VERSION " (Roger C. Pao)";
389#endif
390
391static const char *if_names[]={ 384static const char *if_names[]={
392 "Auto", "10baseT", "BNC", 385 "Auto", "10baseT", "BNC",
393}; 386};
@@ -406,12 +399,6 @@ MODULE_LICENSE("GPL");
406/* 0=auto, 1=10baseT, 2 = 10base2, default=auto */ 399/* 0=auto, 1=10baseT, 2 = 10base2, default=auto */
407INT_MODULE_PARM(if_port, 0); 400INT_MODULE_PARM(if_port, 0);
408 401
409#ifdef PCMCIA_DEBUG
410INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
411#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
412#else
413#define DEBUG(n, args...)
414#endif
415 402
416/* ---------------------------------------------------------------------------- 403/* ----------------------------------------------------------------------------
417Function Prototypes 404Function Prototypes
@@ -462,8 +449,7 @@ static int nmclan_probe(struct pcmcia_device *link)
462 mace_private *lp; 449 mace_private *lp;
463 struct net_device *dev; 450 struct net_device *dev;
464 451
465 DEBUG(0, "nmclan_attach()\n"); 452 dev_dbg(&link->dev, "nmclan_attach()\n");
466 DEBUG(1, "%s\n", rcsid);
467 453
468 /* Create new ethernet device */ 454 /* Create new ethernet device */
469 dev = alloc_etherdev(sizeof(mace_private)); 455 dev = alloc_etherdev(sizeof(mace_private));
@@ -507,7 +493,7 @@ static void nmclan_detach(struct pcmcia_device *link)
507{ 493{
508 struct net_device *dev = link->priv; 494 struct net_device *dev = link->priv;
509 495
510 DEBUG(0, "nmclan_detach(0x%p)\n", link); 496 dev_dbg(&link->dev, "nmclan_detach\n");
511 497
512 if (link->dev_node) 498 if (link->dev_node)
513 unregister_netdev(dev); 499 unregister_netdev(dev);
@@ -654,23 +640,27 @@ nmclan_config
654 ethernet device available to the system. 640 ethernet device available to the system.
655---------------------------------------------------------------------------- */ 641---------------------------------------------------------------------------- */
656 642
657#define CS_CHECK(fn, ret) \
658 do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
659
660static int nmclan_config(struct pcmcia_device *link) 643static int nmclan_config(struct pcmcia_device *link)
661{ 644{
662 struct net_device *dev = link->priv; 645 struct net_device *dev = link->priv;
663 mace_private *lp = netdev_priv(dev); 646 mace_private *lp = netdev_priv(dev);
664 u8 *buf; 647 u8 *buf;
665 size_t len; 648 size_t len;
666 int i, last_ret, last_fn; 649 int i, ret;
667 unsigned int ioaddr; 650 unsigned int ioaddr;
668 651
669 DEBUG(0, "nmclan_config(0x%p)\n", link); 652 dev_dbg(&link->dev, "nmclan_config\n");
653
654 ret = pcmcia_request_io(link, &link->io);
655 if (ret)
656 goto failed;
657 ret = pcmcia_request_irq(link, &link->irq);
658 if (ret)
659 goto failed;
660 ret = pcmcia_request_configuration(link, &link->conf);
661 if (ret)
662 goto failed;
670 663
671 CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
672 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
673 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
674 dev->irq = link->irq.AssignedIRQ; 664 dev->irq = link->irq.AssignedIRQ;
675 dev->base_addr = link->io.BasePort1; 665 dev->base_addr = link->io.BasePort1;
676 666
@@ -692,7 +682,7 @@ static int nmclan_config(struct pcmcia_device *link)
692 sig[0] = mace_read(lp, ioaddr, MACE_CHIPIDL); 682 sig[0] = mace_read(lp, ioaddr, MACE_CHIPIDL);
693 sig[1] = mace_read(lp, ioaddr, MACE_CHIPIDH); 683 sig[1] = mace_read(lp, ioaddr, MACE_CHIPIDH);
694 if ((sig[0] == 0x40) && ((sig[1] & 0x0F) == 0x09)) { 684 if ((sig[0] == 0x40) && ((sig[1] & 0x0F) == 0x09)) {
695 DEBUG(0, "nmclan_cs configured: mace id=%x %x\n", 685 dev_dbg(&link->dev, "nmclan_cs configured: mace id=%x %x\n",
696 sig[0], sig[1]); 686 sig[0], sig[1]);
697 } else { 687 } else {
698 printk(KERN_NOTICE "nmclan_cs: mace id not found: %x %x should" 688 printk(KERN_NOTICE "nmclan_cs: mace id not found: %x %x should"
@@ -728,8 +718,6 @@ static int nmclan_config(struct pcmcia_device *link)
728 dev->dev_addr); 718 dev->dev_addr);
729 return 0; 719 return 0;
730 720
731cs_failed:
732 cs_error(link, last_fn, last_ret);
733failed: 721failed:
734 nmclan_release(link); 722 nmclan_release(link);
735 return -ENODEV; 723 return -ENODEV;
@@ -743,7 +731,7 @@ nmclan_release
743---------------------------------------------------------------------------- */ 731---------------------------------------------------------------------------- */
744static void nmclan_release(struct pcmcia_device *link) 732static void nmclan_release(struct pcmcia_device *link)
745{ 733{
746 DEBUG(0, "nmclan_release(0x%p)\n", link); 734 dev_dbg(&link->dev, "nmclan_release\n");
747 pcmcia_disable_device(link); 735 pcmcia_disable_device(link);
748} 736}
749 737
@@ -794,7 +782,7 @@ static void nmclan_reset(struct net_device *dev)
794 /* Reset Xilinx */ 782 /* Reset Xilinx */
795 reg.Action = CS_WRITE; 783 reg.Action = CS_WRITE;
796 reg.Offset = CISREG_COR; 784 reg.Offset = CISREG_COR;
797 DEBUG(1, "nmclan_reset: OrigCorValue=0x%lX, resetting...\n", 785 dev_dbg(&link->dev, "nmclan_reset: OrigCorValue=0x%lX, resetting...\n",
798 OrigCorValue); 786 OrigCorValue);
799 reg.Value = COR_SOFT_RESET; 787 reg.Value = COR_SOFT_RESET;
800 pcmcia_access_configuration_register(link, &reg); 788 pcmcia_access_configuration_register(link, &reg);
@@ -871,7 +859,7 @@ static int mace_close(struct net_device *dev)
871 mace_private *lp = netdev_priv(dev); 859 mace_private *lp = netdev_priv(dev);
872 struct pcmcia_device *link = lp->p_dev; 860 struct pcmcia_device *link = lp->p_dev;
873 861
874 DEBUG(2, "%s: shutting down ethercard.\n", dev->name); 862 dev_dbg(&link->dev, "%s: shutting down ethercard.\n", dev->name);
875 863
876 /* Mask off all interrupts from the MACE chip. */ 864 /* Mask off all interrupts from the MACE chip. */
877 outb(0xFF, ioaddr + AM2150_MACE_BASE + MACE_IMR); 865 outb(0xFF, ioaddr + AM2150_MACE_BASE + MACE_IMR);
@@ -890,24 +878,8 @@ static void netdev_get_drvinfo(struct net_device *dev,
890 sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); 878 sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr);
891} 879}
892 880
893#ifdef PCMCIA_DEBUG
894static u32 netdev_get_msglevel(struct net_device *dev)
895{
896 return pc_debug;
897}
898
899static void netdev_set_msglevel(struct net_device *dev, u32 level)
900{
901 pc_debug = level;
902}
903#endif /* PCMCIA_DEBUG */
904
905static const struct ethtool_ops netdev_ethtool_ops = { 881static const struct ethtool_ops netdev_ethtool_ops = {
906 .get_drvinfo = netdev_get_drvinfo, 882 .get_drvinfo = netdev_get_drvinfo,
907#ifdef PCMCIA_DEBUG
908 .get_msglevel = netdev_get_msglevel,
909 .set_msglevel = netdev_set_msglevel,
910#endif /* PCMCIA_DEBUG */
911}; 883};
912 884
913/* ---------------------------------------------------------------------------- 885/* ----------------------------------------------------------------------------
@@ -945,7 +917,7 @@ static netdev_tx_t mace_start_xmit(struct sk_buff *skb,
945 917
946 netif_stop_queue(dev); 918 netif_stop_queue(dev);
947 919
948 DEBUG(3, "%s: mace_start_xmit(length = %ld) called.\n", 920 pr_debug("%s: mace_start_xmit(length = %ld) called.\n",
949 dev->name, (long)skb->len); 921 dev->name, (long)skb->len);
950 922
951#if (!TX_INTERRUPTABLE) 923#if (!TX_INTERRUPTABLE)
@@ -1007,7 +979,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id)
1007 int IntrCnt = MACE_MAX_IR_ITERATIONS; 979 int IntrCnt = MACE_MAX_IR_ITERATIONS;
1008 980
1009 if (dev == NULL) { 981 if (dev == NULL) {
1010 DEBUG(2, "mace_interrupt(): irq 0x%X for unknown device.\n", 982 pr_debug("mace_interrupt(): irq 0x%X for unknown device.\n",
1011 irq); 983 irq);
1012 return IRQ_NONE; 984 return IRQ_NONE;
1013 } 985 }
@@ -1030,7 +1002,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id)
1030 } 1002 }
1031 1003
1032 if (!netif_device_present(dev)) { 1004 if (!netif_device_present(dev)) {
1033 DEBUG(2, "%s: interrupt from dead card\n", dev->name); 1005 pr_debug("%s: interrupt from dead card\n", dev->name);
1034 return IRQ_NONE; 1006 return IRQ_NONE;
1035 } 1007 }
1036 1008
@@ -1038,7 +1010,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id)
1038 /* WARNING: MACE_IR is a READ/CLEAR port! */ 1010 /* WARNING: MACE_IR is a READ/CLEAR port! */
1039 status = inb(ioaddr + AM2150_MACE_BASE + MACE_IR); 1011 status = inb(ioaddr + AM2150_MACE_BASE + MACE_IR);
1040 1012
1041 DEBUG(3, "mace_interrupt: irq 0x%X status 0x%X.\n", irq, status); 1013 pr_debug("mace_interrupt: irq 0x%X status 0x%X.\n", irq, status);
1042 1014
1043 if (status & MACE_IR_RCVINT) { 1015 if (status & MACE_IR_RCVINT) {
1044 mace_rx(dev, MACE_MAX_RX_ITERATIONS); 1016 mace_rx(dev, MACE_MAX_RX_ITERATIONS);
@@ -1157,7 +1129,7 @@ static int mace_rx(struct net_device *dev, unsigned char RxCnt)
1157 ) { 1129 ) {
1158 rx_status = inw(ioaddr + AM2150_RCV); 1130 rx_status = inw(ioaddr + AM2150_RCV);
1159 1131
1160 DEBUG(3, "%s: in mace_rx(), framecnt 0x%X, rx_status" 1132 pr_debug("%s: in mace_rx(), framecnt 0x%X, rx_status"
1161 " 0x%X.\n", dev->name, rx_framecnt, rx_status); 1133 " 0x%X.\n", dev->name, rx_framecnt, rx_status);
1162 1134
1163 if (rx_status & MACE_RCVFS_RCVSTS) { /* Error, update stats. */ 1135 if (rx_status & MACE_RCVFS_RCVSTS) { /* Error, update stats. */
@@ -1184,7 +1156,7 @@ static int mace_rx(struct net_device *dev, unsigned char RxCnt)
1184 lp->mace_stats.rfs_rcvcc += inb(ioaddr + AM2150_RCV); 1156 lp->mace_stats.rfs_rcvcc += inb(ioaddr + AM2150_RCV);
1185 /* rcv collision count */ 1157 /* rcv collision count */
1186 1158
1187 DEBUG(3, " receiving packet size 0x%X rx_status" 1159 pr_debug(" receiving packet size 0x%X rx_status"
1188 " 0x%X.\n", pkt_len, rx_status); 1160 " 0x%X.\n", pkt_len, rx_status);
1189 1161
1190 skb = dev_alloc_skb(pkt_len+2); 1162 skb = dev_alloc_skb(pkt_len+2);
@@ -1203,7 +1175,7 @@ static int mace_rx(struct net_device *dev, unsigned char RxCnt)
1203 outb(0xFF, ioaddr + AM2150_RCV_NEXT); /* skip to next frame */ 1175 outb(0xFF, ioaddr + AM2150_RCV_NEXT); /* skip to next frame */
1204 continue; 1176 continue;
1205 } else { 1177 } else {
1206 DEBUG(1, "%s: couldn't allocate a sk_buff of size" 1178 pr_debug("%s: couldn't allocate a sk_buff of size"
1207 " %d.\n", dev->name, pkt_len); 1179 " %d.\n", dev->name, pkt_len);
1208 lp->linux_stats.rx_dropped++; 1180 lp->linux_stats.rx_dropped++;
1209 } 1181 }
@@ -1219,28 +1191,28 @@ pr_linux_stats
1219---------------------------------------------------------------------------- */ 1191---------------------------------------------------------------------------- */
1220static void pr_linux_stats(struct net_device_stats *pstats) 1192static void pr_linux_stats(struct net_device_stats *pstats)
1221{ 1193{
1222 DEBUG(2, "pr_linux_stats\n"); 1194 pr_debug("pr_linux_stats\n");
1223 DEBUG(2, " rx_packets=%-7ld tx_packets=%ld\n", 1195 pr_debug(" rx_packets=%-7ld tx_packets=%ld\n",
1224 (long)pstats->rx_packets, (long)pstats->tx_packets); 1196 (long)pstats->rx_packets, (long)pstats->tx_packets);
1225 DEBUG(2, " rx_errors=%-7ld tx_errors=%ld\n", 1197 pr_debug(" rx_errors=%-7ld tx_errors=%ld\n",
1226 (long)pstats->rx_errors, (long)pstats->tx_errors); 1198 (long)pstats->rx_errors, (long)pstats->tx_errors);
1227 DEBUG(2, " rx_dropped=%-7ld tx_dropped=%ld\n", 1199 pr_debug(" rx_dropped=%-7ld tx_dropped=%ld\n",
1228 (long)pstats->rx_dropped, (long)pstats->tx_dropped); 1200 (long)pstats->rx_dropped, (long)pstats->tx_dropped);
1229 DEBUG(2, " multicast=%-7ld collisions=%ld\n", 1201 pr_debug(" multicast=%-7ld collisions=%ld\n",
1230 (long)pstats->multicast, (long)pstats->collisions); 1202 (long)pstats->multicast, (long)pstats->collisions);
1231 1203
1232 DEBUG(2, " rx_length_errors=%-7ld rx_over_errors=%ld\n", 1204 pr_debug(" rx_length_errors=%-7ld rx_over_errors=%ld\n",
1233 (long)pstats->rx_length_errors, (long)pstats->rx_over_errors); 1205 (long)pstats->rx_length_errors, (long)pstats->rx_over_errors);
1234 DEBUG(2, " rx_crc_errors=%-7ld rx_frame_errors=%ld\n", 1206 pr_debug(" rx_crc_errors=%-7ld rx_frame_errors=%ld\n",
1235 (long)pstats->rx_crc_errors, (long)pstats->rx_frame_errors); 1207 (long)pstats->rx_crc_errors, (long)pstats->rx_frame_errors);
1236 DEBUG(2, " rx_fifo_errors=%-7ld rx_missed_errors=%ld\n", 1208 pr_debug(" rx_fifo_errors=%-7ld rx_missed_errors=%ld\n",
1237 (long)pstats->rx_fifo_errors, (long)pstats->rx_missed_errors); 1209 (long)pstats->rx_fifo_errors, (long)pstats->rx_missed_errors);
1238 1210
1239 DEBUG(2, " tx_aborted_errors=%-7ld tx_carrier_errors=%ld\n", 1211 pr_debug(" tx_aborted_errors=%-7ld tx_carrier_errors=%ld\n",
1240 (long)pstats->tx_aborted_errors, (long)pstats->tx_carrier_errors); 1212 (long)pstats->tx_aborted_errors, (long)pstats->tx_carrier_errors);
1241 DEBUG(2, " tx_fifo_errors=%-7ld tx_heartbeat_errors=%ld\n", 1213 pr_debug(" tx_fifo_errors=%-7ld tx_heartbeat_errors=%ld\n",
1242 (long)pstats->tx_fifo_errors, (long)pstats->tx_heartbeat_errors); 1214 (long)pstats->tx_fifo_errors, (long)pstats->tx_heartbeat_errors);
1243 DEBUG(2, " tx_window_errors=%ld\n", 1215 pr_debug(" tx_window_errors=%ld\n",
1244 (long)pstats->tx_window_errors); 1216 (long)pstats->tx_window_errors);
1245} /* pr_linux_stats */ 1217} /* pr_linux_stats */
1246 1218
@@ -1249,48 +1221,48 @@ pr_mace_stats
1249---------------------------------------------------------------------------- */ 1221---------------------------------------------------------------------------- */
1250static void pr_mace_stats(mace_statistics *pstats) 1222static void pr_mace_stats(mace_statistics *pstats)
1251{ 1223{
1252 DEBUG(2, "pr_mace_stats\n"); 1224 pr_debug("pr_mace_stats\n");
1253 1225
1254 DEBUG(2, " xmtsv=%-7d uflo=%d\n", 1226 pr_debug(" xmtsv=%-7d uflo=%d\n",
1255 pstats->xmtsv, pstats->uflo); 1227 pstats->xmtsv, pstats->uflo);
1256 DEBUG(2, " lcol=%-7d more=%d\n", 1228 pr_debug(" lcol=%-7d more=%d\n",
1257 pstats->lcol, pstats->more); 1229 pstats->lcol, pstats->more);
1258 DEBUG(2, " one=%-7d defer=%d\n", 1230 pr_debug(" one=%-7d defer=%d\n",
1259 pstats->one, pstats->defer); 1231 pstats->one, pstats->defer);
1260 DEBUG(2, " lcar=%-7d rtry=%d\n", 1232 pr_debug(" lcar=%-7d rtry=%d\n",
1261 pstats->lcar, pstats->rtry); 1233 pstats->lcar, pstats->rtry);
1262 1234
1263 /* MACE_XMTRC */ 1235 /* MACE_XMTRC */
1264 DEBUG(2, " exdef=%-7d xmtrc=%d\n", 1236 pr_debug(" exdef=%-7d xmtrc=%d\n",
1265 pstats->exdef, pstats->xmtrc); 1237 pstats->exdef, pstats->xmtrc);
1266 1238
1267 /* RFS1--Receive Status (RCVSTS) */ 1239 /* RFS1--Receive Status (RCVSTS) */
1268 DEBUG(2, " oflo=%-7d clsn=%d\n", 1240 pr_debug(" oflo=%-7d clsn=%d\n",
1269 pstats->oflo, pstats->clsn); 1241 pstats->oflo, pstats->clsn);
1270 DEBUG(2, " fram=%-7d fcs=%d\n", 1242 pr_debug(" fram=%-7d fcs=%d\n",
1271 pstats->fram, pstats->fcs); 1243 pstats->fram, pstats->fcs);
1272 1244
1273 /* RFS2--Runt Packet Count (RNTPC) */ 1245 /* RFS2--Runt Packet Count (RNTPC) */
1274 /* RFS3--Receive Collision Count (RCVCC) */ 1246 /* RFS3--Receive Collision Count (RCVCC) */
1275 DEBUG(2, " rfs_rntpc=%-7d rfs_rcvcc=%d\n", 1247 pr_debug(" rfs_rntpc=%-7d rfs_rcvcc=%d\n",
1276 pstats->rfs_rntpc, pstats->rfs_rcvcc); 1248 pstats->rfs_rntpc, pstats->rfs_rcvcc);
1277 1249
1278 /* MACE_IR */ 1250 /* MACE_IR */
1279 DEBUG(2, " jab=%-7d babl=%d\n", 1251 pr_debug(" jab=%-7d babl=%d\n",
1280 pstats->jab, pstats->babl); 1252 pstats->jab, pstats->babl);
1281 DEBUG(2, " cerr=%-7d rcvcco=%d\n", 1253 pr_debug(" cerr=%-7d rcvcco=%d\n",
1282 pstats->cerr, pstats->rcvcco); 1254 pstats->cerr, pstats->rcvcco);
1283 DEBUG(2, " rntpco=%-7d mpco=%d\n", 1255 pr_debug(" rntpco=%-7d mpco=%d\n",
1284 pstats->rntpco, pstats->mpco); 1256 pstats->rntpco, pstats->mpco);
1285 1257
1286 /* MACE_MPC */ 1258 /* MACE_MPC */
1287 DEBUG(2, " mpc=%d\n", pstats->mpc); 1259 pr_debug(" mpc=%d\n", pstats->mpc);
1288 1260
1289 /* MACE_RNTPC */ 1261 /* MACE_RNTPC */
1290 DEBUG(2, " rntpc=%d\n", pstats->rntpc); 1262 pr_debug(" rntpc=%d\n", pstats->rntpc);
1291 1263
1292 /* MACE_RCVCC */ 1264 /* MACE_RCVCC */
1293 DEBUG(2, " rcvcc=%d\n", pstats->rcvcc); 1265 pr_debug(" rcvcc=%d\n", pstats->rcvcc);
1294 1266
1295} /* pr_mace_stats */ 1267} /* pr_mace_stats */
1296 1268
@@ -1359,7 +1331,7 @@ static struct net_device_stats *mace_get_stats(struct net_device *dev)
1359 1331
1360 update_stats(dev->base_addr, dev); 1332 update_stats(dev->base_addr, dev);
1361 1333
1362 DEBUG(1, "%s: updating the statistics.\n", dev->name); 1334 pr_debug("%s: updating the statistics.\n", dev->name);
1363 pr_linux_stats(&lp->linux_stats); 1335 pr_linux_stats(&lp->linux_stats);
1364 pr_mace_stats(&lp->mace_stats); 1336 pr_mace_stats(&lp->mace_stats);
1365 1337
@@ -1426,7 +1398,7 @@ static void BuildLAF(int *ladrf, int *adr)
1426 ladrf[byte] |= (1 << (hashcode & 7)); 1398 ladrf[byte] |= (1 << (hashcode & 7));
1427 1399
1428#ifdef PCMCIA_DEBUG 1400#ifdef PCMCIA_DEBUG
1429 if (pc_debug > 2) 1401 if (0)
1430 printk(KERN_DEBUG " adr =%pM\n", adr); 1402 printk(KERN_DEBUG " adr =%pM\n", adr);
1431 printk(KERN_DEBUG " hashcode = %d(decimal), ladrf[0:63] =", hashcode); 1403 printk(KERN_DEBUG " hashcode = %d(decimal), ladrf[0:63] =", hashcode);
1432 for (i = 0; i < 8; i++) 1404 for (i = 0; i < 8; i++)
@@ -1453,12 +1425,12 @@ static void restore_multicast_list(struct net_device *dev)
1453 unsigned int ioaddr = dev->base_addr; 1425 unsigned int ioaddr = dev->base_addr;
1454 int i; 1426 int i;
1455 1427
1456 DEBUG(2, "%s: restoring Rx mode to %d addresses.\n", 1428 pr_debug("%s: restoring Rx mode to %d addresses.\n",
1457 dev->name, num_addrs); 1429 dev->name, num_addrs);
1458 1430
1459 if (num_addrs > 0) { 1431 if (num_addrs > 0) {
1460 1432
1461 DEBUG(1, "Attempt to restore multicast list detected.\n"); 1433 pr_debug("Attempt to restore multicast list detected.\n");
1462 1434
1463 mace_write(lp, ioaddr, MACE_IAC, MACE_IAC_ADDRCHG | MACE_IAC_LOGADDR); 1435 mace_write(lp, ioaddr, MACE_IAC, MACE_IAC_ADDRCHG | MACE_IAC_LOGADDR);
1464 /* Poll ADDRCHG bit */ 1436 /* Poll ADDRCHG bit */
@@ -1510,11 +1482,11 @@ static void set_multicast_list(struct net_device *dev)
1510 struct dev_mc_list *dmi = dev->mc_list; 1482 struct dev_mc_list *dmi = dev->mc_list;
1511 1483
1512#ifdef PCMCIA_DEBUG 1484#ifdef PCMCIA_DEBUG
1513 if (pc_debug > 1) { 1485 {
1514 static int old; 1486 static int old;
1515 if (dev->mc_count != old) { 1487 if (dev->mc_count != old) {
1516 old = dev->mc_count; 1488 old = dev->mc_count;
1517 DEBUG(0, "%s: setting Rx mode to %d addresses.\n", 1489 pr_debug("%s: setting Rx mode to %d addresses.\n",
1518 dev->name, old); 1490 dev->name, old);
1519 } 1491 }
1520 } 1492 }
@@ -1545,7 +1517,7 @@ static void restore_multicast_list(struct net_device *dev)
1545 unsigned int ioaddr = dev->base_addr; 1517 unsigned int ioaddr = dev->base_addr;
1546 mace_private *lp = netdev_priv(dev); 1518 mace_private *lp = netdev_priv(dev);
1547 1519
1548 DEBUG(2, "%s: restoring Rx mode to %d addresses.\n", dev->name, 1520 pr_debug("%s: restoring Rx mode to %d addresses.\n", dev->name,
1549 lp->multicast_num_addrs); 1521 lp->multicast_num_addrs);
1550 1522
1551 if (dev->flags & IFF_PROMISC) { 1523 if (dev->flags & IFF_PROMISC) {
@@ -1566,11 +1538,11 @@ static void set_multicast_list(struct net_device *dev)
1566 mace_private *lp = netdev_priv(dev); 1538 mace_private *lp = netdev_priv(dev);
1567 1539
1568#ifdef PCMCIA_DEBUG 1540#ifdef PCMCIA_DEBUG
1569 if (pc_debug > 1) { 1541 {
1570 static int old; 1542 static int old;
1571 if (dev->mc_count != old) { 1543 if (dev->mc_count != old) {
1572 old = dev->mc_count; 1544 old = dev->mc_count;
1573 DEBUG(0, "%s: setting Rx mode to %d addresses.\n", 1545 pr_debug("%s: setting Rx mode to %d addresses.\n",
1574 dev->name, old); 1546 dev->name, old);
1575 } 1547 }
1576 } 1548 }
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index bd3447f04902..80ab9de1c4df 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -71,15 +71,6 @@
71 71
72static const char *if_names[] = { "auto", "10baseT", "10base2"}; 72static const char *if_names[] = { "auto", "10baseT", "10base2"};
73 73
74#ifdef PCMCIA_DEBUG
75static int pc_debug = PCMCIA_DEBUG;
76module_param(pc_debug, int, 0);
77#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
78static char *version =
79"pcnet_cs.c 1.153 2003/11/09 18:53:09 (David Hinds)";
80#else
81#define DEBUG(n, args...)
82#endif
83 74
84/*====================================================================*/ 75/*====================================================================*/
85 76
@@ -265,7 +256,7 @@ static int pcnet_probe(struct pcmcia_device *link)
265 pcnet_dev_t *info; 256 pcnet_dev_t *info;
266 struct net_device *dev; 257 struct net_device *dev;
267 258
268 DEBUG(0, "pcnet_attach()\n"); 259 dev_dbg(&link->dev, "pcnet_attach()\n");
269 260
270 /* Create new ethernet device */ 261 /* Create new ethernet device */
271 dev = __alloc_ei_netdev(sizeof(pcnet_dev_t)); 262 dev = __alloc_ei_netdev(sizeof(pcnet_dev_t));
@@ -297,7 +288,7 @@ static void pcnet_detach(struct pcmcia_device *link)
297{ 288{
298 struct net_device *dev = link->priv; 289 struct net_device *dev = link->priv;
299 290
300 DEBUG(0, "pcnet_detach(0x%p)\n", link); 291 dev_dbg(&link->dev, "pcnet_detach\n");
301 292
302 if (link->dev_node) 293 if (link->dev_node)
303 unregister_netdev(dev); 294 unregister_netdev(dev);
@@ -327,10 +318,8 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link)
327 req.Base = 0; req.Size = 0; 318 req.Base = 0; req.Size = 0;
328 req.AccessSpeed = 0; 319 req.AccessSpeed = 0;
329 i = pcmcia_request_window(&link, &req, &link->win); 320 i = pcmcia_request_window(&link, &req, &link->win);
330 if (i != 0) { 321 if (i != 0)
331 cs_error(link, RequestWindow, i);
332 return NULL; 322 return NULL;
333 }
334 323
335 virt = ioremap(req.Base, req.Size); 324 virt = ioremap(req.Base, req.Size);
336 mem.Page = 0; 325 mem.Page = 0;
@@ -349,8 +338,6 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link)
349 338
350 iounmap(virt); 339 iounmap(virt);
351 j = pcmcia_release_window(link->win); 340 j = pcmcia_release_window(link->win);
352 if (j != 0)
353 cs_error(link, ReleaseWindow, j);
354 return (i < NR_INFO) ? hw_info+i : NULL; 341 return (i < NR_INFO) ? hw_info+i : NULL;
355} /* get_hwinfo */ 342} /* get_hwinfo */
356 343
@@ -495,9 +482,6 @@ static hw_info_t *get_hwired(struct pcmcia_device *link)
495 482
496======================================================================*/ 483======================================================================*/
497 484
498#define CS_CHECK(fn, ret) \
499do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
500
501static int try_io_port(struct pcmcia_device *link) 485static int try_io_port(struct pcmcia_device *link)
502{ 486{
503 int j, ret; 487 int j, ret;
@@ -567,19 +551,19 @@ static int pcnet_config(struct pcmcia_device *link)
567{ 551{
568 struct net_device *dev = link->priv; 552 struct net_device *dev = link->priv;
569 pcnet_dev_t *info = PRIV(dev); 553 pcnet_dev_t *info = PRIV(dev);
570 int last_ret, last_fn, start_pg, stop_pg, cm_offset; 554 int ret, start_pg, stop_pg, cm_offset;
571 int has_shmem = 0; 555 int has_shmem = 0;
572 hw_info_t *local_hw_info; 556 hw_info_t *local_hw_info;
573 557
574 DEBUG(0, "pcnet_config(0x%p)\n", link); 558 dev_dbg(&link->dev, "pcnet_config\n");
575 559
576 last_ret = pcmcia_loop_config(link, pcnet_confcheck, &has_shmem); 560 ret = pcmcia_loop_config(link, pcnet_confcheck, &has_shmem);
577 if (last_ret) { 561 if (ret)
578 cs_error(link, RequestIO, last_ret);
579 goto failed; 562 goto failed;
580 }
581 563
582 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 564 ret = pcmcia_request_irq(link, &link->irq);
565 if (ret)
566 goto failed;
583 567
584 if (link->io.NumPorts2 == 8) { 568 if (link->io.NumPorts2 == 8) {
585 link->conf.Attributes |= CONF_ENABLE_SPKR; 569 link->conf.Attributes |= CONF_ENABLE_SPKR;
@@ -589,7 +573,9 @@ static int pcnet_config(struct pcmcia_device *link)
589 (link->card_id == PRODID_IBM_HOME_AND_AWAY)) 573 (link->card_id == PRODID_IBM_HOME_AND_AWAY))
590 link->conf.ConfigIndex |= 0x10; 574 link->conf.ConfigIndex |= 0x10;
591 575
592 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 576 ret = pcmcia_request_configuration(link, &link->conf);
577 if (ret)
578 goto failed;
593 dev->irq = link->irq.AssignedIRQ; 579 dev->irq = link->irq.AssignedIRQ;
594 dev->base_addr = link->io.BasePort1; 580 dev->base_addr = link->io.BasePort1;
595 if (info->flags & HAS_MISC_REG) { 581 if (info->flags & HAS_MISC_REG) {
@@ -687,8 +673,6 @@ static int pcnet_config(struct pcmcia_device *link)
687 printk(" hw_addr %pM\n", dev->dev_addr); 673 printk(" hw_addr %pM\n", dev->dev_addr);
688 return 0; 674 return 0;
689 675
690cs_failed:
691 cs_error(link, last_fn, last_ret);
692failed: 676failed:
693 pcnet_release(link); 677 pcnet_release(link);
694 return -ENODEV; 678 return -ENODEV;
@@ -706,7 +690,7 @@ static void pcnet_release(struct pcmcia_device *link)
706{ 690{
707 pcnet_dev_t *info = PRIV(link->priv); 691 pcnet_dev_t *info = PRIV(link->priv);
708 692
709 DEBUG(0, "pcnet_release(0x%p)\n", link); 693 dev_dbg(&link->dev, "pcnet_release\n");
710 694
711 if (info->flags & USE_SHMEM) 695 if (info->flags & USE_SHMEM)
712 iounmap(info->base); 696 iounmap(info->base);
@@ -960,7 +944,7 @@ static void mii_phy_probe(struct net_device *dev)
960 phyid = tmp << 16; 944 phyid = tmp << 16;
961 phyid |= mdio_read(mii_addr, i, MII_PHYID_REG2); 945 phyid |= mdio_read(mii_addr, i, MII_PHYID_REG2);
962 phyid &= MII_PHYID_REV_MASK; 946 phyid &= MII_PHYID_REV_MASK;
963 DEBUG(0, "%s: MII at %d is 0x%08x\n", dev->name, i, phyid); 947 pr_debug("%s: MII at %d is 0x%08x\n", dev->name, i, phyid);
964 if (phyid == AM79C9XX_HOME_PHY) { 948 if (phyid == AM79C9XX_HOME_PHY) {
965 info->pna_phy = i; 949 info->pna_phy = i;
966 } else if (phyid != AM79C9XX_ETH_PHY) { 950 } else if (phyid != AM79C9XX_ETH_PHY) {
@@ -976,7 +960,7 @@ static int pcnet_open(struct net_device *dev)
976 struct pcmcia_device *link = info->p_dev; 960 struct pcmcia_device *link = info->p_dev;
977 unsigned int nic_base = dev->base_addr; 961 unsigned int nic_base = dev->base_addr;
978 962
979 DEBUG(2, "pcnet_open('%s')\n", dev->name); 963 dev_dbg(&link->dev, "pcnet_open('%s')\n", dev->name);
980 964
981 if (!pcmcia_dev_present(link)) 965 if (!pcmcia_dev_present(link))
982 return -ENODEV; 966 return -ENODEV;
@@ -1008,7 +992,7 @@ static int pcnet_close(struct net_device *dev)
1008 pcnet_dev_t *info = PRIV(dev); 992 pcnet_dev_t *info = PRIV(dev);
1009 struct pcmcia_device *link = info->p_dev; 993 struct pcmcia_device *link = info->p_dev;
1010 994
1011 DEBUG(2, "pcnet_close('%s')\n", dev->name); 995 dev_dbg(&link->dev, "pcnet_close('%s')\n", dev->name);
1012 996
1013 ei_close(dev); 997 ei_close(dev);
1014 free_irq(dev->irq, dev); 998 free_irq(dev->irq, dev);
@@ -1251,10 +1235,8 @@ static void dma_block_input(struct net_device *dev, int count,
1251 int xfer_count = count; 1235 int xfer_count = count;
1252 char *buf = skb->data; 1236 char *buf = skb->data;
1253 1237
1254#ifdef PCMCIA_DEBUG
1255 if ((ei_debug > 4) && (count != 4)) 1238 if ((ei_debug > 4) && (count != 4))
1256 printk(KERN_DEBUG "%s: [bi=%d]\n", dev->name, count+4); 1239 pr_debug("%s: [bi=%d]\n", dev->name, count+4);
1257#endif
1258 if (ei_status.dmaing) { 1240 if (ei_status.dmaing) {
1259 printk(KERN_NOTICE "%s: DMAing conflict in dma_block_input." 1241 printk(KERN_NOTICE "%s: DMAing conflict in dma_block_input."
1260 "[DMAstat:%1x][irqlock:%1x]\n", 1242 "[DMAstat:%1x][irqlock:%1x]\n",
@@ -1495,7 +1477,7 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
1495 pcnet_dev_t *info = PRIV(dev); 1477 pcnet_dev_t *info = PRIV(dev);
1496 win_req_t req; 1478 win_req_t req;
1497 memreq_t mem; 1479 memreq_t mem;
1498 int i, window_size, offset, last_ret, last_fn; 1480 int i, window_size, offset, ret;
1499 1481
1500 window_size = (stop_pg - start_pg) << 8; 1482 window_size = (stop_pg - start_pg) << 8;
1501 if (window_size > 32 * 1024) 1483 if (window_size > 32 * 1024)
@@ -1509,13 +1491,17 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
1509 req.Attributes |= WIN_USE_WAIT; 1491 req.Attributes |= WIN_USE_WAIT;
1510 req.Base = 0; req.Size = window_size; 1492 req.Base = 0; req.Size = window_size;
1511 req.AccessSpeed = mem_speed; 1493 req.AccessSpeed = mem_speed;
1512 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win)); 1494 ret = pcmcia_request_window(&link, &req, &link->win);
1495 if (ret)
1496 goto failed;
1513 1497
1514 mem.CardOffset = (start_pg << 8) + cm_offset; 1498 mem.CardOffset = (start_pg << 8) + cm_offset;
1515 offset = mem.CardOffset % window_size; 1499 offset = mem.CardOffset % window_size;
1516 mem.CardOffset -= offset; 1500 mem.CardOffset -= offset;
1517 mem.Page = 0; 1501 mem.Page = 0;
1518 CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); 1502 ret = pcmcia_map_mem_page(link->win, &mem);
1503 if (ret)
1504 goto failed;
1519 1505
1520 /* Try scribbling on the buffer */ 1506 /* Try scribbling on the buffer */
1521 info->base = ioremap(req.Base, window_size); 1507 info->base = ioremap(req.Base, window_size);
@@ -1549,8 +1535,6 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
1549 info->flags |= USE_SHMEM; 1535 info->flags |= USE_SHMEM;
1550 return 0; 1536 return 0;
1551 1537
1552cs_failed:
1553 cs_error(link, last_fn, last_ret);
1554failed: 1538failed:
1555 return 1; 1539 return 1;
1556} 1540}
@@ -1788,7 +1772,6 @@ static int __init init_pcnet_cs(void)
1788 1772
1789static void __exit exit_pcnet_cs(void) 1773static void __exit exit_pcnet_cs(void)
1790{ 1774{
1791 DEBUG(0, "pcnet_cs: unloading\n");
1792 pcmcia_unregister_driver(&pcnet_driver); 1775 pcmcia_unregister_driver(&pcnet_driver);
1793} 1776}
1794 1777
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index df92bcde9bcf..580ec444a654 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -79,14 +79,6 @@ MODULE_FIRMWARE(FIRMWARE_NAME);
79*/ 79*/
80INT_MODULE_PARM(if_port, 0); 80INT_MODULE_PARM(if_port, 0);
81 81
82#ifdef PCMCIA_DEBUG
83INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
84static const char *version =
85"smc91c92_cs.c 1.123 2006/11/09 Donald Becker, becker@scyld.com.\n";
86#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
87#else
88#define DEBUG(n, args...)
89#endif
90 82
91#define DRV_NAME "smc91c92_cs" 83#define DRV_NAME "smc91c92_cs"
92#define DRV_VERSION "1.123" 84#define DRV_VERSION "1.123"
@@ -323,7 +315,7 @@ static int smc91c92_probe(struct pcmcia_device *link)
323 struct smc_private *smc; 315 struct smc_private *smc;
324 struct net_device *dev; 316 struct net_device *dev;
325 317
326 DEBUG(0, "smc91c92_attach()\n"); 318 dev_dbg(&link->dev, "smc91c92_attach()\n");
327 319
328 /* Create new ethernet device */ 320 /* Create new ethernet device */
329 dev = alloc_etherdev(sizeof(struct smc_private)); 321 dev = alloc_etherdev(sizeof(struct smc_private));
@@ -371,7 +363,7 @@ static void smc91c92_detach(struct pcmcia_device *link)
371{ 363{
372 struct net_device *dev = link->priv; 364 struct net_device *dev = link->priv;
373 365
374 DEBUG(0, "smc91c92_detach(0x%p)\n", link); 366 dev_dbg(&link->dev, "smc91c92_detach\n");
375 367
376 if (link->dev_node) 368 if (link->dev_node)
377 unregister_netdev(dev); 369 unregister_netdev(dev);
@@ -746,7 +738,7 @@ static int osi_setup(struct pcmcia_device *link, u_short manfid, u_short cardid)
746 set_bits(0x300, link->io.BasePort1 + OSITECH_AUI_PWR); 738 set_bits(0x300, link->io.BasePort1 + OSITECH_AUI_PWR);
747 /* Now, turn on the interrupt for both card functions */ 739 /* Now, turn on the interrupt for both card functions */
748 set_bits(0x300, link->io.BasePort1 + OSITECH_RESET_ISR); 740 set_bits(0x300, link->io.BasePort1 + OSITECH_RESET_ISR);
749 DEBUG(2, "AUI/PWR: %4.4x RESET/ISR: %4.4x\n", 741 dev_dbg(&link->dev, "AUI/PWR: %4.4x RESET/ISR: %4.4x\n",
750 inw(link->io.BasePort1 + OSITECH_AUI_PWR), 742 inw(link->io.BasePort1 + OSITECH_AUI_PWR),
751 inw(link->io.BasePort1 + OSITECH_RESET_ISR)); 743 inw(link->io.BasePort1 + OSITECH_RESET_ISR));
752 } 744 }
@@ -860,12 +852,6 @@ static int check_sig(struct pcmcia_device *link)
860 852
861======================================================================*/ 853======================================================================*/
862 854
863#define CS_EXIT_TEST(ret, svc, label) \
864if (ret != 0) { \
865 cs_error(link, svc, ret); \
866 goto label; \
867}
868
869static int smc91c92_config(struct pcmcia_device *link) 855static int smc91c92_config(struct pcmcia_device *link)
870{ 856{
871 struct net_device *dev = link->priv; 857 struct net_device *dev = link->priv;
@@ -875,7 +861,7 @@ static int smc91c92_config(struct pcmcia_device *link)
875 unsigned int ioaddr; 861 unsigned int ioaddr;
876 u_long mir; 862 u_long mir;
877 863
878 DEBUG(0, "smc91c92_config(0x%p)\n", link); 864 dev_dbg(&link->dev, "smc91c92_config\n");
879 865
880 smc->manfid = link->manf_id; 866 smc->manfid = link->manf_id;
881 smc->cardid = link->card_id; 867 smc->cardid = link->card_id;
@@ -891,12 +877,15 @@ static int smc91c92_config(struct pcmcia_device *link)
891 } else { 877 } else {
892 i = smc_config(link); 878 i = smc_config(link);
893 } 879 }
894 CS_EXIT_TEST(i, RequestIO, config_failed); 880 if (i)
881 goto config_failed;
895 882
896 i = pcmcia_request_irq(link, &link->irq); 883 i = pcmcia_request_irq(link, &link->irq);
897 CS_EXIT_TEST(i, RequestIRQ, config_failed); 884 if (i)
885 goto config_failed;
898 i = pcmcia_request_configuration(link, &link->conf); 886 i = pcmcia_request_configuration(link, &link->conf);
899 CS_EXIT_TEST(i, RequestConfiguration, config_failed); 887 if (i)
888 goto config_failed;
900 889
901 if (smc->manfid == MANFID_MOTOROLA) 890 if (smc->manfid == MANFID_MOTOROLA)
902 mot_config(link); 891 mot_config(link);
@@ -1001,7 +990,7 @@ static int smc91c92_config(struct pcmcia_device *link)
1001 990
1002 if (smc->cfg & CFG_MII_SELECT) { 991 if (smc->cfg & CFG_MII_SELECT) {
1003 if (smc->mii_if.phy_id != -1) { 992 if (smc->mii_if.phy_id != -1) {
1004 DEBUG(0, " MII transceiver at index %d, status %x.\n", 993 dev_dbg(&link->dev, " MII transceiver at index %d, status %x.\n",
1005 smc->mii_if.phy_id, j); 994 smc->mii_if.phy_id, j);
1006 } else { 995 } else {
1007 printk(KERN_NOTICE " No MII transceivers found!\n"); 996 printk(KERN_NOTICE " No MII transceivers found!\n");
@@ -1011,7 +1000,7 @@ static int smc91c92_config(struct pcmcia_device *link)
1011 1000
1012config_undo: 1001config_undo:
1013 unregister_netdev(dev); 1002 unregister_netdev(dev);
1014config_failed: /* CS_EXIT_TEST() calls jump to here... */ 1003config_failed:
1015 smc91c92_release(link); 1004 smc91c92_release(link);
1016 return -ENODEV; 1005 return -ENODEV;
1017} /* smc91c92_config */ 1006} /* smc91c92_config */
@@ -1026,7 +1015,7 @@ config_failed: /* CS_EXIT_TEST() calls jump to here... */
1026 1015
1027static void smc91c92_release(struct pcmcia_device *link) 1016static void smc91c92_release(struct pcmcia_device *link)
1028{ 1017{
1029 DEBUG(0, "smc91c92_release(0x%p)\n", link); 1018 dev_dbg(&link->dev, "smc91c92_release\n");
1030 if (link->win) { 1019 if (link->win) {
1031 struct net_device *dev = link->priv; 1020 struct net_device *dev = link->priv;
1032 struct smc_private *smc = netdev_priv(dev); 1021 struct smc_private *smc = netdev_priv(dev);
@@ -1123,10 +1112,10 @@ static int smc_open(struct net_device *dev)
1123 struct smc_private *smc = netdev_priv(dev); 1112 struct smc_private *smc = netdev_priv(dev);
1124 struct pcmcia_device *link = smc->p_dev; 1113 struct pcmcia_device *link = smc->p_dev;
1125 1114
1126#ifdef PCMCIA_DEBUG 1115 dev_dbg(&link->dev, "%s: smc_open(%p), ID/Window %4.4x.\n",
1127 DEBUG(0, "%s: smc_open(%p), ID/Window %4.4x.\n",
1128 dev->name, dev, inw(dev->base_addr + BANK_SELECT)); 1116 dev->name, dev, inw(dev->base_addr + BANK_SELECT));
1129 if (pc_debug > 1) smc_dump(dev); 1117#ifdef PCMCIA_DEBUG
1118 smc_dump(dev);
1130#endif 1119#endif
1131 1120
1132 /* Check that the PCMCIA card is still here. */ 1121 /* Check that the PCMCIA card is still here. */
@@ -1161,7 +1150,7 @@ static int smc_close(struct net_device *dev)
1161 struct pcmcia_device *link = smc->p_dev; 1150 struct pcmcia_device *link = smc->p_dev;
1162 unsigned int ioaddr = dev->base_addr; 1151 unsigned int ioaddr = dev->base_addr;
1163 1152
1164 DEBUG(0, "%s: smc_close(), status %4.4x.\n", 1153 dev_dbg(&link->dev, "%s: smc_close(), status %4.4x.\n",
1165 dev->name, inw(ioaddr + BANK_SELECT)); 1154 dev->name, inw(ioaddr + BANK_SELECT));
1166 1155
1167 netif_stop_queue(dev); 1156 netif_stop_queue(dev);
@@ -1228,7 +1217,7 @@ static void smc_hardware_send_packet(struct net_device * dev)
1228 u_char *buf = skb->data; 1217 u_char *buf = skb->data;
1229 u_int length = skb->len; /* The chip will pad to ethernet min. */ 1218 u_int length = skb->len; /* The chip will pad to ethernet min. */
1230 1219
1231 DEBUG(2, "%s: Trying to xmit packet of length %d.\n", 1220 pr_debug("%s: Trying to xmit packet of length %d.\n",
1232 dev->name, length); 1221 dev->name, length);
1233 1222
1234 /* send the packet length: +6 for status word, length, and ctl */ 1223 /* send the packet length: +6 for status word, length, and ctl */
@@ -1283,7 +1272,7 @@ static netdev_tx_t smc_start_xmit(struct sk_buff *skb,
1283 1272
1284 netif_stop_queue(dev); 1273 netif_stop_queue(dev);
1285 1274
1286 DEBUG(2, "%s: smc_start_xmit(length = %d) called," 1275 pr_debug("%s: smc_start_xmit(length = %d) called,"
1287 " status %4.4x.\n", dev->name, skb->len, inw(ioaddr + 2)); 1276 " status %4.4x.\n", dev->name, skb->len, inw(ioaddr + 2));
1288 1277
1289 if (smc->saved_skb) { 1278 if (smc->saved_skb) {
@@ -1330,7 +1319,7 @@ static netdev_tx_t smc_start_xmit(struct sk_buff *skb,
1330 } 1319 }
1331 1320
1332 /* Otherwise defer until the Tx-space-allocated interrupt. */ 1321 /* Otherwise defer until the Tx-space-allocated interrupt. */
1333 DEBUG(2, "%s: memory allocation deferred.\n", dev->name); 1322 pr_debug("%s: memory allocation deferred.\n", dev->name);
1334 outw((IM_ALLOC_INT << 8) | (ir & 0xff00), ioaddr + INTERRUPT); 1323 outw((IM_ALLOC_INT << 8) | (ir & 0xff00), ioaddr + INTERRUPT);
1335 spin_unlock_irqrestore(&smc->lock, flags); 1324 spin_unlock_irqrestore(&smc->lock, flags);
1336 1325
@@ -1395,7 +1384,7 @@ static void smc_eph_irq(struct net_device *dev)
1395 1384
1396 SMC_SELECT_BANK(0); 1385 SMC_SELECT_BANK(0);
1397 ephs = inw(ioaddr + EPH); 1386 ephs = inw(ioaddr + EPH);
1398 DEBUG(2, "%s: Ethernet protocol handler interrupt, status" 1387 pr_debug("%s: Ethernet protocol handler interrupt, status"
1399 " %4.4x.\n", dev->name, ephs); 1388 " %4.4x.\n", dev->name, ephs);
1400 /* Could be a counter roll-over warning: update stats. */ 1389 /* Could be a counter roll-over warning: update stats. */
1401 card_stats = inw(ioaddr + COUNTER); 1390 card_stats = inw(ioaddr + COUNTER);
@@ -1435,7 +1424,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id)
1435 1424
1436 ioaddr = dev->base_addr; 1425 ioaddr = dev->base_addr;
1437 1426
1438 DEBUG(3, "%s: SMC91c92 interrupt %d at %#x.\n", dev->name, 1427 pr_debug("%s: SMC91c92 interrupt %d at %#x.\n", dev->name,
1439 irq, ioaddr); 1428 irq, ioaddr);
1440 1429
1441 spin_lock(&smc->lock); 1430 spin_lock(&smc->lock);
@@ -1444,7 +1433,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id)
1444 if ((saved_bank & 0xff00) != 0x3300) { 1433 if ((saved_bank & 0xff00) != 0x3300) {
1445 /* The device does not exist -- the card could be off-line, or 1434 /* The device does not exist -- the card could be off-line, or
1446 maybe it has been ejected. */ 1435 maybe it has been ejected. */
1447 DEBUG(1, "%s: SMC91c92 interrupt %d for non-existent" 1436 pr_debug("%s: SMC91c92 interrupt %d for non-existent"
1448 "/ejected device.\n", dev->name, irq); 1437 "/ejected device.\n", dev->name, irq);
1449 handled = 0; 1438 handled = 0;
1450 goto irq_done; 1439 goto irq_done;
@@ -1458,7 +1447,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id)
1458 1447
1459 do { /* read the status flag, and mask it */ 1448 do { /* read the status flag, and mask it */
1460 status = inw(ioaddr + INTERRUPT) & 0xff; 1449 status = inw(ioaddr + INTERRUPT) & 0xff;
1461 DEBUG(3, "%s: Status is %#2.2x (mask %#2.2x).\n", dev->name, 1450 pr_debug("%s: Status is %#2.2x (mask %#2.2x).\n", dev->name,
1462 status, mask); 1451 status, mask);
1463 if ((status & mask) == 0) { 1452 if ((status & mask) == 0) {
1464 if (bogus_cnt == INTR_WORK) 1453 if (bogus_cnt == INTR_WORK)
@@ -1503,7 +1492,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id)
1503 smc_eph_irq(dev); 1492 smc_eph_irq(dev);
1504 } while (--bogus_cnt); 1493 } while (--bogus_cnt);
1505 1494
1506 DEBUG(3, " Restoring saved registers mask %2.2x bank %4.4x" 1495 pr_debug(" Restoring saved registers mask %2.2x bank %4.4x"
1507 " pointer %4.4x.\n", mask, saved_bank, saved_pointer); 1496 " pointer %4.4x.\n", mask, saved_bank, saved_pointer);
1508 1497
1509 /* restore state register */ 1498 /* restore state register */
@@ -1511,7 +1500,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id)
1511 outw(saved_pointer, ioaddr + POINTER); 1500 outw(saved_pointer, ioaddr + POINTER);
1512 SMC_SELECT_BANK(saved_bank); 1501 SMC_SELECT_BANK(saved_bank);
1513 1502
1514 DEBUG(3, "%s: Exiting interrupt IRQ%d.\n", dev->name, irq); 1503 pr_debug("%s: Exiting interrupt IRQ%d.\n", dev->name, irq);
1515 1504
1516irq_done: 1505irq_done:
1517 1506
@@ -1562,7 +1551,7 @@ static void smc_rx(struct net_device *dev)
1562 rx_status = inw(ioaddr + DATA_1); 1551 rx_status = inw(ioaddr + DATA_1);
1563 packet_length = inw(ioaddr + DATA_1) & 0x07ff; 1552 packet_length = inw(ioaddr + DATA_1) & 0x07ff;
1564 1553
1565 DEBUG(2, "%s: Receive status %4.4x length %d.\n", 1554 pr_debug("%s: Receive status %4.4x length %d.\n",
1566 dev->name, rx_status, packet_length); 1555 dev->name, rx_status, packet_length);
1567 1556
1568 if (!(rx_status & RS_ERRORS)) { 1557 if (!(rx_status & RS_ERRORS)) {
@@ -1573,7 +1562,7 @@ static void smc_rx(struct net_device *dev)
1573 skb = dev_alloc_skb(packet_length+2); 1562 skb = dev_alloc_skb(packet_length+2);
1574 1563
1575 if (skb == NULL) { 1564 if (skb == NULL) {
1576 DEBUG(1, "%s: Low memory, packet dropped.\n", dev->name); 1565 pr_debug("%s: Low memory, packet dropped.\n", dev->name);
1577 dev->stats.rx_dropped++; 1566 dev->stats.rx_dropped++;
1578 outw(MC_RELEASE, ioaddr + MMU_CMD); 1567 outw(MC_RELEASE, ioaddr + MMU_CMD);
1579 return; 1568 return;
@@ -1733,7 +1722,7 @@ static void smc_reset(struct net_device *dev)
1733 struct smc_private *smc = netdev_priv(dev); 1722 struct smc_private *smc = netdev_priv(dev);
1734 int i; 1723 int i;
1735 1724
1736 DEBUG(0, "%s: smc91c92 reset called.\n", dev->name); 1725 pr_debug("%s: smc91c92 reset called.\n", dev->name);
1737 1726
1738 /* The first interaction must be a write to bring the chip out 1727 /* The first interaction must be a write to bring the chip out
1739 of sleep mode. */ 1728 of sleep mode. */
@@ -2050,18 +2039,6 @@ static u32 smc_get_link(struct net_device *dev)
2050 return ret; 2039 return ret;
2051} 2040}
2052 2041
2053#ifdef PCMCIA_DEBUG
2054static u32 smc_get_msglevel(struct net_device *dev)
2055{
2056 return pc_debug;
2057}
2058
2059static void smc_set_msglevel(struct net_device *dev, u32 val)
2060{
2061 pc_debug = val;
2062}
2063#endif
2064
2065static int smc_nway_reset(struct net_device *dev) 2042static int smc_nway_reset(struct net_device *dev)
2066{ 2043{
2067 struct smc_private *smc = netdev_priv(dev); 2044 struct smc_private *smc = netdev_priv(dev);
@@ -2085,10 +2062,6 @@ static const struct ethtool_ops ethtool_ops = {
2085 .get_settings = smc_get_settings, 2062 .get_settings = smc_get_settings,
2086 .set_settings = smc_set_settings, 2063 .set_settings = smc_set_settings,
2087 .get_link = smc_get_link, 2064 .get_link = smc_get_link,
2088#ifdef PCMCIA_DEBUG
2089 .get_msglevel = smc_get_msglevel,
2090 .set_msglevel = smc_set_msglevel,
2091#endif
2092 .nway_reset = smc_nway_reset, 2065 .nway_reset = smc_nway_reset,
2093}; 2066};
2094 2067
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index 925e85096629..fbf926539285 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -211,20 +211,6 @@ enum xirc_cmd { /* Commands */
211 211
212static const char *if_names[] = { "Auto", "10BaseT", "10Base2", "AUI", "100BaseT" }; 212static const char *if_names[] = { "Auto", "10BaseT", "10Base2", "AUI", "100BaseT" };
213 213
214/****************
215 * All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If
216 * you do not define PCMCIA_DEBUG at all, all the debug code will be
217 * left out. If you compile with PCMCIA_DEBUG=0, the debug code will
218 * be present but disabled -- but it can then be enabled for specific
219 * modules at load time with a 'pc_debug=#' option to insmod.
220 */
221#ifdef PCMCIA_DEBUG
222static int pc_debug = PCMCIA_DEBUG;
223module_param(pc_debug, int, 0);
224#define DEBUG(n, args...) if (pc_debug>(n)) printk(KDBG_XIRC args)
225#else
226#define DEBUG(n, args...)
227#endif
228 214
229#define KDBG_XIRC KERN_DEBUG "xirc2ps_cs: " 215#define KDBG_XIRC KERN_DEBUG "xirc2ps_cs: "
230#define KERR_XIRC KERN_ERR "xirc2ps_cs: " 216#define KERR_XIRC KERN_ERR "xirc2ps_cs: "
@@ -378,7 +364,7 @@ static int do_stop(struct net_device *dev);
378#define PutWord(reg,value) outw((value), ioaddr+(reg)) 364#define PutWord(reg,value) outw((value), ioaddr+(reg))
379 365
380/*====== Functions used for debugging =================================*/ 366/*====== Functions used for debugging =================================*/
381#if defined(PCMCIA_DEBUG) && 0 /* reading regs may change system status */ 367#if 0 /* reading regs may change system status */
382static void 368static void
383PrintRegisters(struct net_device *dev) 369PrintRegisters(struct net_device *dev)
384{ 370{
@@ -410,7 +396,7 @@ PrintRegisters(struct net_device *dev)
410 } 396 }
411 } 397 }
412} 398}
413#endif /* PCMCIA_DEBUG */ 399#endif /* 0 */
414 400
415/*============== MII Management functions ===============*/ 401/*============== MII Management functions ===============*/
416 402
@@ -554,7 +540,7 @@ xirc2ps_probe(struct pcmcia_device *link)
554 struct net_device *dev; 540 struct net_device *dev;
555 local_info_t *local; 541 local_info_t *local;
556 542
557 DEBUG(0, "attach()\n"); 543 dev_dbg(&link->dev, "attach()\n");
558 544
559 /* Allocate the device structure */ 545 /* Allocate the device structure */
560 dev = alloc_etherdev(sizeof(local_info_t)); 546 dev = alloc_etherdev(sizeof(local_info_t));
@@ -593,7 +579,7 @@ xirc2ps_detach(struct pcmcia_device *link)
593{ 579{
594 struct net_device *dev = link->priv; 580 struct net_device *dev = link->priv;
595 581
596 DEBUG(0, "detach(0x%p)\n", link); 582 dev_dbg(&link->dev, "detach\n");
597 583
598 if (link->dev_node) 584 if (link->dev_node)
599 unregister_netdev(dev); 585 unregister_netdev(dev);
@@ -640,7 +626,7 @@ set_card_type(struct pcmcia_device *link)
640 mediaid = buf[3]; 626 mediaid = buf[3];
641 prodid = buf[4]; 627 prodid = buf[4];
642 628
643 DEBUG(0, "cisrev=%02x mediaid=%02x prodid=%02x\n", 629 dev_dbg(&link->dev, "cisrev=%02x mediaid=%02x prodid=%02x\n",
644 cisrev, mediaid, prodid); 630 cisrev, mediaid, prodid);
645 631
646 local->mohawk = 0; 632 local->mohawk = 0;
@@ -784,7 +770,7 @@ xirc2ps_config(struct pcmcia_device * link)
784 770
785 local->dingo_ccr = NULL; 771 local->dingo_ccr = NULL;
786 772
787 DEBUG(0, "config(0x%p)\n", link); 773 dev_dbg(&link->dev, "config\n");
788 774
789 /* Is this a valid card */ 775 /* Is this a valid card */
790 if (link->has_manf_id == 0) { 776 if (link->has_manf_id == 0) {
@@ -814,7 +800,7 @@ xirc2ps_config(struct pcmcia_device * link)
814 (unsigned)link->manf_id); 800 (unsigned)link->manf_id);
815 goto failure; 801 goto failure;
816 } 802 }
817 DEBUG(0, "found %s card\n", local->manf_str); 803 dev_dbg(&link->dev, "found %s card\n", local->manf_str);
818 804
819 if (!set_card_type(link)) { 805 if (!set_card_type(link)) {
820 printk(KNOT_XIRC "this card is not supported\n"); 806 printk(KNOT_XIRC "this card is not supported\n");
@@ -891,10 +877,8 @@ xirc2ps_config(struct pcmcia_device * link)
891 goto port_found; 877 goto port_found;
892 } 878 }
893 link->io.BasePort1 = 0; /* let CS decide */ 879 link->io.BasePort1 = 0; /* let CS decide */
894 if ((err=pcmcia_request_io(link, &link->io))) { 880 if ((err=pcmcia_request_io(link, &link->io)))
895 cs_error(link, RequestIO, err);
896 goto config_error; 881 goto config_error;
897 }
898 } 882 }
899 port_found: 883 port_found:
900 if (err) 884 if (err)
@@ -904,19 +888,15 @@ xirc2ps_config(struct pcmcia_device * link)
904 * Now allocate an interrupt line. Note that this does not 888 * Now allocate an interrupt line. Note that this does not
905 * actually assign a handler to the interrupt. 889 * actually assign a handler to the interrupt.
906 */ 890 */
907 if ((err=pcmcia_request_irq(link, &link->irq))) { 891 if ((err=pcmcia_request_irq(link, &link->irq)))
908 cs_error(link, RequestIRQ, err);
909 goto config_error; 892 goto config_error;
910 }
911 893
912 /**************** 894 /****************
913 * This actually configures the PCMCIA socket -- setting up 895 * This actually configures the PCMCIA socket -- setting up
914 * the I/O windows and the interrupt mapping. 896 * the I/O windows and the interrupt mapping.
915 */ 897 */
916 if ((err=pcmcia_request_configuration(link, &link->conf))) { 898 if ((err=pcmcia_request_configuration(link, &link->conf)))
917 cs_error(link, RequestConfiguration, err);
918 goto config_error; 899 goto config_error;
919 }
920 900
921 if (local->dingo) { 901 if (local->dingo) {
922 conf_reg_t reg; 902 conf_reg_t reg;
@@ -931,17 +911,13 @@ xirc2ps_config(struct pcmcia_device * link)
931 reg.Action = CS_WRITE; 911 reg.Action = CS_WRITE;
932 reg.Offset = CISREG_IOBASE_0; 912 reg.Offset = CISREG_IOBASE_0;
933 reg.Value = link->io.BasePort2 & 0xff; 913 reg.Value = link->io.BasePort2 & 0xff;
934 if ((err = pcmcia_access_configuration_register(link, &reg))) { 914 if ((err = pcmcia_access_configuration_register(link, &reg)))
935 cs_error(link, AccessConfigurationRegister, err);
936 goto config_error; 915 goto config_error;
937 }
938 reg.Action = CS_WRITE; 916 reg.Action = CS_WRITE;
939 reg.Offset = CISREG_IOBASE_1; 917 reg.Offset = CISREG_IOBASE_1;
940 reg.Value = (link->io.BasePort2 >> 8) & 0xff; 918 reg.Value = (link->io.BasePort2 >> 8) & 0xff;
941 if ((err = pcmcia_access_configuration_register(link, &reg))) { 919 if ((err = pcmcia_access_configuration_register(link, &reg)))
942 cs_error(link, AccessConfigurationRegister, err);
943 goto config_error; 920 goto config_error;
944 }
945 921
946 /* There is no config entry for the Ethernet part which 922 /* There is no config entry for the Ethernet part which
947 * is at 0x0800. So we allocate a window into the attribute 923 * is at 0x0800. So we allocate a window into the attribute
@@ -950,17 +926,14 @@ xirc2ps_config(struct pcmcia_device * link)
950 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 926 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
951 req.Base = req.Size = 0; 927 req.Base = req.Size = 0;
952 req.AccessSpeed = 0; 928 req.AccessSpeed = 0;
953 if ((err = pcmcia_request_window(&link, &req, &link->win))) { 929 if ((err = pcmcia_request_window(&link, &req, &link->win)))
954 cs_error(link, RequestWindow, err);
955 goto config_error; 930 goto config_error;
956 } 931
957 local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; 932 local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800;
958 mem.CardOffset = 0x0; 933 mem.CardOffset = 0x0;
959 mem.Page = 0; 934 mem.Page = 0;
960 if ((err = pcmcia_map_mem_page(link->win, &mem))) { 935 if ((err = pcmcia_map_mem_page(link->win, &mem)))
961 cs_error(link, MapMemPage, err);
962 goto config_error; 936 goto config_error;
963 }
964 937
965 /* Setup the CCRs; there are no infos in the CIS about the Ethernet 938 /* Setup the CCRs; there are no infos in the CIS about the Ethernet
966 * part. 939 * part.
@@ -1052,7 +1025,7 @@ xirc2ps_config(struct pcmcia_device * link)
1052static void 1025static void
1053xirc2ps_release(struct pcmcia_device *link) 1026xirc2ps_release(struct pcmcia_device *link)
1054{ 1027{
1055 DEBUG(0, "release(0x%p)\n", link); 1028 dev_dbg(&link->dev, "release\n");
1056 1029
1057 if (link->win) { 1030 if (link->win) {
1058 struct net_device *dev = link->priv; 1031 struct net_device *dev = link->priv;
@@ -1119,7 +1092,7 @@ xirc2ps_interrupt(int irq, void *dev_id)
1119 PutByte(XIRCREG_CR, 0); 1092 PutByte(XIRCREG_CR, 0);
1120 } 1093 }
1121 1094
1122 DEBUG(6, "%s: interrupt %d at %#x.\n", dev->name, irq, ioaddr); 1095 pr_debug("%s: interrupt %d at %#x.\n", dev->name, irq, ioaddr);
1123 1096
1124 saved_page = GetByte(XIRCREG_PR); 1097 saved_page = GetByte(XIRCREG_PR);
1125 /* Read the ISR to see whats the cause for the interrupt. 1098 /* Read the ISR to see whats the cause for the interrupt.
@@ -1129,7 +1102,7 @@ xirc2ps_interrupt(int irq, void *dev_id)
1129 bytes_rcvd = 0; 1102 bytes_rcvd = 0;
1130 loop_entry: 1103 loop_entry:
1131 if (int_status == 0xff) { /* card may be ejected */ 1104 if (int_status == 0xff) { /* card may be ejected */
1132 DEBUG(3, "%s: interrupt %d for dead card\n", dev->name, irq); 1105 pr_debug("%s: interrupt %d for dead card\n", dev->name, irq);
1133 goto leave; 1106 goto leave;
1134 } 1107 }
1135 eth_status = GetByte(XIRCREG_ESR); 1108 eth_status = GetByte(XIRCREG_ESR);
@@ -1142,7 +1115,7 @@ xirc2ps_interrupt(int irq, void *dev_id)
1142 PutByte(XIRCREG40_TXST0, 0); 1115 PutByte(XIRCREG40_TXST0, 0);
1143 PutByte(XIRCREG40_TXST1, 0); 1116 PutByte(XIRCREG40_TXST1, 0);
1144 1117
1145 DEBUG(3, "%s: ISR=%#2.2x ESR=%#2.2x RSR=%#2.2x TSR=%#4.4x\n", 1118 pr_debug("%s: ISR=%#2.2x ESR=%#2.2x RSR=%#2.2x TSR=%#4.4x\n",
1146 dev->name, int_status, eth_status, rx_status, tx_status); 1119 dev->name, int_status, eth_status, rx_status, tx_status);
1147 1120
1148 /***** receive section ******/ 1121 /***** receive section ******/
@@ -1153,14 +1126,14 @@ xirc2ps_interrupt(int irq, void *dev_id)
1153 /* too many bytes received during this int, drop the rest of the 1126 /* too many bytes received during this int, drop the rest of the
1154 * packets */ 1127 * packets */
1155 dev->stats.rx_dropped++; 1128 dev->stats.rx_dropped++;
1156 DEBUG(2, "%s: RX drop, too much done\n", dev->name); 1129 pr_debug("%s: RX drop, too much done\n", dev->name);
1157 } else if (rsr & PktRxOk) { 1130 } else if (rsr & PktRxOk) {
1158 struct sk_buff *skb; 1131 struct sk_buff *skb;
1159 1132
1160 pktlen = GetWord(XIRCREG0_RBC); 1133 pktlen = GetWord(XIRCREG0_RBC);
1161 bytes_rcvd += pktlen; 1134 bytes_rcvd += pktlen;
1162 1135
1163 DEBUG(5, "rsr=%#02x packet_length=%u\n", rsr, pktlen); 1136 pr_debug("rsr=%#02x packet_length=%u\n", rsr, pktlen);
1164 1137
1165 skb = dev_alloc_skb(pktlen+3); /* 1 extra so we can use insw */ 1138 skb = dev_alloc_skb(pktlen+3); /* 1 extra so we can use insw */
1166 if (!skb) { 1139 if (!skb) {
@@ -1228,19 +1201,19 @@ xirc2ps_interrupt(int irq, void *dev_id)
1228 dev->stats.multicast++; 1201 dev->stats.multicast++;
1229 } 1202 }
1230 } else { /* bad packet */ 1203 } else { /* bad packet */
1231 DEBUG(5, "rsr=%#02x\n", rsr); 1204 pr_debug("rsr=%#02x\n", rsr);
1232 } 1205 }
1233 if (rsr & PktTooLong) { 1206 if (rsr & PktTooLong) {
1234 dev->stats.rx_frame_errors++; 1207 dev->stats.rx_frame_errors++;
1235 DEBUG(3, "%s: Packet too long\n", dev->name); 1208 pr_debug("%s: Packet too long\n", dev->name);
1236 } 1209 }
1237 if (rsr & CRCErr) { 1210 if (rsr & CRCErr) {
1238 dev->stats.rx_crc_errors++; 1211 dev->stats.rx_crc_errors++;
1239 DEBUG(3, "%s: CRC error\n", dev->name); 1212 pr_debug("%s: CRC error\n", dev->name);
1240 } 1213 }
1241 if (rsr & AlignErr) { 1214 if (rsr & AlignErr) {
1242 dev->stats.rx_fifo_errors++; /* okay ? */ 1215 dev->stats.rx_fifo_errors++; /* okay ? */
1243 DEBUG(3, "%s: Alignment error\n", dev->name); 1216 pr_debug("%s: Alignment error\n", dev->name);
1244 } 1217 }
1245 1218
1246 /* clear the received/dropped/error packet */ 1219 /* clear the received/dropped/error packet */
@@ -1252,7 +1225,7 @@ xirc2ps_interrupt(int irq, void *dev_id)
1252 if (rx_status & 0x10) { /* Receive overrun */ 1225 if (rx_status & 0x10) { /* Receive overrun */
1253 dev->stats.rx_over_errors++; 1226 dev->stats.rx_over_errors++;
1254 PutByte(XIRCREG_CR, ClearRxOvrun); 1227 PutByte(XIRCREG_CR, ClearRxOvrun);
1255 DEBUG(3, "receive overrun cleared\n"); 1228 pr_debug("receive overrun cleared\n");
1256 } 1229 }
1257 1230
1258 /***** transmit section ******/ 1231 /***** transmit section ******/
@@ -1265,13 +1238,13 @@ xirc2ps_interrupt(int irq, void *dev_id)
1265 if (nn < n) /* rollover */ 1238 if (nn < n) /* rollover */
1266 dev->stats.tx_packets += 256 - n; 1239 dev->stats.tx_packets += 256 - n;
1267 else if (n == nn) { /* happens sometimes - don't know why */ 1240 else if (n == nn) { /* happens sometimes - don't know why */
1268 DEBUG(0, "PTR not changed?\n"); 1241 pr_debug("PTR not changed?\n");
1269 } else 1242 } else
1270 dev->stats.tx_packets += lp->last_ptr_value - n; 1243 dev->stats.tx_packets += lp->last_ptr_value - n;
1271 netif_wake_queue(dev); 1244 netif_wake_queue(dev);
1272 } 1245 }
1273 if (tx_status & 0x0002) { /* Execessive collissions */ 1246 if (tx_status & 0x0002) { /* Execessive collissions */
1274 DEBUG(0, "tx restarted due to execssive collissions\n"); 1247 pr_debug("tx restarted due to execssive collissions\n");
1275 PutByte(XIRCREG_CR, RestartTx); /* restart transmitter process */ 1248 PutByte(XIRCREG_CR, RestartTx); /* restart transmitter process */
1276 } 1249 }
1277 if (tx_status & 0x0040) 1250 if (tx_status & 0x0040)
@@ -1290,14 +1263,14 @@ xirc2ps_interrupt(int irq, void *dev_id)
1290 maxrx_bytes = 2000; 1263 maxrx_bytes = 2000;
1291 else if (maxrx_bytes > 22000) 1264 else if (maxrx_bytes > 22000)
1292 maxrx_bytes = 22000; 1265 maxrx_bytes = 22000;
1293 DEBUG(1, "set maxrx=%u (rcvd=%u ticks=%lu)\n", 1266 pr_debug("set maxrx=%u (rcvd=%u ticks=%lu)\n",
1294 maxrx_bytes, bytes_rcvd, duration); 1267 maxrx_bytes, bytes_rcvd, duration);
1295 } else if (!duration && maxrx_bytes < 22000) { 1268 } else if (!duration && maxrx_bytes < 22000) {
1296 /* now much faster */ 1269 /* now much faster */
1297 maxrx_bytes += 2000; 1270 maxrx_bytes += 2000;
1298 if (maxrx_bytes > 22000) 1271 if (maxrx_bytes > 22000)
1299 maxrx_bytes = 22000; 1272 maxrx_bytes = 22000;
1300 DEBUG(1, "set maxrx=%u\n", maxrx_bytes); 1273 pr_debug("set maxrx=%u\n", maxrx_bytes);
1301 } 1274 }
1302 } 1275 }
1303 1276
@@ -1347,7 +1320,7 @@ do_start_xmit(struct sk_buff *skb, struct net_device *dev)
1347 unsigned freespace; 1320 unsigned freespace;
1348 unsigned pktlen = skb->len; 1321 unsigned pktlen = skb->len;
1349 1322
1350 DEBUG(1, "do_start_xmit(skb=%p, dev=%p) len=%u\n", 1323 pr_debug("do_start_xmit(skb=%p, dev=%p) len=%u\n",
1351 skb, dev, pktlen); 1324 skb, dev, pktlen);
1352 1325
1353 1326
@@ -1373,7 +1346,7 @@ do_start_xmit(struct sk_buff *skb, struct net_device *dev)
1373 freespace &= 0x7fff; 1346 freespace &= 0x7fff;
1374 /* TRS doesn't work - (indeed it is eliminated with sil-rev 1) */ 1347 /* TRS doesn't work - (indeed it is eliminated with sil-rev 1) */
1375 okay = pktlen +2 < freespace; 1348 okay = pktlen +2 < freespace;
1376 DEBUG(2 + (okay ? 2 : 0), "%s: avail. tx space=%u%s\n", 1349 pr_debug("%s: avail. tx space=%u%s\n",
1377 dev->name, freespace, okay ? " (okay)":" (not enough)"); 1350 dev->name, freespace, okay ? " (okay)":" (not enough)");
1378 if (!okay) { /* not enough space */ 1351 if (!okay) { /* not enough space */
1379 return NETDEV_TX_BUSY; /* upper layer may decide to requeue this packet */ 1352 return NETDEV_TX_BUSY; /* upper layer may decide to requeue this packet */
@@ -1475,7 +1448,7 @@ do_config(struct net_device *dev, struct ifmap *map)
1475{ 1448{
1476 local_info_t *local = netdev_priv(dev); 1449 local_info_t *local = netdev_priv(dev);
1477 1450
1478 DEBUG(0, "do_config(%p)\n", dev); 1451 pr_debug("do_config(%p)\n", dev);
1479 if (map->port != 255 && map->port != dev->if_port) { 1452 if (map->port != 255 && map->port != dev->if_port) {
1480 if (map->port > 4) 1453 if (map->port > 4)
1481 return -EINVAL; 1454 return -EINVAL;
@@ -1502,7 +1475,7 @@ do_open(struct net_device *dev)
1502 local_info_t *lp = netdev_priv(dev); 1475 local_info_t *lp = netdev_priv(dev);
1503 struct pcmcia_device *link = lp->p_dev; 1476 struct pcmcia_device *link = lp->p_dev;
1504 1477
1505 DEBUG(0, "do_open(%p)\n", dev); 1478 dev_dbg(&link->dev, "do_open(%p)\n", dev);
1506 1479
1507 /* Check that the PCMCIA card is still here. */ 1480 /* Check that the PCMCIA card is still here. */
1508 /* Physical device present signature. */ 1481 /* Physical device present signature. */
@@ -1536,7 +1509,7 @@ do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1536 unsigned int ioaddr = dev->base_addr; 1509 unsigned int ioaddr = dev->base_addr;
1537 struct mii_ioctl_data *data = if_mii(rq); 1510 struct mii_ioctl_data *data = if_mii(rq);
1538 1511
1539 DEBUG(1, "%s: ioctl(%-.6s, %#04x) %04x %04x %04x %04x\n", 1512 pr_debug("%s: ioctl(%-.6s, %#04x) %04x %04x %04x %04x\n",
1540 dev->name, rq->ifr_ifrn.ifrn_name, cmd, 1513 dev->name, rq->ifr_ifrn.ifrn_name, cmd,
1541 data->phy_id, data->reg_num, data->val_in, data->val_out); 1514 data->phy_id, data->reg_num, data->val_in, data->val_out);
1542 1515
@@ -1585,7 +1558,7 @@ do_reset(struct net_device *dev, int full)
1585 unsigned int ioaddr = dev->base_addr; 1558 unsigned int ioaddr = dev->base_addr;
1586 unsigned value; 1559 unsigned value;
1587 1560
1588 DEBUG(0, "%s: do_reset(%p,%d)\n", dev? dev->name:"eth?", dev, full); 1561 pr_debug("%s: do_reset(%p,%d)\n", dev? dev->name:"eth?", dev, full);
1589 1562
1590 hardreset(dev); 1563 hardreset(dev);
1591 PutByte(XIRCREG_CR, SoftReset); /* set */ 1564 PutByte(XIRCREG_CR, SoftReset); /* set */
@@ -1623,8 +1596,8 @@ do_reset(struct net_device *dev, int full)
1623 } 1596 }
1624 msleep(40); /* wait 40 msec to let it complete */ 1597 msleep(40); /* wait 40 msec to let it complete */
1625 1598
1626 #ifdef PCMCIA_DEBUG 1599 #if 0
1627 if (pc_debug) { 1600 {
1628 SelectPage(0); 1601 SelectPage(0);
1629 value = GetByte(XIRCREG_ESR); /* read the ESR */ 1602 value = GetByte(XIRCREG_ESR); /* read the ESR */
1630 printk(KERN_DEBUG "%s: ESR is: %#02x\n", dev->name, value); 1603 printk(KERN_DEBUG "%s: ESR is: %#02x\n", dev->name, value);
@@ -1641,7 +1614,7 @@ do_reset(struct net_device *dev, int full)
1641 value |= DisableLinkPulse; 1614 value |= DisableLinkPulse;
1642 PutByte(XIRCREG1_ECR, value); 1615 PutByte(XIRCREG1_ECR, value);
1643 #endif 1616 #endif
1644 DEBUG(0, "%s: ECR is: %#02x\n", dev->name, value); 1617 pr_debug("%s: ECR is: %#02x\n", dev->name, value);
1645 1618
1646 SelectPage(0x42); 1619 SelectPage(0x42);
1647 PutByte(XIRCREG42_SWC0, 0x20); /* disable source insertion */ 1620 PutByte(XIRCREG42_SWC0, 0x20); /* disable source insertion */
@@ -1819,7 +1792,7 @@ do_powerdown(struct net_device *dev)
1819 1792
1820 unsigned int ioaddr = dev->base_addr; 1793 unsigned int ioaddr = dev->base_addr;
1821 1794
1822 DEBUG(0, "do_powerdown(%p)\n", dev); 1795 pr_debug("do_powerdown(%p)\n", dev);
1823 1796
1824 SelectPage(4); 1797 SelectPage(4);
1825 PutByte(XIRCREG4_GPR1, 0); /* clear bit 0: power down */ 1798 PutByte(XIRCREG4_GPR1, 0); /* clear bit 0: power down */
@@ -1833,7 +1806,7 @@ do_stop(struct net_device *dev)
1833 local_info_t *lp = netdev_priv(dev); 1806 local_info_t *lp = netdev_priv(dev);
1834 struct pcmcia_device *link = lp->p_dev; 1807 struct pcmcia_device *link = lp->p_dev;
1835 1808
1836 DEBUG(0, "do_stop(%p)\n", dev); 1809 dev_dbg(&link->dev, "do_stop(%p)\n", dev);
1837 1810
1838 if (!link) 1811 if (!link)
1839 return -ENODEV; 1812 return -ENODEV;