aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/serial_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-07-24 11:23:51 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2010-08-03 03:04:11 -0400
commit90abdc3b973229bae98dd96649d9f7106cc177a4 (patch)
tree5c1a7a131b65560dd73b5103118d8c7631bd76a4 /drivers/serial/serial_cs.c
parent9a017a910346afd88ec2e065989903bf211a7d37 (diff)
pcmcia: do not use io_req_t when calling pcmcia_request_io()
Instead of io_req_t, drivers are now requested to fill out struct pcmcia_device *p_dev->resource[0,1] for up to two ioport ranges. After a call to pcmcia_request_io(), the ports found there are reserved, after calling pcmcia_request_configuration(), they may be used. CC: netdev@vger.kernel.org CC: linux-wireless@vger.kernel.org CC: linux-ide@vger.kernel.org CC: linux-usb@vger.kernel.org CC: laforge@gnumonks.org CC: linux-mtd@lists.infradead.org CC: alsa-devel@alsa-project.org CC: linux-serial@vger.kernel.org CC: Michael Buesch <mb@bu3sch.de> Acked-by: Marcel Holtmann <marcel@holtmann.org> (for drivers/bluetooth/) Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/serial/serial_cs.c')
-rw-r--r--drivers/serial/serial_cs.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index fe7adcdfde9e..141c69554bd4 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -335,8 +335,8 @@ static int serial_probe(struct pcmcia_device *link)
335 info->p_dev = link; 335 info->p_dev = link;
336 link->priv = info; 336 link->priv = info;
337 337
338 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 338 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
339 link->io.NumPorts1 = 8; 339 link->resource[0]->end = 8;
340 link->conf.Attributes = CONF_ENABLE_IRQ; 340 link->conf.Attributes = CONF_ENABLE_IRQ;
341 if (do_sound) { 341 if (do_sound) {
342 link->conf.Attributes |= CONF_ENABLE_SPKR; 342 link->conf.Attributes |= CONF_ENABLE_SPKR;
@@ -424,12 +424,13 @@ static int simple_config_check(struct pcmcia_device *p_dev,
424 p_dev->conf.Vpp = 424 p_dev->conf.Vpp =
425 cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; 425 cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
426 426
427 p_dev->io_lines = ((*try & 0x1) == 0) ?
428 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
429
427 if ((cf->io.nwin > 0) && (cf->io.win[0].len == size_table[(*try >> 1)]) 430 if ((cf->io.nwin > 0) && (cf->io.win[0].len == size_table[(*try >> 1)])
428 && (cf->io.win[0].base != 0)) { 431 && (cf->io.win[0].base != 0)) {
429 p_dev->io.BasePort1 = cf->io.win[0].base; 432 p_dev->resource[0]->start = cf->io.win[0].base;
430 p_dev->io.IOAddrLines = ((*try & 0x1) == 0) ? 433 if (!pcmcia_request_io(p_dev))
431 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
432 if (!pcmcia_request_io(p_dev, &p_dev->io))
433 return 0; 434 return 0;
434 } 435 }
435 return -EINVAL; 436 return -EINVAL;
@@ -446,9 +447,9 @@ static int simple_config_check_notpicky(struct pcmcia_device *p_dev,
446 447
447 if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { 448 if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
448 for (j = 0; j < 5; j++) { 449 for (j = 0; j < 5; j++) {
449 p_dev->io.BasePort1 = base[j]; 450 p_dev->resource[0]->start = base[j];
450 p_dev->io.IOAddrLines = base[j] ? 16 : 3; 451 p_dev->io_lines = base[j] ? 16 : 3;
451 if (!pcmcia_request_io(p_dev, &p_dev->io)) 452 if (!pcmcia_request_io(p_dev))
452 return 0; 453 return 0;
453 } 454 }
454 } 455 }
@@ -521,9 +522,9 @@ static int multi_config_check(struct pcmcia_device *p_dev,
521 /* The quad port cards have bad CIS's, so just look for a 522 /* The quad port cards have bad CIS's, so just look for a
522 window larger than 8 ports and assume it will be right */ 523 window larger than 8 ports and assume it will be right */
523 if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { 524 if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) {
524 p_dev->io.BasePort1 = cf->io.win[0].base; 525 p_dev->resource[0]->start = cf->io.win[0].base;
525 p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; 526 p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK;
526 if (!pcmcia_request_io(p_dev, &p_dev->io)) { 527 if (!pcmcia_request_io(p_dev)) {
527 *base2 = p_dev->resource[0]->start + 8; 528 *base2 = p_dev->resource[0]->start + 8;
528 return 0; 529 return 0;
529 } 530 }
@@ -540,10 +541,10 @@ static int multi_config_check_notpicky(struct pcmcia_device *p_dev,
540 int *base2 = priv_data; 541 int *base2 = priv_data;
541 542
542 if (cf->io.nwin == 2) { 543 if (cf->io.nwin == 2) {
543 p_dev->io.BasePort1 = cf->io.win[0].base; 544 p_dev->resource[0]->start = cf->io.win[0].base;
544 p_dev->io.BasePort2 = cf->io.win[1].base; 545 p_dev->resource[1]->start = cf->io.win[1].base;
545 p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; 546 p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK;
546 if (!pcmcia_request_io(p_dev, &p_dev->io)) { 547 if (!pcmcia_request_io(p_dev)) {
547 *base2 = p_dev->resource[1]->start; 548 *base2 = p_dev->resource[1]->start;
548 return 0; 549 return 0;
549 } 550 }
@@ -557,10 +558,10 @@ static int multi_config(struct pcmcia_device *link)
557 int i, base2 = 0; 558 int i, base2 = 0;
558 559
559 /* First, look for a generic full-sized window */ 560 /* First, look for a generic full-sized window */
560 link->io.NumPorts1 = info->multi * 8; 561 link->resource[0]->end = info->multi * 8;
561 if (pcmcia_loop_config(link, multi_config_check, &base2)) { 562 if (pcmcia_loop_config(link, multi_config_check, &base2)) {
562 /* If that didn't work, look for two windows */ 563 /* If that didn't work, look for two windows */
563 link->io.NumPorts1 = link->io.NumPorts2 = 8; 564 link->resource[0]->end = link->resource[1]->end = 8;
564 info->multi = 2; 565 info->multi = 2;
565 if (pcmcia_loop_config(link, multi_config_check_notpicky, 566 if (pcmcia_loop_config(link, multi_config_check_notpicky,
566 &base2)) { 567 &base2)) {