aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2009-10-24 09:54:46 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2009-11-09 02:30:04 -0500
commit9ec0bf41b5030ccc691049754ed1398cad5e953e (patch)
tree069a7aacbde6c31ecbfc5ff12648259ad429d623 /drivers/serial
parent3e7166178a83fef690dcbfcdaeda192f7282a9a4 (diff)
pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (serial_cs)
Convert PCMCIA drivers to use the dynamic debug infrastructure, instead of requiring manual settings of PCMCIA_DEBUG. 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: linux-serial@vger.kernel.org CC: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/serial_cs.c53
1 files changed, 17 insertions, 36 deletions
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index 7bf02cf3123f..3b31bee85761 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -54,14 +54,6 @@
54 54
55#include "8250.h" 55#include "8250.h"
56 56
57#ifdef PCMCIA_DEBUG
58static int pc_debug = PCMCIA_DEBUG;
59module_param(pc_debug, int, 0644);
60#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
61static char *version = "serial_cs.c 1.134 2002/05/04 05:48:53 (David Hinds)";
62#else
63#define DEBUG(n, args...)
64#endif
65 57
66/*====================================================================*/ 58/*====================================================================*/
67 59
@@ -121,24 +113,20 @@ static void quirk_setup_brainboxes_0104(struct pcmcia_device *link, struct uart_
121static int quirk_post_ibm(struct pcmcia_device *link) 113static int quirk_post_ibm(struct pcmcia_device *link)
122{ 114{
123 conf_reg_t reg = { 0, CS_READ, 0x800, 0 }; 115 conf_reg_t reg = { 0, CS_READ, 0x800, 0 };
124 int last_ret, last_fn; 116 int ret;
117
118 ret = pcmcia_access_configuration_register(link, &reg);
119 if (ret)
120 goto failed;
125 121
126 last_ret = pcmcia_access_configuration_register(link, &reg);
127 if (last_ret) {
128 last_fn = AccessConfigurationRegister;
129 goto cs_failed;
130 }
131 reg.Action = CS_WRITE; 122 reg.Action = CS_WRITE;
132 reg.Value = reg.Value | 1; 123 reg.Value = reg.Value | 1;
133 last_ret = pcmcia_access_configuration_register(link, &reg); 124 ret = pcmcia_access_configuration_register(link, &reg);
134 if (last_ret) { 125 if (ret)
135 last_fn = AccessConfigurationRegister; 126 goto failed;
136 goto cs_failed;
137 }
138 return 0; 127 return 0;
139 128
140 cs_failed: 129 failed:
141 cs_error(link, last_fn, last_ret);
142 return -ENODEV; 130 return -ENODEV;
143} 131}
144 132
@@ -283,7 +271,7 @@ static void serial_remove(struct pcmcia_device *link)
283 struct serial_info *info = link->priv; 271 struct serial_info *info = link->priv;
284 int i; 272 int i;
285 273
286 DEBUG(0, "serial_release(0x%p)\n", link); 274 dev_dbg(&link->dev, "serial_release\n");
287 275
288 /* 276 /*
289 * Recheck to see if the device is still configured. 277 * Recheck to see if the device is still configured.
@@ -334,7 +322,7 @@ static int serial_probe(struct pcmcia_device *link)
334{ 322{
335 struct serial_info *info; 323 struct serial_info *info;
336 324
337 DEBUG(0, "serial_attach()\n"); 325 dev_dbg(&link->dev, "serial_attach()\n");
338 326
339 /* Create new serial device */ 327 /* Create new serial device */
340 info = kzalloc(sizeof (*info), GFP_KERNEL); 328 info = kzalloc(sizeof (*info), GFP_KERNEL);
@@ -370,7 +358,7 @@ static void serial_detach(struct pcmcia_device *link)
370{ 358{
371 struct serial_info *info = link->priv; 359 struct serial_info *info = link->priv;
372 360
373 DEBUG(0, "serial_detach(0x%p)\n", link); 361 dev_dbg(&link->dev, "serial_detach\n");
374 362
375 /* 363 /*
376 * Ensure any outstanding scheduled tasks are completed. 364 * Ensure any outstanding scheduled tasks are completed.
@@ -507,15 +495,13 @@ static int simple_config(struct pcmcia_device *link)
507 495
508 printk(KERN_NOTICE 496 printk(KERN_NOTICE
509 "serial_cs: no usable port range found, giving up\n"); 497 "serial_cs: no usable port range found, giving up\n");
510 cs_error(link, RequestIO, i);
511 return -1; 498 return -1;
512 499
513found_port: 500found_port:
514 i = pcmcia_request_irq(link, &link->irq); 501 i = pcmcia_request_irq(link, &link->irq);
515 if (i != 0) { 502 if (i != 0)
516 cs_error(link, RequestIRQ, i);
517 link->irq.AssignedIRQ = 0; 503 link->irq.AssignedIRQ = 0;
518 } 504
519 if (info->multi && (info->manfid == MANFID_3COM)) 505 if (info->multi && (info->manfid == MANFID_3COM))
520 link->conf.ConfigIndex &= ~(0x08); 506 link->conf.ConfigIndex &= ~(0x08);
521 507
@@ -526,10 +512,8 @@ found_port:
526 info->quirk->config(link); 512 info->quirk->config(link);
527 513
528 i = pcmcia_request_configuration(link, &link->conf); 514 i = pcmcia_request_configuration(link, &link->conf);
529 if (i != 0) { 515 if (i != 0)
530 cs_error(link, RequestConfiguration, i);
531 return -1; 516 return -1;
532 }
533 return setup_serial(link, info, link->io.BasePort1, link->irq.AssignedIRQ); 517 return setup_serial(link, info, link->io.BasePort1, link->irq.AssignedIRQ);
534} 518}
535 519
@@ -598,7 +582,6 @@ static int multi_config(struct pcmcia_device *link)
598 /* FIXME: comment does not fit, error handling does not fit */ 582 /* FIXME: comment does not fit, error handling does not fit */
599 printk(KERN_NOTICE 583 printk(KERN_NOTICE
600 "serial_cs: no usable port range found, giving up\n"); 584 "serial_cs: no usable port range found, giving up\n");
601 cs_error(link, RequestIRQ, i);
602 link->irq.AssignedIRQ = 0; 585 link->irq.AssignedIRQ = 0;
603 } 586 }
604 587
@@ -609,10 +592,8 @@ static int multi_config(struct pcmcia_device *link)
609 info->quirk->config(link); 592 info->quirk->config(link);
610 593
611 i = pcmcia_request_configuration(link, &link->conf); 594 i = pcmcia_request_configuration(link, &link->conf);
612 if (i != 0) { 595 if (i != 0)
613 cs_error(link, RequestConfiguration, i);
614 return -ENODEV; 596 return -ENODEV;
615 }
616 597
617 /* The Oxford Semiconductor OXCF950 cards are in fact single-port: 598 /* The Oxford Semiconductor OXCF950 cards are in fact single-port:
618 * 8 registers are for the UART, the others are extra registers. 599 * 8 registers are for the UART, the others are extra registers.
@@ -682,7 +663,7 @@ static int serial_config(struct pcmcia_device * link)
682 struct serial_info *info = link->priv; 663 struct serial_info *info = link->priv;
683 int i; 664 int i;
684 665
685 DEBUG(0, "serial_config(0x%p)\n", link); 666 dev_dbg(&link->dev, "serial_config\n");
686 667
687 /* Is this a compliant multifunction card? */ 668 /* Is this a compliant multifunction card? */
688 info->multi = (link->socket->functions > 1); 669 info->multi = (link->socket->functions > 1);