diff options
Diffstat (limited to 'drivers/pcmcia/pcmcia_resource.c')
-rw-r--r-- | drivers/pcmcia/pcmcia_resource.c | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index fcd48dae79bc..a48d4a91d440 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
@@ -70,7 +70,8 @@ static int alloc_io_space(struct pcmcia_socket *s, struct resource *res, | |||
70 | 70 | ||
71 | res->flags |= IORESOURCE_IO; | 71 | res->flags |= IORESOURCE_IO; |
72 | 72 | ||
73 | dev_dbg(&s->dev, "alloc_io_space request for %pR\n", res); | 73 | dev_dbg(&s->dev, "alloc_io_space request for %pR, %d lines\n", |
74 | res, lines); | ||
74 | 75 | ||
75 | align = base ? (lines ? 1<<lines : 0) : 1; | 76 | align = base ? (lines ? 1<<lines : 0) : 1; |
76 | if (align && (align < num)) { | 77 | if (align && (align < num)) { |
@@ -541,38 +542,25 @@ EXPORT_SYMBOL(pcmcia_request_configuration); | |||
541 | * pcmcia_request_io() - attempt to reserve port ranges for PCMCIA devices | 542 | * pcmcia_request_io() - attempt to reserve port ranges for PCMCIA devices |
542 | * | 543 | * |
543 | * pcmcia_request_io() attepts to reserve the IO port ranges specified in | 544 | * pcmcia_request_io() attepts to reserve the IO port ranges specified in |
544 | * struct pcmcia_device *p_dev->resource[0] and *p_dev->resource[1]. The | 545 | * &struct pcmcia_device @p_dev->resource[0] and @p_dev->resource[1]. The |
545 | * "start" value is the requested start of the IO port resource; "end" | 546 | * "start" value is the requested start of the IO port resource; "end" |
546 | * relfects the number of ports requested. | 547 | * reflects the number of ports requested. The number of IO lines requested |
547 | * | 548 | * is specified in &struct pcmcia_device @p_dev->io_lines. |
548 | * If io_req_t is passed, those values are converted automatically. | ||
549 | */ | 549 | */ |
550 | int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req) | 550 | int pcmcia_request_io(struct pcmcia_device *p_dev) |
551 | { | 551 | { |
552 | struct pcmcia_socket *s = p_dev->socket; | 552 | struct pcmcia_socket *s = p_dev->socket; |
553 | config_t *c; | 553 | config_t *c = p_dev->function_config; |
554 | int ret = -EINVAL; | 554 | int ret = -EINVAL; |
555 | unsigned int lines = req->IOAddrLines; | ||
556 | 555 | ||
557 | mutex_lock(&s->ops_mutex); | 556 | mutex_lock(&s->ops_mutex); |
557 | dev_dbg(&s->dev, "pcmcia_request_io: %pR , %pR", &c->io[0], &c->io[1]); | ||
558 | 558 | ||
559 | if (!(s->state & SOCKET_PRESENT)) { | 559 | if (!(s->state & SOCKET_PRESENT)) { |
560 | dev_dbg(&s->dev, "pcmcia_request_io: No card present\n"); | 560 | dev_dbg(&s->dev, "pcmcia_request_io: No card present\n"); |
561 | goto out; | 561 | goto out; |
562 | } | 562 | } |
563 | 563 | ||
564 | c = p_dev->function_config; | ||
565 | if (req) { | ||
566 | c->io[0].start = req->BasePort1; | ||
567 | c->io[0].end = req->NumPorts1; | ||
568 | c->io[0].flags |= req->Attributes1; | ||
569 | c->io[1].start = req->BasePort2; | ||
570 | c->io[1].end = req->NumPorts2; | ||
571 | c->io[1].flags |= req->Attributes2; | ||
572 | } | ||
573 | |||
574 | dev_dbg(&s->dev, "pcmcia_request_io: %pR , %pR", &c->io[0], &c->io[1]); | ||
575 | |||
576 | if (c->state & CONFIG_LOCKED) { | 564 | if (c->state & CONFIG_LOCKED) { |
577 | dev_dbg(&s->dev, "Configuration is locked\n"); | 565 | dev_dbg(&s->dev, "Configuration is locked\n"); |
578 | goto out; | 566 | goto out; |
@@ -582,12 +570,12 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req) | |||
582 | goto out; | 570 | goto out; |
583 | } | 571 | } |
584 | 572 | ||
585 | ret = alloc_io_space(s, &c->io[0], lines); | 573 | ret = alloc_io_space(s, &c->io[0], p_dev->io_lines); |
586 | if (ret) | 574 | if (ret) |
587 | goto out; | 575 | goto out; |
588 | 576 | ||
589 | if (c->io[1].end) { | 577 | if (c->io[1].end) { |
590 | ret = alloc_io_space(s, &c->io[1], lines); | 578 | ret = alloc_io_space(s, &c->io[1], p_dev->io_lines); |
591 | if (ret) { | 579 | if (ret) { |
592 | release_io_space(s, &c->io[0]); | 580 | release_io_space(s, &c->io[0]); |
593 | goto out; | 581 | goto out; |
@@ -598,11 +586,6 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req) | |||
598 | c->state |= CONFIG_IO_REQ; | 586 | c->state |= CONFIG_IO_REQ; |
599 | p_dev->_io = 1; | 587 | p_dev->_io = 1; |
600 | 588 | ||
601 | if (!ret) { | ||
602 | req->BasePort1 = c->io[0].start; | ||
603 | req->BasePort2 = c->io[1].start; | ||
604 | } | ||
605 | |||
606 | dev_dbg(&s->dev, "pcmcia_request_io succeeded: %pR , %pR", | 589 | dev_dbg(&s->dev, "pcmcia_request_io succeeded: %pR , %pR", |
607 | &c->io[0], &c->io[1]); | 590 | &c->io[0], &c->io[1]); |
608 | out: | 591 | out: |