diff options
Diffstat (limited to 'drivers/char/pcmcia/cm4040_cs.c')
-rw-r--r-- | drivers/char/pcmcia/cm4040_cs.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 6ccca8cbabc1..74609c3b2b5f 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c | |||
@@ -246,7 +246,7 @@ static ssize_t cm4040_read(struct file *filp, char __user *buf, | |||
246 | return -EAGAIN; | 246 | return -EAGAIN; |
247 | } | 247 | } |
248 | 248 | ||
249 | if ((dev->p_dev->state & DEV_PRESENT)==0) | 249 | if (!pcmcia_dev_present(dev->p_dev)) |
250 | return -ENODEV; | 250 | return -ENODEV; |
251 | 251 | ||
252 | for (i = 0; i < 5; i++) { | 252 | for (i = 0; i < 5; i++) { |
@@ -351,7 +351,7 @@ static ssize_t cm4040_write(struct file *filp, const char __user *buf, | |||
351 | return -EAGAIN; | 351 | return -EAGAIN; |
352 | } | 352 | } |
353 | 353 | ||
354 | if ((dev->p_dev->state & DEV_PRESENT) == 0) | 354 | if (!pcmcia_dev_present(dev->p_dev)) |
355 | return -ENODEV; | 355 | return -ENODEV; |
356 | 356 | ||
357 | bytes_to_write = count; | 357 | bytes_to_write = count; |
@@ -543,7 +543,6 @@ static int reader_config(struct pcmcia_device *link, int devno) | |||
543 | goto cs_failed; | 543 | goto cs_failed; |
544 | } | 544 | } |
545 | 545 | ||
546 | link->state |= DEV_CONFIG; | ||
547 | link->conf.ConfigBase = parse.config.base; | 546 | link->conf.ConfigBase = parse.config.base; |
548 | link->conf.Present = parse.config.rmask[0]; | 547 | link->conf.Present = parse.config.rmask[0]; |
549 | 548 | ||
@@ -602,9 +601,7 @@ static int reader_config(struct pcmcia_device *link, int devno) | |||
602 | sprintf(dev->node.dev_name, DEVICE_NAME "%d", devno); | 601 | sprintf(dev->node.dev_name, DEVICE_NAME "%d", devno); |
603 | dev->node.major = major; | 602 | dev->node.major = major; |
604 | dev->node.minor = devno; | 603 | dev->node.minor = devno; |
605 | dev->node.next = NULL; | 604 | dev->node.next = &dev->node; |
606 | link->dev_node = &dev->node; | ||
607 | link->state &= ~DEV_CONFIG_PENDING; | ||
608 | 605 | ||
609 | DEBUGP(2, dev, "device " DEVICE_NAME "%d at 0x%.4x-0x%.4x\n", devno, | 606 | DEBUGP(2, dev, "device " DEVICE_NAME "%d at 0x%.4x-0x%.4x\n", devno, |
610 | link->io.BasePort1, link->io.BasePort1+link->io.NumPorts1); | 607 | link->io.BasePort1, link->io.BasePort1+link->io.NumPorts1); |
@@ -616,7 +613,6 @@ cs_failed: | |||
616 | cs_error(link, fail_fn, fail_rc); | 613 | cs_error(link, fail_fn, fail_rc); |
617 | cs_release: | 614 | cs_release: |
618 | reader_release(link); | 615 | reader_release(link); |
619 | link->state &= ~DEV_CONFIG_PENDING; | ||
620 | return -ENODEV; | 616 | return -ENODEV; |
621 | } | 617 | } |
622 | 618 | ||
@@ -659,7 +655,6 @@ static int reader_probe(struct pcmcia_device *link) | |||
659 | init_timer(&dev->poll_timer); | 655 | init_timer(&dev->poll_timer); |
660 | dev->poll_timer.function = &cm4040_do_poll; | 656 | dev->poll_timer.function = &cm4040_do_poll; |
661 | 657 | ||
662 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
663 | ret = reader_config(link, i); | 658 | ret = reader_config(link, i); |
664 | if (ret) | 659 | if (ret) |
665 | return ret; | 660 | return ret; |
@@ -683,10 +678,7 @@ static void reader_detach(struct pcmcia_device *link) | |||
683 | if (devno == CM_MAX_DEV) | 678 | if (devno == CM_MAX_DEV) |
684 | return; | 679 | return; |
685 | 680 | ||
686 | link->state &= ~DEV_PRESENT; | 681 | reader_release(link); |
687 | |||
688 | if (link->state & DEV_CONFIG) | ||
689 | reader_release(link); | ||
690 | 682 | ||
691 | dev_table[devno] = NULL; | 683 | dev_table[devno] = NULL; |
692 | kfree(dev); | 684 | kfree(dev); |