diff options
Diffstat (limited to 'drivers')
46 files changed, 311 insertions, 657 deletions
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index 50174fb107a8..473a13b22b29 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c | |||
@@ -244,7 +244,7 @@ static void bluecard_write_wakeup(bluecard_info_t *info) | |||
244 | 244 | ||
245 | clear_bit(XMIT_WAKEUP, &(info->tx_state)); | 245 | clear_bit(XMIT_WAKEUP, &(info->tx_state)); |
246 | 246 | ||
247 | if (!(info->p_dev->state & DEV_PRESENT)) | 247 | if (!pcmcia_dev_present(info->p_dev)) |
248 | return; | 248 | return; |
249 | 249 | ||
250 | if (test_bit(XMIT_BUFFER_NUMBER, &(info->tx_state))) { | 250 | if (test_bit(XMIT_BUFFER_NUMBER, &(info->tx_state))) { |
@@ -879,7 +879,6 @@ static int bluecard_probe(struct pcmcia_device *link) | |||
879 | link->conf.Attributes = CONF_ENABLE_IRQ; | 879 | link->conf.Attributes = CONF_ENABLE_IRQ; |
880 | link->conf.IntType = INT_MEMORY_AND_IO; | 880 | link->conf.IntType = INT_MEMORY_AND_IO; |
881 | 881 | ||
882 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
883 | return bluecard_config(link); | 882 | return bluecard_config(link); |
884 | } | 883 | } |
885 | 884 | ||
@@ -888,9 +887,7 @@ static void bluecard_detach(struct pcmcia_device *link) | |||
888 | { | 887 | { |
889 | bluecard_info_t *info = link->priv; | 888 | bluecard_info_t *info = link->priv; |
890 | 889 | ||
891 | if (link->state & DEV_CONFIG) | 890 | bluecard_release(link); |
892 | bluecard_release(link); | ||
893 | |||
894 | kfree(info); | 891 | kfree(info); |
895 | } | 892 | } |
896 | 893 | ||
@@ -933,9 +930,6 @@ static int bluecard_config(struct pcmcia_device *link) | |||
933 | link->conf.ConfigBase = parse.config.base; | 930 | link->conf.ConfigBase = parse.config.base; |
934 | link->conf.Present = parse.config.rmask[0]; | 931 | link->conf.Present = parse.config.rmask[0]; |
935 | 932 | ||
936 | /* Configure card */ | ||
937 | link->state |= DEV_CONFIG; | ||
938 | |||
939 | link->conf.ConfigIndex = 0x20; | 933 | link->conf.ConfigIndex = 0x20; |
940 | link->io.NumPorts1 = 64; | 934 | link->io.NumPorts1 = 64; |
941 | link->io.IOAddrLines = 6; | 935 | link->io.IOAddrLines = 6; |
@@ -969,7 +963,6 @@ static int bluecard_config(struct pcmcia_device *link) | |||
969 | 963 | ||
970 | strcpy(info->node.dev_name, info->hdev->name); | 964 | strcpy(info->node.dev_name, info->hdev->name); |
971 | link->dev_node = &info->node; | 965 | link->dev_node = &info->node; |
972 | link->state &= ~DEV_CONFIG_PENDING; | ||
973 | 966 | ||
974 | return 0; | 967 | return 0; |
975 | 968 | ||
@@ -986,8 +979,7 @@ static void bluecard_release(struct pcmcia_device *link) | |||
986 | { | 979 | { |
987 | bluecard_info_t *info = link->priv; | 980 | bluecard_info_t *info = link->priv; |
988 | 981 | ||
989 | if (link->state & DEV_PRESENT) | 982 | bluecard_close(info); |
990 | bluecard_close(info); | ||
991 | 983 | ||
992 | del_timer(&(info->timer)); | 984 | del_timer(&(info->timer)); |
993 | 985 | ||
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 80861f4f35e3..b94ac2f9f7ba 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c | |||
@@ -195,7 +195,7 @@ static void bt3c_write_wakeup(bt3c_info_t *info) | |||
195 | register struct sk_buff *skb; | 195 | register struct sk_buff *skb; |
196 | register int len; | 196 | register int len; |
197 | 197 | ||
198 | if (!(info->p_dev->state & DEV_PRESENT)) | 198 | if (!pcmcia_dev_present(info->p_dev)) |
199 | break; | 199 | break; |
200 | 200 | ||
201 | 201 | ||
@@ -668,7 +668,6 @@ static int bt3c_probe(struct pcmcia_device *link) | |||
668 | link->conf.Attributes = CONF_ENABLE_IRQ; | 668 | link->conf.Attributes = CONF_ENABLE_IRQ; |
669 | link->conf.IntType = INT_MEMORY_AND_IO; | 669 | link->conf.IntType = INT_MEMORY_AND_IO; |
670 | 670 | ||
671 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
672 | return bt3c_config(link); | 671 | return bt3c_config(link); |
673 | } | 672 | } |
674 | 673 | ||
@@ -677,9 +676,7 @@ static void bt3c_detach(struct pcmcia_device *link) | |||
677 | { | 676 | { |
678 | bt3c_info_t *info = link->priv; | 677 | bt3c_info_t *info = link->priv; |
679 | 678 | ||
680 | if (link->state & DEV_CONFIG) | 679 | bt3c_release(link); |
681 | bt3c_release(link); | ||
682 | |||
683 | kfree(info); | 680 | kfree(info); |
684 | } | 681 | } |
685 | 682 | ||
@@ -733,9 +730,6 @@ static int bt3c_config(struct pcmcia_device *link) | |||
733 | link->conf.ConfigBase = parse.config.base; | 730 | link->conf.ConfigBase = parse.config.base; |
734 | link->conf.Present = parse.config.rmask[0]; | 731 | link->conf.Present = parse.config.rmask[0]; |
735 | 732 | ||
736 | /* Configure card */ | ||
737 | link->state |= DEV_CONFIG; | ||
738 | |||
739 | /* First pass: look for a config entry that looks normal. */ | 733 | /* First pass: look for a config entry that looks normal. */ |
740 | tuple.TupleData = (cisdata_t *)buf; | 734 | tuple.TupleData = (cisdata_t *)buf; |
741 | tuple.TupleOffset = 0; | 735 | tuple.TupleOffset = 0; |
@@ -805,7 +799,6 @@ found_port: | |||
805 | 799 | ||
806 | strcpy(info->node.dev_name, info->hdev->name); | 800 | strcpy(info->node.dev_name, info->hdev->name); |
807 | link->dev_node = &info->node; | 801 | link->dev_node = &info->node; |
808 | link->state &= ~DEV_CONFIG_PENDING; | ||
809 | 802 | ||
810 | return 0; | 803 | return 0; |
811 | 804 | ||
@@ -822,8 +815,7 @@ static void bt3c_release(struct pcmcia_device *link) | |||
822 | { | 815 | { |
823 | bt3c_info_t *info = link->priv; | 816 | bt3c_info_t *info = link->priv; |
824 | 817 | ||
825 | if (link->state & DEV_PRESENT) | 818 | bt3c_close(info); |
826 | bt3c_close(info); | ||
827 | 819 | ||
828 | pcmcia_disable_device(link); | 820 | pcmcia_disable_device(link); |
829 | } | 821 | } |
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index 658a1373699e..9ce4c93467e5 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c | |||
@@ -152,7 +152,7 @@ static void btuart_write_wakeup(btuart_info_t *info) | |||
152 | 152 | ||
153 | clear_bit(XMIT_WAKEUP, &(info->tx_state)); | 153 | clear_bit(XMIT_WAKEUP, &(info->tx_state)); |
154 | 154 | ||
155 | if (!(info->p_dev->state & DEV_PRESENT)) | 155 | if (!pcmcia_dev_present(info->p_dev)) |
156 | return; | 156 | return; |
157 | 157 | ||
158 | if (!(skb = skb_dequeue(&(info->txq)))) | 158 | if (!(skb = skb_dequeue(&(info->txq)))) |
@@ -599,7 +599,6 @@ static int btuart_probe(struct pcmcia_device *link) | |||
599 | link->conf.Attributes = CONF_ENABLE_IRQ; | 599 | link->conf.Attributes = CONF_ENABLE_IRQ; |
600 | link->conf.IntType = INT_MEMORY_AND_IO; | 600 | link->conf.IntType = INT_MEMORY_AND_IO; |
601 | 601 | ||
602 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
603 | return btuart_config(link); | 602 | return btuart_config(link); |
604 | } | 603 | } |
605 | 604 | ||
@@ -608,9 +607,7 @@ static void btuart_detach(struct pcmcia_device *link) | |||
608 | { | 607 | { |
609 | btuart_info_t *info = link->priv; | 608 | btuart_info_t *info = link->priv; |
610 | 609 | ||
611 | if (link->state & DEV_CONFIG) | 610 | btuart_release(link); |
612 | btuart_release(link); | ||
613 | |||
614 | kfree(info); | 611 | kfree(info); |
615 | } | 612 | } |
616 | 613 | ||
@@ -664,9 +661,6 @@ static int btuart_config(struct pcmcia_device *link) | |||
664 | link->conf.ConfigBase = parse.config.base; | 661 | link->conf.ConfigBase = parse.config.base; |
665 | link->conf.Present = parse.config.rmask[0]; | 662 | link->conf.Present = parse.config.rmask[0]; |
666 | 663 | ||
667 | /* Configure card */ | ||
668 | link->state |= DEV_CONFIG; | ||
669 | |||
670 | /* First pass: look for a config entry that looks normal. */ | 664 | /* First pass: look for a config entry that looks normal. */ |
671 | tuple.TupleData = (cisdata_t *) buf; | 665 | tuple.TupleData = (cisdata_t *) buf; |
672 | tuple.TupleOffset = 0; | 666 | tuple.TupleOffset = 0; |
@@ -737,7 +731,6 @@ found_port: | |||
737 | 731 | ||
738 | strcpy(info->node.dev_name, info->hdev->name); | 732 | strcpy(info->node.dev_name, info->hdev->name); |
739 | link->dev_node = &info->node; | 733 | link->dev_node = &info->node; |
740 | link->state &= ~DEV_CONFIG_PENDING; | ||
741 | 734 | ||
742 | return 0; | 735 | return 0; |
743 | 736 | ||
@@ -754,8 +747,7 @@ static void btuart_release(struct pcmcia_device *link) | |||
754 | { | 747 | { |
755 | btuart_info_t *info = link->priv; | 748 | btuart_info_t *info = link->priv; |
756 | 749 | ||
757 | if (link->state & DEV_PRESENT) | 750 | btuart_close(info); |
758 | btuart_close(info); | ||
759 | 751 | ||
760 | pcmcia_disable_device(link); | 752 | pcmcia_disable_device(link); |
761 | } | 753 | } |
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index 0ec7fd4c9214..a71a240611e0 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c | |||
@@ -159,7 +159,7 @@ static void dtl1_write_wakeup(dtl1_info_t *info) | |||
159 | 159 | ||
160 | clear_bit(XMIT_WAKEUP, &(info->tx_state)); | 160 | clear_bit(XMIT_WAKEUP, &(info->tx_state)); |
161 | 161 | ||
162 | if (!(info->p_dev->state & DEV_PRESENT)) | 162 | if (!pcmcia_dev_present(info->p_dev)) |
163 | return; | 163 | return; |
164 | 164 | ||
165 | if (!(skb = skb_dequeue(&(info->txq)))) | 165 | if (!(skb = skb_dequeue(&(info->txq)))) |
@@ -578,7 +578,6 @@ static int dtl1_probe(struct pcmcia_device *link) | |||
578 | link->conf.Attributes = CONF_ENABLE_IRQ; | 578 | link->conf.Attributes = CONF_ENABLE_IRQ; |
579 | link->conf.IntType = INT_MEMORY_AND_IO; | 579 | link->conf.IntType = INT_MEMORY_AND_IO; |
580 | 580 | ||
581 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
582 | return dtl1_config(link); | 581 | return dtl1_config(link); |
583 | } | 582 | } |
584 | 583 | ||
@@ -587,8 +586,7 @@ static void dtl1_detach(struct pcmcia_device *link) | |||
587 | { | 586 | { |
588 | dtl1_info_t *info = link->priv; | 587 | dtl1_info_t *info = link->priv; |
589 | 588 | ||
590 | if (link->state & DEV_CONFIG) | 589 | dtl1_release(link); |
591 | dtl1_release(link); | ||
592 | 590 | ||
593 | kfree(info); | 591 | kfree(info); |
594 | } | 592 | } |
@@ -642,9 +640,6 @@ static int dtl1_config(struct pcmcia_device *link) | |||
642 | link->conf.ConfigBase = parse.config.base; | 640 | link->conf.ConfigBase = parse.config.base; |
643 | link->conf.Present = parse.config.rmask[0]; | 641 | link->conf.Present = parse.config.rmask[0]; |
644 | 642 | ||
645 | /* Configure card */ | ||
646 | link->state |= DEV_CONFIG; | ||
647 | |||
648 | tuple.TupleData = (cisdata_t *)buf; | 643 | tuple.TupleData = (cisdata_t *)buf; |
649 | tuple.TupleOffset = 0; | 644 | tuple.TupleOffset = 0; |
650 | tuple.TupleDataMax = 255; | 645 | tuple.TupleDataMax = 255; |
@@ -689,7 +684,6 @@ static int dtl1_config(struct pcmcia_device *link) | |||
689 | 684 | ||
690 | strcpy(info->node.dev_name, info->hdev->name); | 685 | strcpy(info->node.dev_name, info->hdev->name); |
691 | link->dev_node = &info->node; | 686 | link->dev_node = &info->node; |
692 | link->state &= ~DEV_CONFIG_PENDING; | ||
693 | 687 | ||
694 | return 0; | 688 | return 0; |
695 | 689 | ||
@@ -706,8 +700,7 @@ static void dtl1_release(struct pcmcia_device *link) | |||
706 | { | 700 | { |
707 | dtl1_info_t *info = link->priv; | 701 | dtl1_info_t *info = link->priv; |
708 | 702 | ||
709 | if (link->state & DEV_PRESENT) | 703 | dtl1_close(info); |
710 | dtl1_close(info); | ||
711 | 704 | ||
712 | pcmcia_disable_device(link); | 705 | pcmcia_disable_device(link); |
713 | } | 706 | } |
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 22dce9d47b2b..16e105d8d70c 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
@@ -971,7 +971,7 @@ static ssize_t cmm_read(struct file *filp, __user char *buf, size_t count, | |||
971 | if (count == 0) /* according to manpage */ | 971 | if (count == 0) /* according to manpage */ |
972 | return 0; | 972 | return 0; |
973 | 973 | ||
974 | if ((dev->p_dev->state & DEV_PRESENT) == 0 || /* socket removed */ | 974 | if (!pcmcia_dev_present(dev->p_dev) || /* device removed */ |
975 | test_bit(IS_CMM_ABSENT, &dev->flags)) | 975 | test_bit(IS_CMM_ABSENT, &dev->flags)) |
976 | return -ENODEV; | 976 | return -ENODEV; |
977 | 977 | ||
@@ -1108,7 +1108,7 @@ static ssize_t cmm_write(struct file *filp, const char __user *buf, | |||
1108 | 1108 | ||
1109 | sendT0 = dev->proto ? 0 : nr > 5 ? 0x08 : 0; | 1109 | sendT0 = dev->proto ? 0 : nr > 5 ? 0x08 : 0; |
1110 | 1110 | ||
1111 | if ((dev->p_dev->state & DEV_PRESENT) == 0 || /* socket removed */ | 1111 | if (!pcmcia_dev_present(dev->p_dev) || /* device removed */ |
1112 | test_bit(IS_CMM_ABSENT, &dev->flags)) | 1112 | test_bit(IS_CMM_ABSENT, &dev->flags)) |
1113 | return -ENODEV; | 1113 | return -ENODEV; |
1114 | 1114 | ||
@@ -1789,7 +1789,6 @@ static int cm4000_config(struct pcmcia_device * link, int devno) | |||
1789 | goto cs_failed; | 1789 | goto cs_failed; |
1790 | } | 1790 | } |
1791 | 1791 | ||
1792 | link->state |= DEV_CONFIG; | ||
1793 | link->conf.ConfigBase = parse.config.base; | 1792 | link->conf.ConfigBase = parse.config.base; |
1794 | link->conf.Present = parse.config.rmask[0]; | 1793 | link->conf.Present = parse.config.rmask[0]; |
1795 | 1794 | ||
@@ -1844,7 +1843,6 @@ static int cm4000_config(struct pcmcia_device * link, int devno) | |||
1844 | dev->node.minor = devno; | 1843 | dev->node.minor = devno; |
1845 | dev->node.next = NULL; | 1844 | dev->node.next = NULL; |
1846 | link->dev_node = &dev->node; | 1845 | link->dev_node = &dev->node; |
1847 | link->state &= ~DEV_CONFIG_PENDING; | ||
1848 | 1846 | ||
1849 | return 0; | 1847 | return 0; |
1850 | 1848 | ||
@@ -1852,8 +1850,6 @@ cs_failed: | |||
1852 | cs_error(link, fail_fn, fail_rc); | 1850 | cs_error(link, fail_fn, fail_rc); |
1853 | cs_release: | 1851 | cs_release: |
1854 | cm4000_release(link); | 1852 | cm4000_release(link); |
1855 | |||
1856 | link->state &= ~DEV_CONFIG_PENDING; | ||
1857 | return -ENODEV; | 1853 | return -ENODEV; |
1858 | } | 1854 | } |
1859 | 1855 | ||
@@ -1913,7 +1909,6 @@ static int cm4000_probe(struct pcmcia_device *link) | |||
1913 | init_waitqueue_head(&dev->atrq); | 1909 | init_waitqueue_head(&dev->atrq); |
1914 | init_waitqueue_head(&dev->readq); | 1910 | init_waitqueue_head(&dev->readq); |
1915 | 1911 | ||
1916 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
1917 | ret = cm4000_config(link, i); | 1912 | ret = cm4000_config(link, i); |
1918 | if (ret) | 1913 | if (ret) |
1919 | return ret; | 1914 | return ret; |
@@ -1936,11 +1931,9 @@ static void cm4000_detach(struct pcmcia_device *link) | |||
1936 | if (devno == CM4000_MAX_DEV) | 1931 | if (devno == CM4000_MAX_DEV) |
1937 | return; | 1932 | return; |
1938 | 1933 | ||
1939 | link->state &= ~DEV_PRESENT; | ||
1940 | stop_monitor(dev); | 1934 | stop_monitor(dev); |
1941 | 1935 | ||
1942 | if (link->state & DEV_CONFIG) | 1936 | cm4000_release(link); |
1943 | cm4000_release(link); | ||
1944 | 1937 | ||
1945 | dev_table[devno] = NULL; | 1938 | dev_table[devno] = NULL; |
1946 | kfree(dev); | 1939 | kfree(dev); |
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); |
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index ef7a81314f0c..07213454c458 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -578,7 +578,6 @@ static int mgslpc_probe(struct pcmcia_device *link) | |||
578 | link->conf.Attributes = 0; | 578 | link->conf.Attributes = 0; |
579 | link->conf.IntType = INT_MEMORY_AND_IO; | 579 | link->conf.IntType = INT_MEMORY_AND_IO; |
580 | 580 | ||
581 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
582 | ret = mgslpc_config(link); | 581 | ret = mgslpc_config(link); |
583 | if (ret) | 582 | if (ret) |
584 | return ret; | 583 | return ret; |
@@ -618,9 +617,6 @@ static int mgslpc_config(struct pcmcia_device *link) | |||
618 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | 617 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
619 | link->conf.ConfigBase = parse.config.base; | 618 | link->conf.ConfigBase = parse.config.base; |
620 | link->conf.Present = parse.config.rmask[0]; | 619 | link->conf.Present = parse.config.rmask[0]; |
621 | |||
622 | /* Configure card */ | ||
623 | link->state |= DEV_CONFIG; | ||
624 | 620 | ||
625 | /* get CIS configuration entry */ | 621 | /* get CIS configuration entry */ |
626 | 622 | ||
@@ -681,8 +677,6 @@ static int mgslpc_config(struct pcmcia_device *link) | |||
681 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | 677 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, |
682 | link->io.BasePort1+link->io.NumPorts1-1); | 678 | link->io.BasePort1+link->io.NumPorts1-1); |
683 | printk("\n"); | 679 | printk("\n"); |
684 | |||
685 | link->state &= ~DEV_CONFIG_PENDING; | ||
686 | return 0; | 680 | return 0; |
687 | 681 | ||
688 | cs_failed: | 682 | cs_failed: |
@@ -697,25 +691,23 @@ cs_failed: | |||
697 | */ | 691 | */ |
698 | static void mgslpc_release(u_long arg) | 692 | static void mgslpc_release(u_long arg) |
699 | { | 693 | { |
700 | struct pcmcia_device *link = (struct pcmcia_device *)arg; | 694 | struct pcmcia_device *link = (struct pcmcia_device *)arg; |
701 | 695 | ||
702 | if (debug_level >= DEBUG_LEVEL_INFO) | 696 | if (debug_level >= DEBUG_LEVEL_INFO) |
703 | printk("mgslpc_release(0x%p)\n", link); | 697 | printk("mgslpc_release(0x%p)\n", link); |
704 | 698 | ||
705 | pcmcia_disable_device(link); | 699 | pcmcia_disable_device(link); |
706 | } | 700 | } |
707 | 701 | ||
708 | static void mgslpc_detach(struct pcmcia_device *link) | 702 | static void mgslpc_detach(struct pcmcia_device *link) |
709 | { | 703 | { |
710 | if (debug_level >= DEBUG_LEVEL_INFO) | 704 | if (debug_level >= DEBUG_LEVEL_INFO) |
711 | printk("mgslpc_detach(0x%p)\n", link); | 705 | printk("mgslpc_detach(0x%p)\n", link); |
712 | 706 | ||
713 | if (link->state & DEV_CONFIG) { | 707 | ((MGSLPC_INFO *)link->priv)->stop = 1; |
714 | ((MGSLPC_INFO *)link->priv)->stop = 1; | 708 | mgslpc_release((u_long)link); |
715 | mgslpc_release((u_long)link); | ||
716 | } | ||
717 | 709 | ||
718 | mgslpc_remove_device((MGSLPC_INFO *)link->priv); | 710 | mgslpc_remove_device((MGSLPC_INFO *)link->priv); |
719 | } | 711 | } |
720 | 712 | ||
721 | static int mgslpc_suspend(struct pcmcia_device *link) | 713 | static int mgslpc_suspend(struct pcmcia_device *link) |
@@ -1254,7 +1246,7 @@ static irqreturn_t mgslpc_isr(int irq, void *dev_id, struct pt_regs * regs) | |||
1254 | if (!info) | 1246 | if (!info) |
1255 | return IRQ_NONE; | 1247 | return IRQ_NONE; |
1256 | 1248 | ||
1257 | if (!(info->p_dev->state & DEV_CONFIG)) | 1249 | if (!(info->p_dev->_locked)) |
1258 | return IRQ_HANDLED; | 1250 | return IRQ_HANDLED; |
1259 | 1251 | ||
1260 | spin_lock(&info->lock); | 1252 | spin_lock(&info->lock); |
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index 56c8e828c6e6..4961f1e764a7 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c | |||
@@ -125,7 +125,6 @@ static int ide_probe(struct pcmcia_device *link) | |||
125 | link->conf.Attributes = CONF_ENABLE_IRQ; | 125 | link->conf.Attributes = CONF_ENABLE_IRQ; |
126 | link->conf.IntType = INT_MEMORY_AND_IO; | 126 | link->conf.IntType = INT_MEMORY_AND_IO; |
127 | 127 | ||
128 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
129 | return ide_config(link); | 128 | return ide_config(link); |
130 | } /* ide_attach */ | 129 | } /* ide_attach */ |
131 | 130 | ||
@@ -142,8 +141,7 @@ static void ide_detach(struct pcmcia_device *link) | |||
142 | { | 141 | { |
143 | DEBUG(0, "ide_detach(0x%p)\n", link); | 142 | DEBUG(0, "ide_detach(0x%p)\n", link); |
144 | 143 | ||
145 | if (link->state & DEV_CONFIG) | 144 | ide_release(link); |
146 | ide_release(link); | ||
147 | 145 | ||
148 | kfree(link->priv); | 146 | kfree(link->priv); |
149 | } /* ide_detach */ | 147 | } /* ide_detach */ |
@@ -209,9 +207,6 @@ static int ide_config(struct pcmcia_device *link) | |||
209 | ((stk->parse.manfid.card == PRODID_KME_KXLC005_A) || | 207 | ((stk->parse.manfid.card == PRODID_KME_KXLC005_A) || |
210 | (stk->parse.manfid.card == PRODID_KME_KXLC005_B))); | 208 | (stk->parse.manfid.card == PRODID_KME_KXLC005_B))); |
211 | 209 | ||
212 | /* Configure card */ | ||
213 | link->state |= DEV_CONFIG; | ||
214 | |||
215 | /* Not sure if this is right... look up the current Vcc */ | 210 | /* Not sure if this is right... look up the current Vcc */ |
216 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf)); | 211 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf)); |
217 | 212 | ||
@@ -323,7 +318,6 @@ static int ide_config(struct pcmcia_device *link) | |||
323 | printk(KERN_INFO "ide-cs: %s: Vpp = %d.%d\n", | 318 | printk(KERN_INFO "ide-cs: %s: Vpp = %d.%d\n", |
324 | info->node.dev_name, link->conf.Vpp / 10, link->conf.Vpp % 10); | 319 | info->node.dev_name, link->conf.Vpp / 10, link->conf.Vpp % 10); |
325 | 320 | ||
326 | link->state &= ~DEV_CONFIG_PENDING; | ||
327 | kfree(stk); | 321 | kfree(stk); |
328 | return 0; | 322 | return 0; |
329 | 323 | ||
@@ -336,7 +330,6 @@ cs_failed: | |||
336 | failed: | 330 | failed: |
337 | kfree(stk); | 331 | kfree(stk); |
338 | ide_release(link); | 332 | ide_release(link); |
339 | link->state &= ~DEV_CONFIG_PENDING; | ||
340 | return -ENODEV; | 333 | return -ENODEV; |
341 | } /* ide_config */ | 334 | } /* ide_config */ |
342 | 335 | ||
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index 28f9211726c5..7bbfd85ab793 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c | |||
@@ -127,7 +127,6 @@ static int avmcs_probe(struct pcmcia_device *p_dev) | |||
127 | memset(local, 0, sizeof(local_info_t)); | 127 | memset(local, 0, sizeof(local_info_t)); |
128 | p_dev->priv = local; | 128 | p_dev->priv = local; |
129 | 129 | ||
130 | p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
131 | return avmcs_config(p_dev); | 130 | return avmcs_config(p_dev); |
132 | 131 | ||
133 | err: | 132 | err: |
@@ -145,10 +144,8 @@ static int avmcs_probe(struct pcmcia_device *p_dev) | |||
145 | 144 | ||
146 | static void avmcs_detach(struct pcmcia_device *link) | 145 | static void avmcs_detach(struct pcmcia_device *link) |
147 | { | 146 | { |
148 | if (link->state & DEV_CONFIG) | ||
149 | avmcs_release(link); | 147 | avmcs_release(link); |
150 | 148 | kfree(link->priv); | |
151 | kfree(link->priv); | ||
152 | } /* avmcs_detach */ | 149 | } /* avmcs_detach */ |
153 | 150 | ||
154 | /*====================================================================== | 151 | /*====================================================================== |
@@ -216,12 +213,8 @@ static int avmcs_config(struct pcmcia_device *link) | |||
216 | } while (0); | 213 | } while (0); |
217 | if (i != CS_SUCCESS) { | 214 | if (i != CS_SUCCESS) { |
218 | cs_error(link, ParseTuple, i); | 215 | cs_error(link, ParseTuple, i); |
219 | link->state &= ~DEV_CONFIG_PENDING; | ||
220 | return -ENODEV; | 216 | return -ENODEV; |
221 | } | 217 | } |
222 | |||
223 | /* Configure card */ | ||
224 | link->state |= DEV_CONFIG; | ||
225 | 218 | ||
226 | do { | 219 | do { |
227 | 220 | ||
@@ -312,8 +305,7 @@ found_port: | |||
312 | dev->node.major = 64; | 305 | dev->node.major = 64; |
313 | dev->node.minor = 0; | 306 | dev->node.minor = 0; |
314 | link->dev_node = &dev->node; | 307 | link->dev_node = &dev->node; |
315 | 308 | ||
316 | link->state &= ~DEV_CONFIG_PENDING; | ||
317 | /* If any step failed, release any partially configured state */ | 309 | /* If any step failed, release any partially configured state */ |
318 | if (i != 0) { | 310 | if (i != 0) { |
319 | avmcs_release(link); | 311 | avmcs_release(link); |
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index 11c7c4f09e7e..ac28e3278ad9 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c | |||
@@ -149,7 +149,6 @@ static int avma1cs_probe(struct pcmcia_device *p_dev) | |||
149 | p_dev->conf.ConfigIndex = 1; | 149 | p_dev->conf.ConfigIndex = 1; |
150 | p_dev->conf.Present = PRESENT_OPTION; | 150 | p_dev->conf.Present = PRESENT_OPTION; |
151 | 151 | ||
152 | p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
153 | return avma1cs_config(p_dev); | 152 | return avma1cs_config(p_dev); |
154 | } /* avma1cs_attach */ | 153 | } /* avma1cs_attach */ |
155 | 154 | ||
@@ -164,12 +163,9 @@ static int avma1cs_probe(struct pcmcia_device *p_dev) | |||
164 | 163 | ||
165 | static void avma1cs_detach(struct pcmcia_device *link) | 164 | static void avma1cs_detach(struct pcmcia_device *link) |
166 | { | 165 | { |
167 | DEBUG(0, "avma1cs_detach(0x%p)\n", link); | 166 | DEBUG(0, "avma1cs_detach(0x%p)\n", link); |
168 | 167 | avma1cs_release(link); | |
169 | if (link->state & DEV_CONFIG) | 168 | kfree(link->priv); |
170 | avma1cs_release(link); | ||
171 | |||
172 | kfree(link->priv); | ||
173 | } /* avma1cs_detach */ | 169 | } /* avma1cs_detach */ |
174 | 170 | ||
175 | /*====================================================================== | 171 | /*====================================================================== |
@@ -239,12 +235,8 @@ static int avma1cs_config(struct pcmcia_device *link) | |||
239 | } while (0); | 235 | } while (0); |
240 | if (i != CS_SUCCESS) { | 236 | if (i != CS_SUCCESS) { |
241 | cs_error(link, ParseTuple, i); | 237 | cs_error(link, ParseTuple, i); |
242 | link->state &= ~DEV_CONFIG_PENDING; | ||
243 | return -ENODEV; | 238 | return -ENODEV; |
244 | } | 239 | } |
245 | |||
246 | /* Configure card */ | ||
247 | link->state |= DEV_CONFIG; | ||
248 | 240 | ||
249 | do { | 241 | do { |
250 | 242 | ||
@@ -318,8 +310,7 @@ found_port: | |||
318 | dev->node.major = 45; | 310 | dev->node.major = 45; |
319 | dev->node.minor = 0; | 311 | dev->node.minor = 0; |
320 | link->dev_node = &dev->node; | 312 | link->dev_node = &dev->node; |
321 | 313 | ||
322 | link->state &= ~DEV_CONFIG_PENDING; | ||
323 | /* If any step failed, release any partially configured state */ | 314 | /* If any step failed, release any partially configured state */ |
324 | if (i != 0) { | 315 | if (i != 0) { |
325 | avma1cs_release(link); | 316 | avma1cs_release(link); |
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index 4856680ce761..e18e75be8ed3 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c | |||
@@ -174,7 +174,6 @@ static int elsa_cs_probe(struct pcmcia_device *link) | |||
174 | link->conf.Attributes = CONF_ENABLE_IRQ; | 174 | link->conf.Attributes = CONF_ENABLE_IRQ; |
175 | link->conf.IntType = INT_MEMORY_AND_IO; | 175 | link->conf.IntType = INT_MEMORY_AND_IO; |
176 | 176 | ||
177 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
178 | return elsa_cs_config(link); | 177 | return elsa_cs_config(link); |
179 | } /* elsa_cs_attach */ | 178 | } /* elsa_cs_attach */ |
180 | 179 | ||
@@ -189,17 +188,14 @@ static int elsa_cs_probe(struct pcmcia_device *link) | |||
189 | 188 | ||
190 | static void elsa_cs_detach(struct pcmcia_device *link) | 189 | static void elsa_cs_detach(struct pcmcia_device *link) |
191 | { | 190 | { |
192 | local_info_t *info = link->priv; | 191 | local_info_t *info = link->priv; |
193 | 192 | ||
194 | DEBUG(0, "elsa_cs_detach(0x%p)\n", link); | 193 | DEBUG(0, "elsa_cs_detach(0x%p)\n", link); |
195 | 194 | ||
196 | if (link->state & DEV_CONFIG) { | 195 | info->busy = 1; |
197 | info->busy = 1; | 196 | elsa_cs_release(link); |
198 | elsa_cs_release(link); | ||
199 | } | ||
200 | |||
201 | kfree(info); | ||
202 | 197 | ||
198 | kfree(info); | ||
203 | } /* elsa_cs_detach */ | 199 | } /* elsa_cs_detach */ |
204 | 200 | ||
205 | /*====================================================================== | 201 | /*====================================================================== |
@@ -263,9 +259,6 @@ static int elsa_cs_config(struct pcmcia_device *link) | |||
263 | link->conf.ConfigBase = parse.config.base; | 259 | link->conf.ConfigBase = parse.config.base; |
264 | link->conf.Present = parse.config.rmask[0]; | 260 | link->conf.Present = parse.config.rmask[0]; |
265 | 261 | ||
266 | /* Configure card */ | ||
267 | link->state |= DEV_CONFIG; | ||
268 | |||
269 | tuple.TupleData = (cisdata_t *)buf; | 262 | tuple.TupleData = (cisdata_t *)buf; |
270 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; | 263 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; |
271 | tuple.Attributes = 0; | 264 | tuple.Attributes = 0; |
@@ -329,8 +322,6 @@ static int elsa_cs_config(struct pcmcia_device *link) | |||
329 | link->io.BasePort2+link->io.NumPorts2-1); | 322 | link->io.BasePort2+link->io.NumPorts2-1); |
330 | printk("\n"); | 323 | printk("\n"); |
331 | 324 | ||
332 | link->state &= ~DEV_CONFIG_PENDING; | ||
333 | |||
334 | icard.para[0] = link->irq.AssignedIRQ; | 325 | icard.para[0] = link->irq.AssignedIRQ; |
335 | icard.para[1] = link->io.BasePort1; | 326 | icard.para[1] = link->io.BasePort1; |
336 | icard.protocol = protocol; | 327 | icard.protocol = protocol; |
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index a35a29586a62..9bb18f3f7829 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c | |||
@@ -186,7 +186,6 @@ static int sedlbauer_probe(struct pcmcia_device *link) | |||
186 | link->conf.Attributes = 0; | 186 | link->conf.Attributes = 0; |
187 | link->conf.IntType = INT_MEMORY_AND_IO; | 187 | link->conf.IntType = INT_MEMORY_AND_IO; |
188 | 188 | ||
189 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
190 | return sedlbauer_config(link); | 189 | return sedlbauer_config(link); |
191 | } /* sedlbauer_attach */ | 190 | } /* sedlbauer_attach */ |
192 | 191 | ||
@@ -201,15 +200,13 @@ static int sedlbauer_probe(struct pcmcia_device *link) | |||
201 | 200 | ||
202 | static void sedlbauer_detach(struct pcmcia_device *link) | 201 | static void sedlbauer_detach(struct pcmcia_device *link) |
203 | { | 202 | { |
204 | DEBUG(0, "sedlbauer_detach(0x%p)\n", link); | 203 | DEBUG(0, "sedlbauer_detach(0x%p)\n", link); |
205 | 204 | ||
206 | if (link->state & DEV_CONFIG) { | 205 | ((local_info_t *)link->priv)->stop = 1; |
207 | ((local_info_t *)link->priv)->stop = 1; | 206 | sedlbauer_release(link); |
208 | sedlbauer_release(link); | ||
209 | } | ||
210 | 207 | ||
211 | /* This points to the parent local_info_t struct */ | 208 | /* This points to the parent local_info_t struct */ |
212 | kfree(link->priv); | 209 | kfree(link->priv); |
213 | } /* sedlbauer_detach */ | 210 | } /* sedlbauer_detach */ |
214 | 211 | ||
215 | /*====================================================================== | 212 | /*====================================================================== |
@@ -250,9 +247,6 @@ static int sedlbauer_config(struct pcmcia_device *link) | |||
250 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | 247 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
251 | link->conf.ConfigBase = parse.config.base; | 248 | link->conf.ConfigBase = parse.config.base; |
252 | link->conf.Present = parse.config.rmask[0]; | 249 | link->conf.Present = parse.config.rmask[0]; |
253 | |||
254 | /* Configure card */ | ||
255 | link->state |= DEV_CONFIG; | ||
256 | 250 | ||
257 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &conf)); | 251 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &conf)); |
258 | 252 | ||
@@ -408,8 +402,6 @@ static int sedlbauer_config(struct pcmcia_device *link) | |||
408 | printk(", mem 0x%06lx-0x%06lx", req.Base, | 402 | printk(", mem 0x%06lx-0x%06lx", req.Base, |
409 | req.Base+req.Size-1); | 403 | req.Base+req.Size-1); |
410 | printk("\n"); | 404 | printk("\n"); |
411 | |||
412 | link->state &= ~DEV_CONFIG_PENDING; | ||
413 | 405 | ||
414 | icard.para[0] = link->irq.AssignedIRQ; | 406 | icard.para[0] = link->irq.AssignedIRQ; |
415 | icard.para[1] = link->io.BasePort1; | 407 | icard.para[1] = link->io.BasePort1; |
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index 7b66038096f3..afcc2aeadb34 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c | |||
@@ -164,7 +164,6 @@ static int teles_probe(struct pcmcia_device *link) | |||
164 | link->conf.Attributes = CONF_ENABLE_IRQ; | 164 | link->conf.Attributes = CONF_ENABLE_IRQ; |
165 | link->conf.IntType = INT_MEMORY_AND_IO; | 165 | link->conf.IntType = INT_MEMORY_AND_IO; |
166 | 166 | ||
167 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
168 | return teles_cs_config(link); | 167 | return teles_cs_config(link); |
169 | } /* teles_attach */ | 168 | } /* teles_attach */ |
170 | 169 | ||
@@ -179,17 +178,14 @@ static int teles_probe(struct pcmcia_device *link) | |||
179 | 178 | ||
180 | static void teles_detach(struct pcmcia_device *link) | 179 | static void teles_detach(struct pcmcia_device *link) |
181 | { | 180 | { |
182 | local_info_t *info = link->priv; | 181 | local_info_t *info = link->priv; |
183 | 182 | ||
184 | DEBUG(0, "teles_detach(0x%p)\n", link); | 183 | DEBUG(0, "teles_detach(0x%p)\n", link); |
185 | 184 | ||
186 | if (link->state & DEV_CONFIG) { | 185 | info->busy = 1; |
187 | info->busy = 1; | 186 | teles_cs_release(link); |
188 | teles_cs_release(link); | ||
189 | } | ||
190 | |||
191 | kfree(info); | ||
192 | 187 | ||
188 | kfree(info); | ||
193 | } /* teles_detach */ | 189 | } /* teles_detach */ |
194 | 190 | ||
195 | /*====================================================================== | 191 | /*====================================================================== |
@@ -253,9 +249,6 @@ static int teles_cs_config(struct pcmcia_device *link) | |||
253 | link->conf.ConfigBase = parse.config.base; | 249 | link->conf.ConfigBase = parse.config.base; |
254 | link->conf.Present = parse.config.rmask[0]; | 250 | link->conf.Present = parse.config.rmask[0]; |
255 | 251 | ||
256 | /* Configure card */ | ||
257 | link->state |= DEV_CONFIG; | ||
258 | |||
259 | tuple.TupleData = (cisdata_t *)buf; | 252 | tuple.TupleData = (cisdata_t *)buf; |
260 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; | 253 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; |
261 | tuple.Attributes = 0; | 254 | tuple.Attributes = 0; |
@@ -319,8 +312,6 @@ static int teles_cs_config(struct pcmcia_device *link) | |||
319 | link->io.BasePort2+link->io.NumPorts2-1); | 312 | link->io.BasePort2+link->io.NumPorts2-1); |
320 | printk("\n"); | 313 | printk("\n"); |
321 | 314 | ||
322 | link->state &= ~DEV_CONFIG_PENDING; | ||
323 | |||
324 | icard.para[0] = link->irq.AssignedIRQ; | 315 | icard.para[0] = link->irq.AssignedIRQ; |
325 | icard.para[1] = link->io.BasePort1; | 316 | icard.para[1] = link->io.BasePort1; |
326 | icard.protocol = protocol; | 317 | icard.protocol = protocol; |
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index 466f558aa7ed..a01e04bf484a 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c | |||
@@ -111,8 +111,8 @@ static caddr_t remap_window(struct map_info *map, unsigned long to) | |||
111 | memreq_t mrq; | 111 | memreq_t mrq; |
112 | int ret; | 112 | int ret; |
113 | 113 | ||
114 | if(!(dev->p_dev->state & DEV_PRESENT)) { | 114 | if (!pcmcia_dev_present(dev->p_dev)) { |
115 | DEBUG(1, "device removed state = 0x%4.4X", dev->p_dev->state); | 115 | DEBUG(1, "device removed"); |
116 | return 0; | 116 | return 0; |
117 | } | 117 | } |
118 | 118 | ||
@@ -238,7 +238,7 @@ static void pcmcia_copy_to_remap(struct map_info *map, unsigned long to, const v | |||
238 | 238 | ||
239 | /* read/write{8,16} copy_{from,to} routines with direct access */ | 239 | /* read/write{8,16} copy_{from,to} routines with direct access */ |
240 | 240 | ||
241 | #define DEV_REMOVED(x) (!(*(u_int *)x->map_priv_1 & DEV_PRESENT)) | 241 | #define DEV_REMOVED(x) (!(pcmcia_dev_present(((struct pcmciamtd_dev *)map->map_priv_1)->p_dev))) |
242 | 242 | ||
243 | static map_word pcmcia_read8(struct map_info *map, unsigned long ofs) | 243 | static map_word pcmcia_read8(struct map_info *map, unsigned long ofs) |
244 | { | 244 | { |
@@ -503,9 +503,6 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
503 | 503 | ||
504 | DEBUG(3, "link=0x%p", link); | 504 | DEBUG(3, "link=0x%p", link); |
505 | 505 | ||
506 | /* Configure card */ | ||
507 | link->state |= DEV_CONFIG; | ||
508 | |||
509 | DEBUG(2, "Validating CIS"); | 506 | DEBUG(2, "Validating CIS"); |
510 | ret = pcmcia_validate_cis(link, &cisinfo); | 507 | ret = pcmcia_validate_cis(link, &cisinfo); |
511 | if(ret != CS_SUCCESS) { | 508 | if(ret != CS_SUCCESS) { |
@@ -651,7 +648,6 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
651 | use the faster non-remapping read/write functions */ | 648 | use the faster non-remapping read/write functions */ |
652 | if(mtd->size <= dev->win_size) { | 649 | if(mtd->size <= dev->win_size) { |
653 | DEBUG(1, "Using non remapping memory functions"); | 650 | DEBUG(1, "Using non remapping memory functions"); |
654 | dev->pcmcia_map.map_priv_1 = (unsigned long)&(dev->p_dev->state); | ||
655 | dev->pcmcia_map.map_priv_2 = (unsigned long)dev->win_base; | 651 | dev->pcmcia_map.map_priv_2 = (unsigned long)dev->win_base; |
656 | if (dev->pcmcia_map.bankwidth == 1) { | 652 | if (dev->pcmcia_map.bankwidth == 1) { |
657 | dev->pcmcia_map.read = pcmcia_read8; | 653 | dev->pcmcia_map.read = pcmcia_read8; |
@@ -673,7 +669,6 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
673 | } | 669 | } |
674 | snprintf(dev->node.dev_name, sizeof(dev->node.dev_name), "mtd%d", mtd->index); | 670 | snprintf(dev->node.dev_name, sizeof(dev->node.dev_name), "mtd%d", mtd->index); |
675 | info("mtd%d: %s", mtd->index, mtd->name); | 671 | info("mtd%d: %s", mtd->index, mtd->name); |
676 | link->state &= ~DEV_CONFIG_PENDING; | ||
677 | link->dev_node = &dev->node; | 672 | link->dev_node = &dev->node; |
678 | return 0; | 673 | return 0; |
679 | 674 | ||
@@ -712,17 +707,16 @@ static int pcmciamtd_resume(struct pcmcia_device *dev) | |||
712 | 707 | ||
713 | static void pcmciamtd_detach(struct pcmcia_device *link) | 708 | static void pcmciamtd_detach(struct pcmcia_device *link) |
714 | { | 709 | { |
715 | DEBUG(3, "link=0x%p", link); | 710 | struct pcmciamtd_dev *dev = link->priv; |
716 | 711 | ||
717 | if(link->state & DEV_CONFIG) { | 712 | DEBUG(3, "link=0x%p", link); |
718 | struct pcmciamtd_dev *dev = link->priv; | ||
719 | if(dev->mtd_info) { | ||
720 | del_mtd_device(dev->mtd_info); | ||
721 | info("mtd%d: Removed", dev->mtd_info->index); | ||
722 | } | ||
723 | 713 | ||
724 | pcmciamtd_release(link); | 714 | if(dev->mtd_info) { |
715 | del_mtd_device(dev->mtd_info); | ||
716 | info("mtd%d: Removed", dev->mtd_info->index); | ||
725 | } | 717 | } |
718 | |||
719 | pcmciamtd_release(link); | ||
726 | } | 720 | } |
727 | 721 | ||
728 | 722 | ||
@@ -747,7 +741,6 @@ static int pcmciamtd_probe(struct pcmcia_device *link) | |||
747 | link->conf.Attributes = 0; | 741 | link->conf.Attributes = 0; |
748 | link->conf.IntType = INT_MEMORY; | 742 | link->conf.IntType = INT_MEMORY; |
749 | 743 | ||
750 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
751 | return pcmciamtd_config(link); | 744 | return pcmciamtd_config(link); |
752 | } | 745 | } |
753 | 746 | ||
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index 4611469fdff9..70e3cca09787 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c | |||
@@ -296,7 +296,6 @@ static int tc574_probe(struct pcmcia_device *link) | |||
296 | dev->watchdog_timeo = TX_TIMEOUT; | 296 | dev->watchdog_timeo = TX_TIMEOUT; |
297 | #endif | 297 | #endif |
298 | 298 | ||
299 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
300 | return tc574_config(link); | 299 | return tc574_config(link); |
301 | } /* tc574_attach */ | 300 | } /* tc574_attach */ |
302 | 301 | ||
@@ -318,8 +317,7 @@ static void tc574_detach(struct pcmcia_device *link) | |||
318 | if (link->dev_node) | 317 | if (link->dev_node) |
319 | unregister_netdev(dev); | 318 | unregister_netdev(dev); |
320 | 319 | ||
321 | if (link->state & DEV_CONFIG) | 320 | tc574_release(link); |
322 | tc574_release(link); | ||
323 | 321 | ||
324 | free_netdev(dev); | 322 | free_netdev(dev); |
325 | } /* tc574_detach */ | 323 | } /* tc574_detach */ |
@@ -363,9 +361,6 @@ static int tc574_config(struct pcmcia_device *link) | |||
363 | link->conf.ConfigBase = parse.config.base; | 361 | link->conf.ConfigBase = parse.config.base; |
364 | link->conf.Present = parse.config.rmask[0]; | 362 | link->conf.Present = parse.config.rmask[0]; |
365 | 363 | ||
366 | /* Configure card */ | ||
367 | link->state |= DEV_CONFIG; | ||
368 | |||
369 | link->io.IOAddrLines = 16; | 364 | link->io.IOAddrLines = 16; |
370 | for (i = j = 0; j < 0x400; j += 0x20) { | 365 | for (i = j = 0; j < 0x400; j += 0x20) { |
371 | link->io.BasePort1 = j ^ 0x300; | 366 | link->io.BasePort1 = j ^ 0x300; |
@@ -464,7 +459,6 @@ static int tc574_config(struct pcmcia_device *link) | |||
464 | } | 459 | } |
465 | } | 460 | } |
466 | 461 | ||
467 | link->state &= ~DEV_CONFIG_PENDING; | ||
468 | link->dev_node = &lp->node; | 462 | link->dev_node = &lp->node; |
469 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 463 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
470 | 464 | ||
@@ -509,7 +503,7 @@ static int tc574_suspend(struct pcmcia_device *link) | |||
509 | { | 503 | { |
510 | struct net_device *dev = link->priv; | 504 | struct net_device *dev = link->priv; |
511 | 505 | ||
512 | if ((link->state & DEV_CONFIG) && (link->open)) | 506 | if (link->open) |
513 | netif_device_detach(dev); | 507 | netif_device_detach(dev); |
514 | 508 | ||
515 | return 0; | 509 | return 0; |
@@ -519,7 +513,7 @@ static int tc574_resume(struct pcmcia_device *link) | |||
519 | { | 513 | { |
520 | struct net_device *dev = link->priv; | 514 | struct net_device *dev = link->priv; |
521 | 515 | ||
522 | if ((link->state & DEV_CONFIG) && (link->open)) { | 516 | if (link->open) { |
523 | tc574_reset(dev); | 517 | tc574_reset(dev); |
524 | netif_device_attach(dev); | 518 | netif_device_attach(dev); |
525 | } | 519 | } |
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 160d48a8ed88..3d05f66e9c70 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c | |||
@@ -211,7 +211,6 @@ static int tc589_probe(struct pcmcia_device *link) | |||
211 | #endif | 211 | #endif |
212 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | 212 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); |
213 | 213 | ||
214 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
215 | return tc589_config(link); | 214 | return tc589_config(link); |
216 | } /* tc589_attach */ | 215 | } /* tc589_attach */ |
217 | 216 | ||
@@ -233,8 +232,7 @@ static void tc589_detach(struct pcmcia_device *link) | |||
233 | if (link->dev_node) | 232 | if (link->dev_node) |
234 | unregister_netdev(dev); | 233 | unregister_netdev(dev); |
235 | 234 | ||
236 | if (link->state & DEV_CONFIG) | 235 | tc589_release(link); |
237 | tc589_release(link); | ||
238 | 236 | ||
239 | free_netdev(dev); | 237 | free_netdev(dev); |
240 | } /* tc589_detach */ | 238 | } /* tc589_detach */ |
@@ -285,9 +283,6 @@ static int tc589_config(struct pcmcia_device *link) | |||
285 | "3Com card??\n"); | 283 | "3Com card??\n"); |
286 | multi = (le16_to_cpu(buf[1]) == PRODID_3COM_3C562); | 284 | multi = (le16_to_cpu(buf[1]) == PRODID_3COM_3C562); |
287 | } | 285 | } |
288 | |||
289 | /* Configure card */ | ||
290 | link->state |= DEV_CONFIG; | ||
291 | 286 | ||
292 | /* For the 3c562, the base address must be xx00-xx7f */ | 287 | /* For the 3c562, the base address must be xx00-xx7f */ |
293 | link->io.IOAddrLines = 16; | 288 | link->io.IOAddrLines = 16; |
@@ -338,7 +333,6 @@ static int tc589_config(struct pcmcia_device *link) | |||
338 | printk(KERN_ERR "3c589_cs: invalid if_port requested\n"); | 333 | printk(KERN_ERR "3c589_cs: invalid if_port requested\n"); |
339 | 334 | ||
340 | link->dev_node = &lp->node; | 335 | link->dev_node = &lp->node; |
341 | link->state &= ~DEV_CONFIG_PENDING; | ||
342 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 336 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
343 | 337 | ||
344 | if (register_netdev(dev) != 0) { | 338 | if (register_netdev(dev) != 0) { |
@@ -383,7 +377,7 @@ static int tc589_suspend(struct pcmcia_device *link) | |||
383 | { | 377 | { |
384 | struct net_device *dev = link->priv; | 378 | struct net_device *dev = link->priv; |
385 | 379 | ||
386 | if ((link->state & DEV_CONFIG) && (link->open)) | 380 | if (link->open) |
387 | netif_device_detach(dev); | 381 | netif_device_detach(dev); |
388 | 382 | ||
389 | return 0; | 383 | return 0; |
@@ -393,7 +387,7 @@ static int tc589_resume(struct pcmcia_device *link) | |||
393 | { | 387 | { |
394 | struct net_device *dev = link->priv; | 388 | struct net_device *dev = link->priv; |
395 | 389 | ||
396 | if ((link->state & DEV_CONFIG) && (link->open)) { | 390 | if (link->open) { |
397 | tc589_reset(dev); | 391 | tc589_reset(dev); |
398 | netif_device_attach(dev); | 392 | netif_device_attach(dev); |
399 | } | 393 | } |
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index f6ca85d77c7d..0f1219c11853 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c | |||
@@ -168,7 +168,6 @@ static int axnet_probe(struct pcmcia_device *link) | |||
168 | dev->do_ioctl = &axnet_ioctl; | 168 | dev->do_ioctl = &axnet_ioctl; |
169 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | 169 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); |
170 | 170 | ||
171 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
172 | return axnet_config(link); | 171 | return axnet_config(link); |
173 | } /* axnet_attach */ | 172 | } /* axnet_attach */ |
174 | 173 | ||
@@ -190,8 +189,7 @@ static void axnet_detach(struct pcmcia_device *link) | |||
190 | if (link->dev_node) | 189 | if (link->dev_node) |
191 | unregister_netdev(dev); | 190 | unregister_netdev(dev); |
192 | 191 | ||
193 | if (link->state & DEV_CONFIG) | 192 | axnet_release(link); |
194 | axnet_release(link); | ||
195 | 193 | ||
196 | free_netdev(dev); | 194 | free_netdev(dev); |
197 | } /* axnet_detach */ | 195 | } /* axnet_detach */ |
@@ -309,9 +307,6 @@ static int axnet_config(struct pcmcia_device *link) | |||
309 | /* don't trust the CIS on this; Linksys got it wrong */ | 307 | /* don't trust the CIS on this; Linksys got it wrong */ |
310 | link->conf.Present = 0x63; | 308 | link->conf.Present = 0x63; |
311 | 309 | ||
312 | /* Configure card */ | ||
313 | link->state |= DEV_CONFIG; | ||
314 | |||
315 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 310 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
316 | tuple.Attributes = 0; | 311 | tuple.Attributes = 0; |
317 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 312 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
@@ -402,7 +397,6 @@ static int axnet_config(struct pcmcia_device *link) | |||
402 | 397 | ||
403 | info->phy_id = (i < 32) ? i : -1; | 398 | info->phy_id = (i < 32) ? i : -1; |
404 | link->dev_node = &info->node; | 399 | link->dev_node = &info->node; |
405 | link->state &= ~DEV_CONFIG_PENDING; | ||
406 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 400 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
407 | 401 | ||
408 | if (register_netdev(dev) != 0) { | 402 | if (register_netdev(dev) != 0) { |
@@ -429,7 +423,6 @@ cs_failed: | |||
429 | cs_error(link, last_fn, last_ret); | 423 | cs_error(link, last_fn, last_ret); |
430 | failed: | 424 | failed: |
431 | axnet_release(link); | 425 | axnet_release(link); |
432 | link->state &= ~DEV_CONFIG_PENDING; | ||
433 | return -ENODEV; | 426 | return -ENODEV; |
434 | } /* axnet_config */ | 427 | } /* axnet_config */ |
435 | 428 | ||
@@ -450,8 +443,8 @@ static int axnet_suspend(struct pcmcia_device *link) | |||
450 | { | 443 | { |
451 | struct net_device *dev = link->priv; | 444 | struct net_device *dev = link->priv; |
452 | 445 | ||
453 | if ((link->state & DEV_CONFIG) && (link->open)) | 446 | if (link->open) |
454 | netif_device_detach(dev); | 447 | netif_device_detach(dev); |
455 | 448 | ||
456 | return 0; | 449 | return 0; |
457 | } | 450 | } |
@@ -460,7 +453,7 @@ static int axnet_resume(struct pcmcia_device *link) | |||
460 | { | 453 | { |
461 | struct net_device *dev = link->priv; | 454 | struct net_device *dev = link->priv; |
462 | 455 | ||
463 | if ((link->state & DEV_CONFIG) && (link->open)) { | 456 | if (link->open) { |
464 | axnet_reset_8390(dev); | 457 | axnet_reset_8390(dev); |
465 | AX88190_init(dev, 1); | 458 | AX88190_init(dev, 1); |
466 | netif_device_attach(dev); | 459 | netif_device_attach(dev); |
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index a7d675bc6051..441de824ab6b 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c | |||
@@ -178,7 +178,6 @@ static int com20020_probe(struct pcmcia_device *p_dev) | |||
178 | p_dev->irq.Instance = info->dev = dev; | 178 | p_dev->irq.Instance = info->dev = dev; |
179 | p_dev->priv = info; | 179 | p_dev->priv = info; |
180 | 180 | ||
181 | p_dev->state |= DEV_PRESENT; | ||
182 | return com20020_config(p_dev); | 181 | return com20020_config(p_dev); |
183 | 182 | ||
184 | fail_alloc_dev: | 183 | fail_alloc_dev: |
@@ -218,8 +217,7 @@ static void com20020_detach(struct pcmcia_device *link) | |||
218 | free_irq(dev->irq, dev); | 217 | free_irq(dev->irq, dev); |
219 | } | 218 | } |
220 | 219 | ||
221 | if (link->state & DEV_CONFIG) | 220 | com20020_release(link); |
222 | com20020_release(link); | ||
223 | 221 | ||
224 | /* Unlink device structure, free bits */ | 222 | /* Unlink device structure, free bits */ |
225 | DEBUG(1,"unlinking...\n"); | 223 | DEBUG(1,"unlinking...\n"); |
@@ -276,9 +274,6 @@ static int com20020_config(struct pcmcia_device *link) | |||
276 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | 274 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
277 | link->conf.ConfigBase = parse.config.base; | 275 | link->conf.ConfigBase = parse.config.base; |
278 | 276 | ||
279 | /* Configure card */ | ||
280 | link->state |= DEV_CONFIG; | ||
281 | |||
282 | DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1); | 277 | DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1); |
283 | i = !CS_SUCCESS; | 278 | i = !CS_SUCCESS; |
284 | if (!link->io.BasePort1) | 279 | if (!link->io.BasePort1) |
@@ -328,7 +323,6 @@ static int com20020_config(struct pcmcia_device *link) | |||
328 | lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */ | 323 | lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */ |
329 | 324 | ||
330 | link->dev_node = &info->node; | 325 | link->dev_node = &info->node; |
331 | link->state &= ~DEV_CONFIG_PENDING; | ||
332 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 326 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
333 | 327 | ||
334 | i = com20020_found(dev, 0); /* calls register_netdev */ | 328 | i = com20020_found(dev, 0); /* calls register_netdev */ |
@@ -372,7 +366,7 @@ static int com20020_suspend(struct pcmcia_device *link) | |||
372 | com20020_dev_t *info = link->priv; | 366 | com20020_dev_t *info = link->priv; |
373 | struct net_device *dev = info->dev; | 367 | struct net_device *dev = info->dev; |
374 | 368 | ||
375 | if ((link->state & DEV_CONFIG) && (link->open)) | 369 | if (link->open) |
376 | netif_device_detach(dev); | 370 | netif_device_detach(dev); |
377 | 371 | ||
378 | return 0; | 372 | return 0; |
@@ -383,7 +377,7 @@ static int com20020_resume(struct pcmcia_device *link) | |||
383 | com20020_dev_t *info = link->priv; | 377 | com20020_dev_t *info = link->priv; |
384 | struct net_device *dev = info->dev; | 378 | struct net_device *dev = info->dev; |
385 | 379 | ||
386 | if ((link->state & DEV_CONFIG) && (link->open)) { | 380 | if (link->open) { |
387 | int ioaddr = dev->base_addr; | 381 | int ioaddr = dev->base_addr; |
388 | struct arcnet_local *lp = dev->priv; | 382 | struct arcnet_local *lp = dev->priv; |
389 | ARCRESET; | 383 | ARCRESET; |
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index d9c83b290095..7cb20b6b9348 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c | |||
@@ -272,7 +272,6 @@ static int fmvj18x_probe(struct pcmcia_device *link) | |||
272 | #endif | 272 | #endif |
273 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | 273 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); |
274 | 274 | ||
275 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
276 | return fmvj18x_config(link); | 275 | return fmvj18x_config(link); |
277 | } /* fmvj18x_attach */ | 276 | } /* fmvj18x_attach */ |
278 | 277 | ||
@@ -287,8 +286,7 @@ static void fmvj18x_detach(struct pcmcia_device *link) | |||
287 | if (link->dev_node) | 286 | if (link->dev_node) |
288 | unregister_netdev(dev); | 287 | unregister_netdev(dev); |
289 | 288 | ||
290 | if (link->state & DEV_CONFIG) | 289 | fmvj18x_release(link); |
291 | fmvj18x_release(link); | ||
292 | 290 | ||
293 | free_netdev(dev); | 291 | free_netdev(dev); |
294 | } /* fmvj18x_detach */ | 292 | } /* fmvj18x_detach */ |
@@ -363,9 +361,6 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
363 | tuple.TupleOffset = 0; | 361 | tuple.TupleOffset = 0; |
364 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | 362 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
365 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | 363 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
366 | |||
367 | /* Configure card */ | ||
368 | link->state |= DEV_CONFIG; | ||
369 | 364 | ||
370 | link->conf.ConfigBase = parse.config.base; | 365 | link->conf.ConfigBase = parse.config.base; |
371 | link->conf.Present = parse.config.rmask[0]; | 366 | link->conf.Present = parse.config.rmask[0]; |
@@ -532,7 +527,6 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
532 | 527 | ||
533 | lp->cardtype = cardtype; | 528 | lp->cardtype = cardtype; |
534 | link->dev_node = &lp->node; | 529 | link->dev_node = &lp->node; |
535 | link->state &= ~DEV_CONFIG_PENDING; | ||
536 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 530 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
537 | 531 | ||
538 | if (register_netdev(dev) != 0) { | 532 | if (register_netdev(dev) != 0) { |
@@ -557,7 +551,6 @@ cs_failed: | |||
557 | cs_error(link, last_fn, last_ret); | 551 | cs_error(link, last_fn, last_ret); |
558 | failed: | 552 | failed: |
559 | fmvj18x_release(link); | 553 | fmvj18x_release(link); |
560 | link->state &= ~DEV_CONFIG_PENDING; | ||
561 | return -ENODEV; | 554 | return -ENODEV; |
562 | } /* fmvj18x_config */ | 555 | } /* fmvj18x_config */ |
563 | /*====================================================================*/ | 556 | /*====================================================================*/ |
@@ -668,7 +661,7 @@ static int fmvj18x_suspend(struct pcmcia_device *link) | |||
668 | { | 661 | { |
669 | struct net_device *dev = link->priv; | 662 | struct net_device *dev = link->priv; |
670 | 663 | ||
671 | if ((link->state & DEV_CONFIG) && (link->open)) | 664 | if (link->open) |
672 | netif_device_detach(dev); | 665 | netif_device_detach(dev); |
673 | 666 | ||
674 | return 0; | 667 | return 0; |
@@ -678,7 +671,7 @@ static int fmvj18x_resume(struct pcmcia_device *link) | |||
678 | { | 671 | { |
679 | struct net_device *dev = link->priv; | 672 | struct net_device *dev = link->priv; |
680 | 673 | ||
681 | if ((link->state & DEV_CONFIG) && (link->open)) { | 674 | if (link->open) { |
682 | fjn_reset(dev); | 675 | fjn_reset(dev); |
683 | netif_device_attach(dev); | 676 | netif_device_attach(dev); |
684 | } | 677 | } |
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index e038d9278a59..b8fe70b85641 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c | |||
@@ -173,7 +173,6 @@ static int ibmtr_attach(struct pcmcia_device *link) | |||
173 | 173 | ||
174 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | 174 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); |
175 | 175 | ||
176 | link->state |= DEV_PRESENT; | ||
177 | return ibmtr_config(link); | 176 | return ibmtr_config(link); |
178 | } /* ibmtr_attach */ | 177 | } /* ibmtr_attach */ |
179 | 178 | ||
@@ -200,8 +199,8 @@ static void ibmtr_detach(struct pcmcia_device *link) | |||
200 | struct tok_info *ti = netdev_priv(dev); | 199 | struct tok_info *ti = netdev_priv(dev); |
201 | del_timer_sync(&(ti->tr_timer)); | 200 | del_timer_sync(&(ti->tr_timer)); |
202 | } | 201 | } |
203 | if (link->state & DEV_CONFIG) | 202 | |
204 | ibmtr_release(link); | 203 | ibmtr_release(link); |
205 | 204 | ||
206 | free_netdev(dev); | 205 | free_netdev(dev); |
207 | kfree(info); | 206 | kfree(info); |
@@ -241,10 +240,6 @@ static int ibmtr_config(struct pcmcia_device *link) | |||
241 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | 240 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
242 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | 241 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
243 | link->conf.ConfigBase = parse.config.base; | 242 | link->conf.ConfigBase = parse.config.base; |
244 | |||
245 | /* Configure card */ | ||
246 | link->state |= DEV_CONFIG; | ||
247 | |||
248 | link->conf.ConfigIndex = 0x61; | 243 | link->conf.ConfigIndex = 0x61; |
249 | 244 | ||
250 | /* Determine if this is PRIMARY or ALTERNATE. */ | 245 | /* Determine if this is PRIMARY or ALTERNATE. */ |
@@ -301,7 +296,6 @@ static int ibmtr_config(struct pcmcia_device *link) | |||
301 | ibmtr_hw_setup(dev, mmiobase); | 296 | ibmtr_hw_setup(dev, mmiobase); |
302 | 297 | ||
303 | link->dev_node = &info->node; | 298 | link->dev_node = &info->node; |
304 | link->state &= ~DEV_CONFIG_PENDING; | ||
305 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 299 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
306 | 300 | ||
307 | i = ibmtr_probe_card(dev); | 301 | i = ibmtr_probe_card(dev); |
@@ -358,7 +352,7 @@ static int ibmtr_suspend(struct pcmcia_device *link) | |||
358 | ibmtr_dev_t *info = link->priv; | 352 | ibmtr_dev_t *info = link->priv; |
359 | struct net_device *dev = info->dev; | 353 | struct net_device *dev = info->dev; |
360 | 354 | ||
361 | if ((link->state & DEV_CONFIG) && (link->open)) | 355 | if (link->open) |
362 | netif_device_detach(dev); | 356 | netif_device_detach(dev); |
363 | 357 | ||
364 | return 0; | 358 | return 0; |
@@ -369,7 +363,7 @@ static int ibmtr_resume(struct pcmcia_device *link) | |||
369 | ibmtr_dev_t *info = link->priv; | 363 | ibmtr_dev_t *info = link->priv; |
370 | struct net_device *dev = info->dev; | 364 | struct net_device *dev = info->dev; |
371 | 365 | ||
372 | if ((link->state & DEV_CONFIG) && (link->open)) { | 366 | if (link->open) { |
373 | ibmtr_probe(dev); /* really? */ | 367 | ibmtr_probe(dev); /* really? */ |
374 | netif_device_attach(dev); | 368 | netif_device_attach(dev); |
375 | } | 369 | } |
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index ea8a62e629a4..fd191143cb2f 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c | |||
@@ -487,7 +487,6 @@ static int nmclan_probe(struct pcmcia_device *link) | |||
487 | dev->watchdog_timeo = TX_TIMEOUT; | 487 | dev->watchdog_timeo = TX_TIMEOUT; |
488 | #endif | 488 | #endif |
489 | 489 | ||
490 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
491 | return nmclan_config(link); | 490 | return nmclan_config(link); |
492 | } /* nmclan_attach */ | 491 | } /* nmclan_attach */ |
493 | 492 | ||
@@ -508,8 +507,7 @@ static void nmclan_detach(struct pcmcia_device *link) | |||
508 | if (link->dev_node) | 507 | if (link->dev_node) |
509 | unregister_netdev(dev); | 508 | unregister_netdev(dev); |
510 | 509 | ||
511 | if (link->state & DEV_CONFIG) | 510 | nmclan_release(link); |
512 | nmclan_release(link); | ||
513 | 511 | ||
514 | free_netdev(dev); | 512 | free_netdev(dev); |
515 | } /* nmclan_detach */ | 513 | } /* nmclan_detach */ |
@@ -675,9 +673,6 @@ static int nmclan_config(struct pcmcia_device *link) | |||
675 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | 673 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
676 | link->conf.ConfigBase = parse.config.base; | 674 | link->conf.ConfigBase = parse.config.base; |
677 | 675 | ||
678 | /* Configure card */ | ||
679 | link->state |= DEV_CONFIG; | ||
680 | |||
681 | CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); | 676 | CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); |
682 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 677 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); |
683 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 678 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
@@ -707,7 +702,6 @@ static int nmclan_config(struct pcmcia_device *link) | |||
707 | } else { | 702 | } else { |
708 | printk(KERN_NOTICE "nmclan_cs: mace id not found: %x %x should" | 703 | printk(KERN_NOTICE "nmclan_cs: mace id not found: %x %x should" |
709 | " be 0x40 0x?9\n", sig[0], sig[1]); | 704 | " be 0x40 0x?9\n", sig[0], sig[1]); |
710 | link->state &= ~DEV_CONFIG_PENDING; | ||
711 | return -ENODEV; | 705 | return -ENODEV; |
712 | } | 706 | } |
713 | } | 707 | } |
@@ -722,7 +716,6 @@ static int nmclan_config(struct pcmcia_device *link) | |||
722 | printk(KERN_NOTICE "nmclan_cs: invalid if_port requested\n"); | 716 | printk(KERN_NOTICE "nmclan_cs: invalid if_port requested\n"); |
723 | 717 | ||
724 | link->dev_node = &lp->node; | 718 | link->dev_node = &lp->node; |
725 | link->state &= ~DEV_CONFIG_PENDING; | ||
726 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 719 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
727 | 720 | ||
728 | i = register_netdev(dev); | 721 | i = register_netdev(dev); |
@@ -763,7 +756,7 @@ static int nmclan_suspend(struct pcmcia_device *link) | |||
763 | { | 756 | { |
764 | struct net_device *dev = link->priv; | 757 | struct net_device *dev = link->priv; |
765 | 758 | ||
766 | if ((link->state & DEV_CONFIG) && (link->open)) | 759 | if (link->open) |
767 | netif_device_detach(dev); | 760 | netif_device_detach(dev); |
768 | 761 | ||
769 | return 0; | 762 | return 0; |
@@ -773,7 +766,7 @@ static int nmclan_resume(struct pcmcia_device *link) | |||
773 | { | 766 | { |
774 | struct net_device *dev = link->priv; | 767 | struct net_device *dev = link->priv; |
775 | 768 | ||
776 | if ((link->state & DEV_CONFIG) && (link->open)) { | 769 | if (link->open) { |
777 | nmclan_reset(dev); | 770 | nmclan_reset(dev); |
778 | netif_device_attach(dev); | 771 | netif_device_attach(dev); |
779 | } | 772 | } |
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index d840c0f03ea9..d9661410f2ff 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -264,7 +264,6 @@ static int pcnet_probe(struct pcmcia_device *link) | |||
264 | dev->stop = &pcnet_close; | 264 | dev->stop = &pcnet_close; |
265 | dev->set_config = &set_config; | 265 | dev->set_config = &set_config; |
266 | 266 | ||
267 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
268 | return pcnet_config(link); | 267 | return pcnet_config(link); |
269 | } /* pcnet_attach */ | 268 | } /* pcnet_attach */ |
270 | 269 | ||
@@ -286,8 +285,7 @@ static void pcnet_detach(struct pcmcia_device *link) | |||
286 | if (link->dev_node) | 285 | if (link->dev_node) |
287 | unregister_netdev(dev); | 286 | unregister_netdev(dev); |
288 | 287 | ||
289 | if (link->state & DEV_CONFIG) | 288 | pcnet_release(link); |
290 | pcnet_release(link); | ||
291 | 289 | ||
292 | free_netdev(dev); | 290 | free_netdev(dev); |
293 | } /* pcnet_detach */ | 291 | } /* pcnet_detach */ |
@@ -538,9 +536,6 @@ static int pcnet_config(struct pcmcia_device *link) | |||
538 | link->conf.ConfigBase = parse.config.base; | 536 | link->conf.ConfigBase = parse.config.base; |
539 | link->conf.Present = parse.config.rmask[0]; | 537 | link->conf.Present = parse.config.rmask[0]; |
540 | 538 | ||
541 | /* Configure card */ | ||
542 | link->state |= DEV_CONFIG; | ||
543 | |||
544 | tuple.DesiredTuple = CISTPL_MANFID; | 539 | tuple.DesiredTuple = CISTPL_MANFID; |
545 | tuple.Attributes = TUPLE_RETURN_COMMON; | 540 | tuple.Attributes = TUPLE_RETURN_COMMON; |
546 | if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) && | 541 | if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) && |
@@ -667,7 +662,6 @@ static int pcnet_config(struct pcmcia_device *link) | |||
667 | } | 662 | } |
668 | 663 | ||
669 | link->dev_node = &info->node; | 664 | link->dev_node = &info->node; |
670 | link->state &= ~DEV_CONFIG_PENDING; | ||
671 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 665 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
672 | 666 | ||
673 | #ifdef CONFIG_NET_POLL_CONTROLLER | 667 | #ifdef CONFIG_NET_POLL_CONTROLLER |
@@ -705,7 +699,6 @@ cs_failed: | |||
705 | cs_error(link, last_fn, last_ret); | 699 | cs_error(link, last_fn, last_ret); |
706 | failed: | 700 | failed: |
707 | pcnet_release(link); | 701 | pcnet_release(link); |
708 | link->state &= ~DEV_CONFIG_PENDING; | ||
709 | return -ENODEV; | 702 | return -ENODEV; |
710 | } /* pcnet_config */ | 703 | } /* pcnet_config */ |
711 | 704 | ||
@@ -742,7 +735,7 @@ static int pcnet_suspend(struct pcmcia_device *link) | |||
742 | { | 735 | { |
743 | struct net_device *dev = link->priv; | 736 | struct net_device *dev = link->priv; |
744 | 737 | ||
745 | if ((link->state & DEV_CONFIG) && (link->open)) | 738 | if (link->open) |
746 | netif_device_detach(dev); | 739 | netif_device_detach(dev); |
747 | 740 | ||
748 | return 0; | 741 | return 0; |
@@ -752,7 +745,7 @@ static int pcnet_resume(struct pcmcia_device *link) | |||
752 | { | 745 | { |
753 | struct net_device *dev = link->priv; | 746 | struct net_device *dev = link->priv; |
754 | 747 | ||
755 | if ((link->state & DEV_CONFIG) && (link->open)) { | 748 | if (link->open) { |
756 | pcnet_reset_8390(dev); | 749 | pcnet_reset_8390(dev); |
757 | NS8390_init(dev, 1); | 750 | NS8390_init(dev, 1); |
758 | netif_device_attach(dev); | 751 | netif_device_attach(dev); |
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 3252c1dc9ee7..7d565f26a3bf 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
@@ -356,7 +356,6 @@ static int smc91c92_probe(struct pcmcia_device *link) | |||
356 | smc->mii_if.phy_id_mask = 0x1f; | 356 | smc->mii_if.phy_id_mask = 0x1f; |
357 | smc->mii_if.reg_num_mask = 0x1f; | 357 | smc->mii_if.reg_num_mask = 0x1f; |
358 | 358 | ||
359 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
360 | return smc91c92_config(link); | 359 | return smc91c92_config(link); |
361 | } /* smc91c92_attach */ | 360 | } /* smc91c92_attach */ |
362 | 361 | ||
@@ -378,8 +377,7 @@ static void smc91c92_detach(struct pcmcia_device *link) | |||
378 | if (link->dev_node) | 377 | if (link->dev_node) |
379 | unregister_netdev(dev); | 378 | unregister_netdev(dev); |
380 | 379 | ||
381 | if (link->state & DEV_CONFIG) | 380 | smc91c92_release(link); |
382 | smc91c92_release(link); | ||
383 | 381 | ||
384 | free_netdev(dev); | 382 | free_netdev(dev); |
385 | } /* smc91c92_detach */ | 383 | } /* smc91c92_detach */ |
@@ -862,7 +860,7 @@ static int smc91c92_suspend(struct pcmcia_device *link) | |||
862 | { | 860 | { |
863 | struct net_device *dev = link->priv; | 861 | struct net_device *dev = link->priv; |
864 | 862 | ||
865 | if ((link->state & DEV_CONFIG) && (link->open)) | 863 | if (link->open) |
866 | netif_device_detach(dev); | 864 | netif_device_detach(dev); |
867 | 865 | ||
868 | return 0; | 866 | return 0; |
@@ -874,33 +872,31 @@ static int smc91c92_resume(struct pcmcia_device *link) | |||
874 | struct smc_private *smc = netdev_priv(dev); | 872 | struct smc_private *smc = netdev_priv(dev); |
875 | int i; | 873 | int i; |
876 | 874 | ||
877 | if (link->state & DEV_CONFIG) { | 875 | if ((smc->manfid == MANFID_MEGAHERTZ) && |
878 | if ((smc->manfid == MANFID_MEGAHERTZ) && | 876 | (smc->cardid == PRODID_MEGAHERTZ_EM3288)) |
879 | (smc->cardid == PRODID_MEGAHERTZ_EM3288)) | 877 | mhz_3288_power(link); |
880 | mhz_3288_power(link); | 878 | if (smc->manfid == MANFID_MOTOROLA) |
881 | if (smc->manfid == MANFID_MOTOROLA) | 879 | mot_config(link); |
882 | mot_config(link); | 880 | if ((smc->manfid == MANFID_OSITECH) && |
883 | if ((smc->manfid == MANFID_OSITECH) && | 881 | (smc->cardid != PRODID_OSITECH_SEVEN)) { |
884 | (smc->cardid != PRODID_OSITECH_SEVEN)) { | 882 | /* Power up the card and enable interrupts */ |
885 | /* Power up the card and enable interrupts */ | 883 | set_bits(0x0300, dev->base_addr-0x10+OSITECH_AUI_PWR); |
886 | set_bits(0x0300, dev->base_addr-0x10+OSITECH_AUI_PWR); | 884 | set_bits(0x0300, dev->base_addr-0x10+OSITECH_RESET_ISR); |
887 | set_bits(0x0300, dev->base_addr-0x10+OSITECH_RESET_ISR); | 885 | } |
888 | } | 886 | if (((smc->manfid == MANFID_OSITECH) && |
889 | if (((smc->manfid == MANFID_OSITECH) && | 887 | (smc->cardid == PRODID_OSITECH_SEVEN)) || |
890 | (smc->cardid == PRODID_OSITECH_SEVEN)) || | 888 | ((smc->manfid == MANFID_PSION) && |
891 | ((smc->manfid == MANFID_PSION) && | 889 | (smc->cardid == PRODID_PSION_NET100))) { |
892 | (smc->cardid == PRODID_PSION_NET100))) { | 890 | /* Download the Seven of Diamonds firmware */ |
893 | /* Download the Seven of Diamonds firmware */ | 891 | for (i = 0; i < sizeof(__Xilinx7OD); i++) { |
894 | for (i = 0; i < sizeof(__Xilinx7OD); i++) { | 892 | outb(__Xilinx7OD[i], link->io.BasePort1+2); |
895 | outb(__Xilinx7OD[i], link->io.BasePort1+2); | 893 | udelay(50); |
896 | udelay(50); | ||
897 | } | ||
898 | } | ||
899 | if (link->open) { | ||
900 | smc_reset(dev); | ||
901 | netif_device_attach(dev); | ||
902 | } | 894 | } |
903 | } | 895 | } |
896 | if (link->open) { | ||
897 | smc_reset(dev); | ||
898 | netif_device_attach(dev); | ||
899 | } | ||
904 | 900 | ||
905 | return 0; | 901 | return 0; |
906 | } | 902 | } |
@@ -1010,9 +1006,6 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
1010 | smc->cardid = parse->manfid.card; | 1006 | smc->cardid = parse->manfid.card; |
1011 | } | 1007 | } |
1012 | 1008 | ||
1013 | /* Configure card */ | ||
1014 | link->state |= DEV_CONFIG; | ||
1015 | |||
1016 | if ((smc->manfid == MANFID_OSITECH) && | 1009 | if ((smc->manfid == MANFID_OSITECH) && |
1017 | (smc->cardid != PRODID_OSITECH_SEVEN)) { | 1010 | (smc->cardid != PRODID_OSITECH_SEVEN)) { |
1018 | i = osi_config(link); | 1011 | i = osi_config(link); |
@@ -1108,7 +1101,6 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
1108 | } | 1101 | } |
1109 | 1102 | ||
1110 | link->dev_node = &smc->node; | 1103 | link->dev_node = &smc->node; |
1111 | link->state &= ~DEV_CONFIG_PENDING; | ||
1112 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 1104 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
1113 | 1105 | ||
1114 | if (register_netdev(dev) != 0) { | 1106 | if (register_netdev(dev) != 0) { |
@@ -1149,7 +1141,6 @@ config_undo: | |||
1149 | unregister_netdev(dev); | 1141 | unregister_netdev(dev); |
1150 | config_failed: /* CS_EXIT_TEST() calls jump to here... */ | 1142 | config_failed: /* CS_EXIT_TEST() calls jump to here... */ |
1151 | smc91c92_release(link); | 1143 | smc91c92_release(link); |
1152 | link->state &= ~DEV_CONFIG_PENDING; | ||
1153 | kfree(cfg_mem); | 1144 | kfree(cfg_mem); |
1154 | return -ENODEV; | 1145 | return -ENODEV; |
1155 | } /* smc91c92_config */ | 1146 | } /* smc91c92_config */ |
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index 77bf4e3a6139..0141c5037f41 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c | |||
@@ -591,7 +591,6 @@ xirc2ps_probe(struct pcmcia_device *link) | |||
591 | dev->watchdog_timeo = TX_TIMEOUT; | 591 | dev->watchdog_timeo = TX_TIMEOUT; |
592 | #endif | 592 | #endif |
593 | 593 | ||
594 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
595 | return xirc2ps_config(link); | 594 | return xirc2ps_config(link); |
596 | } /* xirc2ps_attach */ | 595 | } /* xirc2ps_attach */ |
597 | 596 | ||
@@ -612,8 +611,7 @@ xirc2ps_detach(struct pcmcia_device *link) | |||
612 | if (link->dev_node) | 611 | if (link->dev_node) |
613 | unregister_netdev(dev); | 612 | unregister_netdev(dev); |
614 | 613 | ||
615 | if (link->state & DEV_CONFIG) | 614 | xirc2ps_release(link); |
616 | xirc2ps_release(link); | ||
617 | 615 | ||
618 | free_netdev(dev); | 616 | free_netdev(dev); |
619 | } /* xirc2ps_detach */ | 617 | } /* xirc2ps_detach */ |
@@ -843,9 +841,6 @@ xirc2ps_config(struct pcmcia_device * link) | |||
843 | for (i=0; i < 6; i++) | 841 | for (i=0; i < 6; i++) |
844 | dev->dev_addr[i] = node_id->id[i]; | 842 | dev->dev_addr[i] = node_id->id[i]; |
845 | 843 | ||
846 | /* Configure card */ | ||
847 | link->state |= DEV_CONFIG; | ||
848 | |||
849 | link->io.IOAddrLines =10; | 844 | link->io.IOAddrLines =10; |
850 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 845 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; |
851 | link->irq.Attributes = IRQ_HANDLE_PRESENT; | 846 | link->irq.Attributes = IRQ_HANDLE_PRESENT; |
@@ -1041,7 +1036,6 @@ xirc2ps_config(struct pcmcia_device * link) | |||
1041 | do_reset(dev, 1); /* a kludge to make the cem56 work */ | 1036 | do_reset(dev, 1); /* a kludge to make the cem56 work */ |
1042 | 1037 | ||
1043 | link->dev_node = &local->node; | 1038 | link->dev_node = &local->node; |
1044 | link->state &= ~DEV_CONFIG_PENDING; | ||
1045 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 1039 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
1046 | 1040 | ||
1047 | if ((err=register_netdev(dev))) { | 1041 | if ((err=register_netdev(dev))) { |
@@ -1062,14 +1056,12 @@ xirc2ps_config(struct pcmcia_device * link) | |||
1062 | return 0; | 1056 | return 0; |
1063 | 1057 | ||
1064 | config_error: | 1058 | config_error: |
1065 | link->state &= ~DEV_CONFIG_PENDING; | ||
1066 | xirc2ps_release(link); | 1059 | xirc2ps_release(link); |
1067 | return -ENODEV; | 1060 | return -ENODEV; |
1068 | 1061 | ||
1069 | cis_error: | 1062 | cis_error: |
1070 | printk(KNOT_XIRC "unable to parse CIS\n"); | 1063 | printk(KNOT_XIRC "unable to parse CIS\n"); |
1071 | failure: | 1064 | failure: |
1072 | link->state &= ~DEV_CONFIG_PENDING; | ||
1073 | return -ENODEV; | 1065 | return -ENODEV; |
1074 | } /* xirc2ps_config */ | 1066 | } /* xirc2ps_config */ |
1075 | 1067 | ||
@@ -1099,9 +1091,9 @@ static int xirc2ps_suspend(struct pcmcia_device *link) | |||
1099 | { | 1091 | { |
1100 | struct net_device *dev = link->priv; | 1092 | struct net_device *dev = link->priv; |
1101 | 1093 | ||
1102 | if ((link->state & DEV_CONFIG) && (link->open)) { | 1094 | if (link->open) { |
1103 | netif_device_detach(dev); | 1095 | netif_device_detach(dev); |
1104 | do_powerdown(dev); | 1096 | do_powerdown(dev); |
1105 | } | 1097 | } |
1106 | 1098 | ||
1107 | return 0; | 1099 | return 0; |
@@ -1111,7 +1103,7 @@ static int xirc2ps_resume(struct pcmcia_device *link) | |||
1111 | { | 1103 | { |
1112 | struct net_device *dev = link->priv; | 1104 | struct net_device *dev = link->priv; |
1113 | 1105 | ||
1114 | if ((link->state & DEV_CONFIG) && (link->open)) { | 1106 | if (link->open) { |
1115 | do_reset(dev,1); | 1107 | do_reset(dev,1); |
1116 | netif_device_attach(dev); | 1108 | netif_device_attach(dev); |
1117 | } | 1109 | } |
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 97f41565fca8..af0cbb6c5c0c 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c | |||
@@ -170,7 +170,6 @@ static int airo_probe(struct pcmcia_device *p_dev) | |||
170 | } | 170 | } |
171 | p_dev->priv = local; | 171 | p_dev->priv = local; |
172 | 172 | ||
173 | p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
174 | return airo_config(p_dev); | 173 | return airo_config(p_dev); |
175 | } /* airo_attach */ | 174 | } /* airo_attach */ |
176 | 175 | ||
@@ -187,8 +186,7 @@ static void airo_detach(struct pcmcia_device *link) | |||
187 | { | 186 | { |
188 | DEBUG(0, "airo_detach(0x%p)\n", link); | 187 | DEBUG(0, "airo_detach(0x%p)\n", link); |
189 | 188 | ||
190 | if (link->state & DEV_CONFIG) | 189 | airo_release(link); |
191 | airo_release(link); | ||
192 | 190 | ||
193 | if ( ((local_info_t*)link->priv)->eth_dev ) { | 191 | if ( ((local_info_t*)link->priv)->eth_dev ) { |
194 | stop_airo_card( ((local_info_t*)link->priv)->eth_dev, 0 ); | 192 | stop_airo_card( ((local_info_t*)link->priv)->eth_dev, 0 ); |
@@ -237,10 +235,7 @@ static int airo_config(struct pcmcia_device *link) | |||
237 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | 235 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
238 | link->conf.ConfigBase = parse.config.base; | 236 | link->conf.ConfigBase = parse.config.base; |
239 | link->conf.Present = parse.config.rmask[0]; | 237 | link->conf.Present = parse.config.rmask[0]; |
240 | 238 | ||
241 | /* Configure card */ | ||
242 | link->state |= DEV_CONFIG; | ||
243 | |||
244 | /* | 239 | /* |
245 | In this loop, we scan the CIS for configuration table entries, | 240 | In this loop, we scan the CIS for configuration table entries, |
246 | each of which describes a valid card configuration, including | 241 | each of which describes a valid card configuration, including |
@@ -382,8 +377,6 @@ static int airo_config(struct pcmcia_device *link) | |||
382 | printk(", mem 0x%06lx-0x%06lx", req.Base, | 377 | printk(", mem 0x%06lx-0x%06lx", req.Base, |
383 | req.Base+req.Size-1); | 378 | req.Base+req.Size-1); |
384 | printk("\n"); | 379 | printk("\n"); |
385 | |||
386 | link->state &= ~DEV_CONFIG_PENDING; | ||
387 | return 0; | 380 | return 0; |
388 | 381 | ||
389 | cs_failed: | 382 | cs_failed: |
@@ -410,8 +403,7 @@ static int airo_suspend(struct pcmcia_device *link) | |||
410 | { | 403 | { |
411 | local_info_t *local = link->priv; | 404 | local_info_t *local = link->priv; |
412 | 405 | ||
413 | if (link->state & DEV_CONFIG) | 406 | netif_device_detach(local->eth_dev); |
414 | netif_device_detach(local->eth_dev); | ||
415 | 407 | ||
416 | return 0; | 408 | return 0; |
417 | } | 409 | } |
@@ -420,7 +412,7 @@ static int airo_resume(struct pcmcia_device *link) | |||
420 | { | 412 | { |
421 | local_info_t *local = link->priv; | 413 | local_info_t *local = link->priv; |
422 | 414 | ||
423 | if ((link->state & DEV_CONFIG) && (link->open)) { | 415 | if (link->open) { |
424 | reset_airo_card(local->eth_dev); | 416 | reset_airo_card(local->eth_dev); |
425 | netif_device_attach(local->eth_dev); | 417 | netif_device_attach(local->eth_dev); |
426 | } | 418 | } |
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index d09b1472e673..25fb919b3791 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c | |||
@@ -181,7 +181,6 @@ static int atmel_probe(struct pcmcia_device *p_dev) | |||
181 | } | 181 | } |
182 | p_dev->priv = local; | 182 | p_dev->priv = local; |
183 | 183 | ||
184 | p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
185 | return atmel_config(p_dev); | 184 | return atmel_config(p_dev); |
186 | } /* atmel_attach */ | 185 | } /* atmel_attach */ |
187 | 186 | ||
@@ -198,8 +197,7 @@ static void atmel_detach(struct pcmcia_device *link) | |||
198 | { | 197 | { |
199 | DEBUG(0, "atmel_detach(0x%p)\n", link); | 198 | DEBUG(0, "atmel_detach(0x%p)\n", link); |
200 | 199 | ||
201 | if (link->state & DEV_CONFIG) | 200 | atmel_release(link); |
202 | atmel_release(link); | ||
203 | 201 | ||
204 | kfree(link->priv); | 202 | kfree(link->priv); |
205 | } | 203 | } |
@@ -222,7 +220,7 @@ static int card_present(void *arg) | |||
222 | struct pcmcia_device *link = (struct pcmcia_device *)arg; | 220 | struct pcmcia_device *link = (struct pcmcia_device *)arg; |
223 | if (link->suspended) | 221 | if (link->suspended) |
224 | return 0; | 222 | return 0; |
225 | else if (link->state & DEV_PRESENT) | 223 | else if (pcmcia_dev_present(link)) |
226 | return 1; | 224 | return 1; |
227 | 225 | ||
228 | return 0; | 226 | return 0; |
@@ -257,10 +255,7 @@ static int atmel_config(struct pcmcia_device *link) | |||
257 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | 255 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
258 | link->conf.ConfigBase = parse.config.base; | 256 | link->conf.ConfigBase = parse.config.base; |
259 | link->conf.Present = parse.config.rmask[0]; | 257 | link->conf.Present = parse.config.rmask[0]; |
260 | 258 | ||
261 | /* Configure card */ | ||
262 | link->state |= DEV_CONFIG; | ||
263 | |||
264 | /* | 259 | /* |
265 | In this loop, we scan the CIS for configuration table entries, | 260 | In this loop, we scan the CIS for configuration table entries, |
266 | each of which describes a valid card configuration, including | 261 | each of which describes a valid card configuration, including |
@@ -373,10 +368,9 @@ static int atmel_config(struct pcmcia_device *link) | |||
373 | strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name ); | 368 | strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name ); |
374 | dev->node.major = dev->node.minor = 0; | 369 | dev->node.major = dev->node.minor = 0; |
375 | link->dev_node = &dev->node; | 370 | link->dev_node = &dev->node; |
376 | 371 | ||
377 | link->state &= ~DEV_CONFIG_PENDING; | ||
378 | return 0; | 372 | return 0; |
379 | 373 | ||
380 | cs_failed: | 374 | cs_failed: |
381 | cs_error(link, last_fn, last_ret); | 375 | cs_error(link, last_fn, last_ret); |
382 | atmel_release(link); | 376 | atmel_release(link); |
@@ -408,8 +402,7 @@ static int atmel_suspend(struct pcmcia_device *link) | |||
408 | { | 402 | { |
409 | local_info_t *local = link->priv; | 403 | local_info_t *local = link->priv; |
410 | 404 | ||
411 | if (link->state & DEV_CONFIG) | 405 | netif_device_detach(local->eth_dev); |
412 | netif_device_detach(local->eth_dev); | ||
413 | 406 | ||
414 | return 0; | 407 | return 0; |
415 | } | 408 | } |
@@ -418,10 +411,8 @@ static int atmel_resume(struct pcmcia_device *link) | |||
418 | { | 411 | { |
419 | local_info_t *local = link->priv; | 412 | local_info_t *local = link->priv; |
420 | 413 | ||
421 | if (link->state & DEV_CONFIG) { | 414 | atmel_open(local->eth_dev); |
422 | atmel_open(local->eth_dev); | 415 | netif_device_attach(local->eth_dev); |
423 | netif_device_attach(local->eth_dev); | ||
424 | } | ||
425 | 416 | ||
426 | return 0; | 417 | return 0; |
427 | } | 418 | } |
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index 88dc383a3da7..a2cb9b0fa3d6 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -210,9 +210,7 @@ static int prism2_config(struct pcmcia_device *link); | |||
210 | static int prism2_pccard_card_present(local_info_t *local) | 210 | static int prism2_pccard_card_present(local_info_t *local) |
211 | { | 211 | { |
212 | struct hostap_cs_priv *hw_priv = local->hw_priv; | 212 | struct hostap_cs_priv *hw_priv = local->hw_priv; |
213 | if (hw_priv != NULL && hw_priv->link != NULL && | 213 | if (hw_priv != NULL && hw_priv->link != NULL && DEV_OK(hw_priv->link)) |
214 | ((hw_priv->link->state & (DEV_PRESENT | DEV_CONFIG)) == | ||
215 | (DEV_PRESENT | DEV_CONFIG))) | ||
216 | return 1; | 214 | return 1; |
217 | return 0; | 215 | return 0; |
218 | } | 216 | } |
@@ -508,7 +506,6 @@ static int hostap_cs_probe(struct pcmcia_device *p_dev) | |||
508 | PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info); | 506 | PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info); |
509 | p_dev->conf.IntType = INT_MEMORY_AND_IO; | 507 | p_dev->conf.IntType = INT_MEMORY_AND_IO; |
510 | 508 | ||
511 | p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
512 | ret = prism2_config(p_dev); | 509 | ret = prism2_config(p_dev); |
513 | if (ret) { | 510 | if (ret) { |
514 | PDEBUG(DEBUG_EXTRA, "prism2_config() failed\n"); | 511 | PDEBUG(DEBUG_EXTRA, "prism2_config() failed\n"); |
@@ -522,9 +519,7 @@ static void prism2_detach(struct pcmcia_device *link) | |||
522 | { | 519 | { |
523 | PDEBUG(DEBUG_FLOW, "prism2_detach\n"); | 520 | PDEBUG(DEBUG_FLOW, "prism2_detach\n"); |
524 | 521 | ||
525 | if (link->state & DEV_CONFIG) { | 522 | prism2_release((u_long)link); |
526 | prism2_release((u_long)link); | ||
527 | } | ||
528 | 523 | ||
529 | /* release net devices */ | 524 | /* release net devices */ |
530 | if (link->priv) { | 525 | if (link->priv) { |
@@ -746,9 +741,6 @@ static int prism2_config(struct pcmcia_device *link) | |||
746 | link->io.BasePort2+link->io.NumPorts2-1); | 741 | link->io.BasePort2+link->io.NumPorts2-1); |
747 | printk("\n"); | 742 | printk("\n"); |
748 | 743 | ||
749 | link->state |= DEV_CONFIG; | ||
750 | link->state &= ~DEV_CONFIG_PENDING; | ||
751 | |||
752 | local->shutdown = 0; | 744 | local->shutdown = 0; |
753 | 745 | ||
754 | sandisk_enable_wireless(dev); | 746 | sandisk_enable_wireless(dev); |
@@ -784,8 +776,7 @@ static void prism2_release(u_long arg) | |||
784 | struct hostap_interface *iface; | 776 | struct hostap_interface *iface; |
785 | 777 | ||
786 | iface = netdev_priv(dev); | 778 | iface = netdev_priv(dev); |
787 | if (link->state & DEV_CONFIG) | 779 | prism2_hw_shutdown(dev, 0); |
788 | prism2_hw_shutdown(dev, 0); | ||
789 | iface->local->shutdown = 1; | 780 | iface->local->shutdown = 1; |
790 | } | 781 | } |
791 | 782 | ||
@@ -797,19 +788,19 @@ static int hostap_cs_suspend(struct pcmcia_device *link) | |||
797 | { | 788 | { |
798 | struct net_device *dev = (struct net_device *) link->priv; | 789 | struct net_device *dev = (struct net_device *) link->priv; |
799 | int dev_open = 0; | 790 | int dev_open = 0; |
791 | struct hostap_interface *iface = NULL; | ||
800 | 792 | ||
801 | PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_SUSPEND\n", dev_info); | 793 | if (dev) |
794 | iface = netdev_priv(dev); | ||
802 | 795 | ||
803 | if (link->state & DEV_CONFIG) { | 796 | PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_SUSPEND\n", dev_info); |
804 | struct hostap_interface *iface = netdev_priv(dev); | 797 | if (iface && iface->local) |
805 | if (iface && iface->local) | 798 | dev_open = iface->local->num_dev_open > 0; |
806 | dev_open = iface->local->num_dev_open > 0; | 799 | if (dev_open) { |
807 | if (dev_open) { | 800 | netif_stop_queue(dev); |
808 | netif_stop_queue(dev); | 801 | netif_device_detach(dev); |
809 | netif_device_detach(dev); | ||
810 | } | ||
811 | prism2_suspend(dev); | ||
812 | } | 802 | } |
803 | prism2_suspend(dev); | ||
813 | 804 | ||
814 | return 0; | 805 | return 0; |
815 | } | 806 | } |
@@ -818,20 +809,21 @@ static int hostap_cs_resume(struct pcmcia_device *link) | |||
818 | { | 809 | { |
819 | struct net_device *dev = (struct net_device *) link->priv; | 810 | struct net_device *dev = (struct net_device *) link->priv; |
820 | int dev_open = 0; | 811 | int dev_open = 0; |
812 | struct hostap_interface *iface = NULL; | ||
813 | |||
814 | if (dev) | ||
815 | iface = netdev_priv(dev); | ||
821 | 816 | ||
822 | PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_RESUME\n", dev_info); | 817 | PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_RESUME\n", dev_info); |
823 | 818 | ||
824 | if (link->state & DEV_CONFIG) { | 819 | if (iface && iface->local) |
825 | struct hostap_interface *iface = netdev_priv(dev); | 820 | dev_open = iface->local->num_dev_open > 0; |
826 | if (iface && iface->local) | ||
827 | dev_open = iface->local->num_dev_open > 0; | ||
828 | 821 | ||
829 | prism2_hw_shutdown(dev, 1); | 822 | prism2_hw_shutdown(dev, 1); |
830 | prism2_hw_config(dev, dev_open ? 0 : 1); | 823 | prism2_hw_config(dev, dev_open ? 0 : 1); |
831 | if (dev_open) { | 824 | if (dev_open) { |
832 | netif_device_attach(dev); | 825 | netif_device_attach(dev); |
833 | netif_start_queue(dev); | 826 | netif_start_queue(dev); |
834 | } | ||
835 | } | 827 | } |
836 | 828 | ||
837 | return 0; | 829 | return 0; |
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c index 2689f3bbc889..fbc8595cde39 100644 --- a/drivers/net/wireless/netwave_cs.c +++ b/drivers/net/wireless/netwave_cs.c | |||
@@ -428,7 +428,6 @@ static int netwave_probe(struct pcmcia_device *link) | |||
428 | dev->stop = &netwave_close; | 428 | dev->stop = &netwave_close; |
429 | link->irq.Instance = dev; | 429 | link->irq.Instance = dev; |
430 | 430 | ||
431 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
432 | return netwave_pcmcia_config( link); | 431 | return netwave_pcmcia_config( link); |
433 | } /* netwave_attach */ | 432 | } /* netwave_attach */ |
434 | 433 | ||
@@ -446,8 +445,7 @@ static void netwave_detach(struct pcmcia_device *link) | |||
446 | 445 | ||
447 | DEBUG(0, "netwave_detach(0x%p)\n", link); | 446 | DEBUG(0, "netwave_detach(0x%p)\n", link); |
448 | 447 | ||
449 | if (link->state & DEV_CONFIG) | 448 | netwave_release(link); |
450 | netwave_release(link); | ||
451 | 449 | ||
452 | if (link->dev_node) | 450 | if (link->dev_node) |
453 | unregister_netdev(dev); | 451 | unregister_netdev(dev); |
@@ -763,9 +761,6 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) { | |||
763 | link->conf.ConfigBase = parse.config.base; | 761 | link->conf.ConfigBase = parse.config.base; |
764 | link->conf.Present = parse.config.rmask[0]; | 762 | link->conf.Present = parse.config.rmask[0]; |
765 | 763 | ||
766 | /* Configure card */ | ||
767 | link->state |= DEV_CONFIG; | ||
768 | |||
769 | /* | 764 | /* |
770 | * Try allocating IO ports. This tries a few fixed addresses. | 765 | * Try allocating IO ports. This tries a few fixed addresses. |
771 | * If you want, you can also read the card's config table to | 766 | * If you want, you can also read the card's config table to |
@@ -823,7 +818,6 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) { | |||
823 | 818 | ||
824 | strcpy(priv->node.dev_name, dev->name); | 819 | strcpy(priv->node.dev_name, dev->name); |
825 | link->dev_node = &priv->node; | 820 | link->dev_node = &priv->node; |
826 | link->state &= ~DEV_CONFIG_PENDING; | ||
827 | 821 | ||
828 | /* Reset card before reading physical address */ | 822 | /* Reset card before reading physical address */ |
829 | netwave_doreset(dev->base_addr, ramBase); | 823 | netwave_doreset(dev->base_addr, ramBase); |
@@ -875,7 +869,7 @@ static int netwave_suspend(struct pcmcia_device *link) | |||
875 | { | 869 | { |
876 | struct net_device *dev = link->priv; | 870 | struct net_device *dev = link->priv; |
877 | 871 | ||
878 | if ((link->state & DEV_CONFIG) && (link->open)) | 872 | if (link->open) |
879 | netif_device_detach(dev); | 873 | netif_device_detach(dev); |
880 | 874 | ||
881 | return 0; | 875 | return 0; |
@@ -885,7 +879,7 @@ static int netwave_resume(struct pcmcia_device *link) | |||
885 | { | 879 | { |
886 | struct net_device *dev = link->priv; | 880 | struct net_device *dev = link->priv; |
887 | 881 | ||
888 | if ((link->state & DEV_CONFIG) && (link->open)) { | 882 | if (link->open) { |
889 | netwave_reset(dev); | 883 | netwave_reset(dev); |
890 | netif_device_attach(dev); | 884 | netif_device_attach(dev); |
891 | } | 885 | } |
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index 0e92bee16c9b..434f7d7ad841 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c | |||
@@ -134,7 +134,6 @@ orinoco_cs_probe(struct pcmcia_device *link) | |||
134 | link->conf.Attributes = 0; | 134 | link->conf.Attributes = 0; |
135 | link->conf.IntType = INT_MEMORY_AND_IO; | 135 | link->conf.IntType = INT_MEMORY_AND_IO; |
136 | 136 | ||
137 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
138 | return orinoco_cs_config(link); | 137 | return orinoco_cs_config(link); |
139 | } /* orinoco_cs_attach */ | 138 | } /* orinoco_cs_attach */ |
140 | 139 | ||
@@ -148,8 +147,7 @@ static void orinoco_cs_detach(struct pcmcia_device *link) | |||
148 | { | 147 | { |
149 | struct net_device *dev = link->priv; | 148 | struct net_device *dev = link->priv; |
150 | 149 | ||
151 | if (link->state & DEV_CONFIG) | 150 | orinoco_cs_release(link); |
152 | orinoco_cs_release(link); | ||
153 | 151 | ||
154 | DEBUG(0, PFX "detach: link=%p link->dev_node=%p\n", link, link->dev_node); | 152 | DEBUG(0, PFX "detach: link=%p link->dev_node=%p\n", link, link->dev_node); |
155 | if (link->dev_node) { | 153 | if (link->dev_node) { |
@@ -202,9 +200,6 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
202 | link->conf.ConfigBase = parse.config.base; | 200 | link->conf.ConfigBase = parse.config.base; |
203 | link->conf.Present = parse.config.rmask[0]; | 201 | link->conf.Present = parse.config.rmask[0]; |
204 | 202 | ||
205 | /* Configure card */ | ||
206 | link->state |= DEV_CONFIG; | ||
207 | |||
208 | /* Look up the current Vcc */ | 203 | /* Look up the current Vcc */ |
209 | CS_CHECK(GetConfigurationInfo, | 204 | CS_CHECK(GetConfigurationInfo, |
210 | pcmcia_get_configuration_info(link, &conf)); | 205 | pcmcia_get_configuration_info(link, &conf)); |
@@ -358,7 +353,6 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
358 | link->dev_node = &card->node; /* link->dev_node being non-NULL is also | 353 | link->dev_node = &card->node; /* link->dev_node being non-NULL is also |
359 | used to indicate that the | 354 | used to indicate that the |
360 | net_device has been registered */ | 355 | net_device has been registered */ |
361 | link->state &= ~DEV_CONFIG_PENDING; | ||
362 | 356 | ||
363 | /* Finally, report what we've done */ | 357 | /* Finally, report what we've done */ |
364 | printk(KERN_DEBUG "%s: index 0x%02x: ", | 358 | printk(KERN_DEBUG "%s: index 0x%02x: ", |
@@ -416,23 +410,21 @@ static int orinoco_cs_suspend(struct pcmcia_device *link) | |||
416 | int err = 0; | 410 | int err = 0; |
417 | unsigned long flags; | 411 | unsigned long flags; |
418 | 412 | ||
419 | if (link->state & DEV_CONFIG) { | 413 | /* This is probably racy, but I can't think of |
420 | /* This is probably racy, but I can't think of | 414 | a better way, short of rewriting the PCMCIA |
421 | a better way, short of rewriting the PCMCIA | 415 | layer to not suck :-( */ |
422 | layer to not suck :-( */ | 416 | if (! test_bit(0, &card->hard_reset_in_progress)) { |
423 | if (! test_bit(0, &card->hard_reset_in_progress)) { | 417 | spin_lock_irqsave(&priv->lock, flags); |
424 | spin_lock_irqsave(&priv->lock, flags); | ||
425 | 418 | ||
426 | err = __orinoco_down(dev); | 419 | err = __orinoco_down(dev); |
427 | if (err) | 420 | if (err) |
428 | printk(KERN_WARNING "%s: Error %d downing interface\n", | 421 | printk(KERN_WARNING "%s: Error %d downing interface\n", |
429 | dev->name, err); | 422 | dev->name, err); |
430 | 423 | ||
431 | netif_device_detach(dev); | 424 | netif_device_detach(dev); |
432 | priv->hw_unavailable++; | 425 | priv->hw_unavailable++; |
433 | 426 | ||
434 | spin_unlock_irqrestore(&priv->lock, flags); | 427 | spin_unlock_irqrestore(&priv->lock, flags); |
435 | } | ||
436 | } | 428 | } |
437 | 429 | ||
438 | return 0; | 430 | return 0; |
@@ -446,29 +438,27 @@ static int orinoco_cs_resume(struct pcmcia_device *link) | |||
446 | int err = 0; | 438 | int err = 0; |
447 | unsigned long flags; | 439 | unsigned long flags; |
448 | 440 | ||
449 | if (link->state & DEV_CONFIG) { | 441 | if (! test_bit(0, &card->hard_reset_in_progress)) { |
450 | if (! test_bit(0, &card->hard_reset_in_progress)) { | 442 | err = orinoco_reinit_firmware(dev); |
451 | err = orinoco_reinit_firmware(dev); | 443 | if (err) { |
452 | if (err) { | 444 | printk(KERN_ERR "%s: Error %d re-initializing firmware\n", |
453 | printk(KERN_ERR "%s: Error %d re-initializing firmware\n", | 445 | dev->name, err); |
454 | dev->name, err); | 446 | return -EIO; |
455 | return -EIO; | 447 | } |
456 | } | ||
457 | |||
458 | spin_lock_irqsave(&priv->lock, flags); | ||
459 | 448 | ||
460 | netif_device_attach(dev); | 449 | spin_lock_irqsave(&priv->lock, flags); |
461 | priv->hw_unavailable--; | ||
462 | 450 | ||
463 | if (priv->open && ! priv->hw_unavailable) { | 451 | netif_device_attach(dev); |
464 | err = __orinoco_up(dev); | 452 | priv->hw_unavailable--; |
465 | if (err) | ||
466 | printk(KERN_ERR "%s: Error %d restarting card\n", | ||
467 | dev->name, err); | ||
468 | } | ||
469 | 453 | ||
470 | spin_unlock_irqrestore(&priv->lock, flags); | 454 | if (priv->open && ! priv->hw_unavailable) { |
455 | err = __orinoco_up(dev); | ||
456 | if (err) | ||
457 | printk(KERN_ERR "%s: Error %d restarting card\n", | ||
458 | dev->name, err); | ||
471 | } | 459 | } |
460 | |||
461 | spin_unlock_irqrestore(&priv->lock, flags); | ||
472 | } | 462 | } |
473 | 463 | ||
474 | return 0; | 464 | return 0; |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index e3924339fabe..85712ffb842a 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -366,7 +366,6 @@ static int ray_probe(struct pcmcia_device *p_dev) | |||
366 | 366 | ||
367 | init_timer(&local->timer); | 367 | init_timer(&local->timer); |
368 | 368 | ||
369 | p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
370 | this_device = p_dev; | 369 | this_device = p_dev; |
371 | return ray_config(p_dev); | 370 | return ray_config(p_dev); |
372 | 371 | ||
@@ -389,12 +388,10 @@ static void ray_detach(struct pcmcia_device *link) | |||
389 | this_device = NULL; | 388 | this_device = NULL; |
390 | dev = link->priv; | 389 | dev = link->priv; |
391 | 390 | ||
392 | if (link->state & DEV_CONFIG) { | 391 | ray_release(link); |
393 | ray_release(link); | ||
394 | 392 | ||
395 | local = (ray_dev_t *)dev->priv; | 393 | local = (ray_dev_t *)dev->priv; |
396 | del_timer(&local->timer); | 394 | del_timer(&local->timer); |
397 | } | ||
398 | 395 | ||
399 | if (link->priv) { | 396 | if (link->priv) { |
400 | if (link->dev_node) unregister_netdev(dev); | 397 | if (link->dev_node) unregister_netdev(dev); |
@@ -448,9 +445,6 @@ static int ray_config(struct pcmcia_device *link) | |||
448 | if (buf[i] == 0) buf[i] = ' '; | 445 | if (buf[i] == 0) buf[i] = ' '; |
449 | printk(KERN_INFO "ray_cs Detected: %s\n",buf); | 446 | printk(KERN_INFO "ray_cs Detected: %s\n",buf); |
450 | 447 | ||
451 | /* Configure card */ | ||
452 | link->state |= DEV_CONFIG; | ||
453 | |||
454 | /* Now allocate an interrupt line. Note that this does not | 448 | /* Now allocate an interrupt line. Note that this does not |
455 | actually assign a handler to the interrupt. | 449 | actually assign a handler to the interrupt. |
456 | */ | 450 | */ |
@@ -511,7 +505,6 @@ static int ray_config(struct pcmcia_device *link) | |||
511 | strcpy(local->node.dev_name, dev->name); | 505 | strcpy(local->node.dev_name, dev->name); |
512 | link->dev_node = &local->node; | 506 | link->dev_node = &local->node; |
513 | 507 | ||
514 | link->state &= ~DEV_CONFIG_PENDING; | ||
515 | printk(KERN_INFO "%s: RayLink, irq %d, hw_addr ", | 508 | printk(KERN_INFO "%s: RayLink, irq %d, hw_addr ", |
516 | dev->name, dev->irq); | 509 | dev->name, dev->irq); |
517 | for (i = 0; i < 6; i++) | 510 | for (i = 0; i < 6; i++) |
@@ -552,7 +545,7 @@ static int ray_init(struct net_device *dev) | |||
552 | ray_dev_t *local = (ray_dev_t *)dev->priv; | 545 | ray_dev_t *local = (ray_dev_t *)dev->priv; |
553 | struct pcmcia_device *link = local->finder; | 546 | struct pcmcia_device *link = local->finder; |
554 | DEBUG(1, "ray_init(0x%p)\n", dev); | 547 | DEBUG(1, "ray_init(0x%p)\n", dev); |
555 | if (!(link->state & DEV_PRESENT)) { | 548 | if (!(pcmcia_dev_present(link))) { |
556 | DEBUG(0,"ray_init - device not present\n"); | 549 | DEBUG(0,"ray_init - device not present\n"); |
557 | return -1; | 550 | return -1; |
558 | } | 551 | } |
@@ -615,7 +608,7 @@ static int dl_startup_params(struct net_device *dev) | |||
615 | struct pcmcia_device *link = local->finder; | 608 | struct pcmcia_device *link = local->finder; |
616 | 609 | ||
617 | DEBUG(1,"dl_startup_params entered\n"); | 610 | DEBUG(1,"dl_startup_params entered\n"); |
618 | if (!(link->state & DEV_PRESENT)) { | 611 | if (!(pcmcia_dev_present(link))) { |
619 | DEBUG(2,"ray_cs dl_startup_params - device not present\n"); | 612 | DEBUG(2,"ray_cs dl_startup_params - device not present\n"); |
620 | return -1; | 613 | return -1; |
621 | } | 614 | } |
@@ -721,7 +714,7 @@ static void verify_dl_startup(u_long data) | |||
721 | UCHAR status; | 714 | UCHAR status; |
722 | struct pcmcia_device *link = local->finder; | 715 | struct pcmcia_device *link = local->finder; |
723 | 716 | ||
724 | if (!(link->state & DEV_PRESENT)) { | 717 | if (!(pcmcia_dev_present(link))) { |
725 | DEBUG(2,"ray_cs verify_dl_startup - device not present\n"); | 718 | DEBUG(2,"ray_cs verify_dl_startup - device not present\n"); |
726 | return; | 719 | return; |
727 | } | 720 | } |
@@ -760,7 +753,7 @@ static void start_net(u_long data) | |||
760 | struct ccs __iomem *pccs; | 753 | struct ccs __iomem *pccs; |
761 | int ccsindex; | 754 | int ccsindex; |
762 | struct pcmcia_device *link = local->finder; | 755 | struct pcmcia_device *link = local->finder; |
763 | if (!(link->state & DEV_PRESENT)) { | 756 | if (!(pcmcia_dev_present(link))) { |
764 | DEBUG(2,"ray_cs start_net - device not present\n"); | 757 | DEBUG(2,"ray_cs start_net - device not present\n"); |
765 | return; | 758 | return; |
766 | } | 759 | } |
@@ -788,7 +781,7 @@ static void join_net(u_long data) | |||
788 | int ccsindex; | 781 | int ccsindex; |
789 | struct pcmcia_device *link = local->finder; | 782 | struct pcmcia_device *link = local->finder; |
790 | 783 | ||
791 | if (!(link->state & DEV_PRESENT)) { | 784 | if (!(pcmcia_dev_present(link))) { |
792 | DEBUG(2,"ray_cs join_net - device not present\n"); | 785 | DEBUG(2,"ray_cs join_net - device not present\n"); |
793 | return; | 786 | return; |
794 | } | 787 | } |
@@ -839,7 +832,7 @@ static int ray_suspend(struct pcmcia_device *link) | |||
839 | { | 832 | { |
840 | struct net_device *dev = link->priv; | 833 | struct net_device *dev = link->priv; |
841 | 834 | ||
842 | if ((link->state & DEV_CONFIG) && (link->open)) | 835 | if (link->open) |
843 | netif_device_detach(dev); | 836 | netif_device_detach(dev); |
844 | 837 | ||
845 | return 0; | 838 | return 0; |
@@ -849,7 +842,7 @@ static int ray_resume(struct pcmcia_device *link) | |||
849 | { | 842 | { |
850 | struct net_device *dev = link->priv; | 843 | struct net_device *dev = link->priv; |
851 | 844 | ||
852 | if ((link->state & DEV_CONFIG) && (link->open)) { | 845 | if (link->open) { |
853 | ray_reset(dev); | 846 | ray_reset(dev); |
854 | netif_device_attach(dev); | 847 | netif_device_attach(dev); |
855 | } | 848 | } |
@@ -867,7 +860,7 @@ int ray_dev_init(struct net_device *dev) | |||
867 | struct pcmcia_device *link = local->finder; | 860 | struct pcmcia_device *link = local->finder; |
868 | 861 | ||
869 | DEBUG(1,"ray_dev_init(dev=%p)\n",dev); | 862 | DEBUG(1,"ray_dev_init(dev=%p)\n",dev); |
870 | if (!(link->state & DEV_PRESENT)) { | 863 | if (!(pcmcia_dev_present(link))) { |
871 | DEBUG(2,"ray_dev_init - device not present\n"); | 864 | DEBUG(2,"ray_dev_init - device not present\n"); |
872 | return -1; | 865 | return -1; |
873 | } | 866 | } |
@@ -901,7 +894,7 @@ static int ray_dev_config(struct net_device *dev, struct ifmap *map) | |||
901 | struct pcmcia_device *link = local->finder; | 894 | struct pcmcia_device *link = local->finder; |
902 | /* Dummy routine to satisfy device structure */ | 895 | /* Dummy routine to satisfy device structure */ |
903 | DEBUG(1,"ray_dev_config(dev=%p,ifmap=%p)\n",dev,map); | 896 | DEBUG(1,"ray_dev_config(dev=%p,ifmap=%p)\n",dev,map); |
904 | if (!(link->state & DEV_PRESENT)) { | 897 | if (!(pcmcia_dev_present(link))) { |
905 | DEBUG(2,"ray_dev_config - device not present\n"); | 898 | DEBUG(2,"ray_dev_config - device not present\n"); |
906 | return -1; | 899 | return -1; |
907 | } | 900 | } |
@@ -915,7 +908,7 @@ static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
915 | struct pcmcia_device *link = local->finder; | 908 | struct pcmcia_device *link = local->finder; |
916 | short length = skb->len; | 909 | short length = skb->len; |
917 | 910 | ||
918 | if (!(link->state & DEV_PRESENT)) { | 911 | if (!(pcmcia_dev_present(link))) { |
919 | DEBUG(2,"ray_dev_start_xmit - device not present\n"); | 912 | DEBUG(2,"ray_dev_start_xmit - device not present\n"); |
920 | return -1; | 913 | return -1; |
921 | } | 914 | } |
@@ -1542,7 +1535,7 @@ static iw_stats * ray_get_wireless_stats(struct net_device * dev) | |||
1542 | } | 1535 | } |
1543 | #endif /* WIRELESS_SPY */ | 1536 | #endif /* WIRELESS_SPY */ |
1544 | 1537 | ||
1545 | if((link->state & DEV_PRESENT)) { | 1538 | if(pcmcia_dev_present(link)) { |
1546 | local->wstats.qual.noise = readb(&p->rxnoise); | 1539 | local->wstats.qual.noise = readb(&p->rxnoise); |
1547 | local->wstats.qual.updated |= 4; | 1540 | local->wstats.qual.updated |= 4; |
1548 | } | 1541 | } |
@@ -1674,7 +1667,7 @@ static int interrupt_ecf(ray_dev_t *local, int ccs) | |||
1674 | int i = 50; | 1667 | int i = 50; |
1675 | struct pcmcia_device *link = local->finder; | 1668 | struct pcmcia_device *link = local->finder; |
1676 | 1669 | ||
1677 | if (!(link->state & DEV_PRESENT)) { | 1670 | if (!(pcmcia_dev_present(link))) { |
1678 | DEBUG(2,"ray_cs interrupt_ecf - device not present\n"); | 1671 | DEBUG(2,"ray_cs interrupt_ecf - device not present\n"); |
1679 | return -1; | 1672 | return -1; |
1680 | } | 1673 | } |
@@ -1701,7 +1694,7 @@ static int get_free_tx_ccs(ray_dev_t *local) | |||
1701 | struct ccs __iomem *pccs = ccs_base(local); | 1694 | struct ccs __iomem *pccs = ccs_base(local); |
1702 | struct pcmcia_device *link = local->finder; | 1695 | struct pcmcia_device *link = local->finder; |
1703 | 1696 | ||
1704 | if (!(link->state & DEV_PRESENT)) { | 1697 | if (!(pcmcia_dev_present(link))) { |
1705 | DEBUG(2,"ray_cs get_free_tx_ccs - device not present\n"); | 1698 | DEBUG(2,"ray_cs get_free_tx_ccs - device not present\n"); |
1706 | return ECARDGONE; | 1699 | return ECARDGONE; |
1707 | } | 1700 | } |
@@ -1732,7 +1725,7 @@ static int get_free_ccs(ray_dev_t *local) | |||
1732 | struct ccs __iomem *pccs = ccs_base(local); | 1725 | struct ccs __iomem *pccs = ccs_base(local); |
1733 | struct pcmcia_device *link = local->finder; | 1726 | struct pcmcia_device *link = local->finder; |
1734 | 1727 | ||
1735 | if (!(link->state & DEV_PRESENT)) { | 1728 | if (!(pcmcia_dev_present(link))) { |
1736 | DEBUG(2,"ray_cs get_free_ccs - device not present\n"); | 1729 | DEBUG(2,"ray_cs get_free_ccs - device not present\n"); |
1737 | return ECARDGONE; | 1730 | return ECARDGONE; |
1738 | } | 1731 | } |
@@ -1807,7 +1800,7 @@ static struct net_device_stats *ray_get_stats(struct net_device *dev) | |||
1807 | ray_dev_t *local = (ray_dev_t *)dev->priv; | 1800 | ray_dev_t *local = (ray_dev_t *)dev->priv; |
1808 | struct pcmcia_device *link = local->finder; | 1801 | struct pcmcia_device *link = local->finder; |
1809 | struct status __iomem *p = local->sram + STATUS_BASE; | 1802 | struct status __iomem *p = local->sram + STATUS_BASE; |
1810 | if (!(link->state & DEV_PRESENT)) { | 1803 | if (!(pcmcia_dev_present(link))) { |
1811 | DEBUG(2,"ray_cs net_device_stats - device not present\n"); | 1804 | DEBUG(2,"ray_cs net_device_stats - device not present\n"); |
1812 | return &local->stats; | 1805 | return &local->stats; |
1813 | } | 1806 | } |
@@ -1840,7 +1833,7 @@ static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, i | |||
1840 | int i; | 1833 | int i; |
1841 | struct ccs __iomem *pccs; | 1834 | struct ccs __iomem *pccs; |
1842 | 1835 | ||
1843 | if (!(link->state & DEV_PRESENT)) { | 1836 | if (!(pcmcia_dev_present(link))) { |
1844 | DEBUG(2,"ray_update_parm - device not present\n"); | 1837 | DEBUG(2,"ray_update_parm - device not present\n"); |
1845 | return; | 1838 | return; |
1846 | } | 1839 | } |
@@ -1875,7 +1868,7 @@ static void ray_update_multi_list(struct net_device *dev, int all) | |||
1875 | struct pcmcia_device *link = local->finder; | 1868 | struct pcmcia_device *link = local->finder; |
1876 | void __iomem *p = local->sram + HOST_TO_ECF_BASE; | 1869 | void __iomem *p = local->sram + HOST_TO_ECF_BASE; |
1877 | 1870 | ||
1878 | if (!(link->state & DEV_PRESENT)) { | 1871 | if (!(pcmcia_dev_present(link))) { |
1879 | DEBUG(2,"ray_update_multi_list - device not present\n"); | 1872 | DEBUG(2,"ray_update_multi_list - device not present\n"); |
1880 | return; | 1873 | return; |
1881 | } | 1874 | } |
@@ -1968,7 +1961,7 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id, struct pt_regs * regs) | |||
1968 | 1961 | ||
1969 | local = (ray_dev_t *)dev->priv; | 1962 | local = (ray_dev_t *)dev->priv; |
1970 | link = (struct pcmcia_device *)local->finder; | 1963 | link = (struct pcmcia_device *)local->finder; |
1971 | if ( ! (link->state & DEV_PRESENT) || link->suspended ) { | 1964 | if (!(pcmcia_dev_present(link)) || link->suspended ) { |
1972 | DEBUG(2,"ray_cs interrupt from device not present or suspended.\n"); | 1965 | DEBUG(2,"ray_cs interrupt from device not present or suspended.\n"); |
1973 | return IRQ_NONE; | 1966 | return IRQ_NONE; |
1974 | } | 1967 | } |
@@ -2489,7 +2482,7 @@ static void authenticate(ray_dev_t *local) | |||
2489 | { | 2482 | { |
2490 | struct pcmcia_device *link = local->finder; | 2483 | struct pcmcia_device *link = local->finder; |
2491 | DEBUG(0,"ray_cs Starting authentication.\n"); | 2484 | DEBUG(0,"ray_cs Starting authentication.\n"); |
2492 | if (!(link->state & DEV_PRESENT)) { | 2485 | if (!(pcmcia_dev_present(link))) { |
2493 | DEBUG(2,"ray_cs authenticate - device not present\n"); | 2486 | DEBUG(2,"ray_cs authenticate - device not present\n"); |
2494 | return; | 2487 | return; |
2495 | } | 2488 | } |
@@ -2556,7 +2549,7 @@ static void associate(ray_dev_t *local) | |||
2556 | struct pcmcia_device *link = local->finder; | 2549 | struct pcmcia_device *link = local->finder; |
2557 | struct net_device *dev = link->priv; | 2550 | struct net_device *dev = link->priv; |
2558 | int ccsindex; | 2551 | int ccsindex; |
2559 | if (!(link->state & DEV_PRESENT)) { | 2552 | if (!(pcmcia_dev_present(link))) { |
2560 | DEBUG(2,"ray_cs associate - device not present\n"); | 2553 | DEBUG(2,"ray_cs associate - device not present\n"); |
2561 | return; | 2554 | return; |
2562 | } | 2555 | } |
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c index 118b2c6e5a29..f7b77ce54d7b 100644 --- a/drivers/net/wireless/spectrum_cs.c +++ b/drivers/net/wireless/spectrum_cs.c | |||
@@ -245,7 +245,7 @@ spectrum_reset(struct pcmcia_device *link, int idle) | |||
245 | u_int save_cor; | 245 | u_int save_cor; |
246 | 246 | ||
247 | /* Doing it if hardware is gone is guaranteed crash */ | 247 | /* Doing it if hardware is gone is guaranteed crash */ |
248 | if (!(link->state & DEV_CONFIG)) | 248 | if (pcmcia_dev_present(link)) |
249 | return -ENODEV; | 249 | return -ENODEV; |
250 | 250 | ||
251 | /* Save original COR value */ | 251 | /* Save original COR value */ |
@@ -613,7 +613,6 @@ spectrum_cs_probe(struct pcmcia_device *link) | |||
613 | link->conf.Attributes = 0; | 613 | link->conf.Attributes = 0; |
614 | link->conf.IntType = INT_MEMORY_AND_IO; | 614 | link->conf.IntType = INT_MEMORY_AND_IO; |
615 | 615 | ||
616 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
617 | return spectrum_cs_config(link); | 616 | return spectrum_cs_config(link); |
618 | } /* spectrum_cs_attach */ | 617 | } /* spectrum_cs_attach */ |
619 | 618 | ||
@@ -627,8 +626,7 @@ static void spectrum_cs_detach(struct pcmcia_device *link) | |||
627 | { | 626 | { |
628 | struct net_device *dev = link->priv; | 627 | struct net_device *dev = link->priv; |
629 | 628 | ||
630 | if (link->state & DEV_CONFIG) | 629 | spectrum_cs_release(link); |
631 | spectrum_cs_release(link); | ||
632 | 630 | ||
633 | DEBUG(0, PFX "detach: link=%p link->dev_node=%p\n", link, link->dev_node); | 631 | DEBUG(0, PFX "detach: link=%p link->dev_node=%p\n", link, link->dev_node); |
634 | if (link->dev_node) { | 632 | if (link->dev_node) { |
@@ -677,9 +675,6 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
677 | link->conf.ConfigBase = parse.config.base; | 675 | link->conf.ConfigBase = parse.config.base; |
678 | link->conf.Present = parse.config.rmask[0]; | 676 | link->conf.Present = parse.config.rmask[0]; |
679 | 677 | ||
680 | /* Configure card */ | ||
681 | link->state |= DEV_CONFIG; | ||
682 | |||
683 | /* Look up the current Vcc */ | 678 | /* Look up the current Vcc */ |
684 | CS_CHECK(GetConfigurationInfo, | 679 | CS_CHECK(GetConfigurationInfo, |
685 | pcmcia_get_configuration_info(link, &conf)); | 680 | pcmcia_get_configuration_info(link, &conf)); |
@@ -838,7 +833,6 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
838 | link->dev_node = &card->node; /* link->dev_node being non-NULL is also | 833 | link->dev_node = &card->node; /* link->dev_node being non-NULL is also |
839 | used to indicate that the | 834 | used to indicate that the |
840 | net_device has been registered */ | 835 | net_device has been registered */ |
841 | link->state &= ~DEV_CONFIG_PENDING; | ||
842 | 836 | ||
843 | /* Finally, report what we've done */ | 837 | /* Finally, report what we've done */ |
844 | printk(KERN_DEBUG "%s: index 0x%02x: ", | 838 | printk(KERN_DEBUG "%s: index 0x%02x: ", |
@@ -898,19 +892,17 @@ spectrum_cs_suspend(struct pcmcia_device *link) | |||
898 | int err = 0; | 892 | int err = 0; |
899 | 893 | ||
900 | /* Mark the device as stopped, to block IO until later */ | 894 | /* Mark the device as stopped, to block IO until later */ |
901 | if (link->state & DEV_CONFIG) { | 895 | spin_lock_irqsave(&priv->lock, flags); |
902 | spin_lock_irqsave(&priv->lock, flags); | ||
903 | 896 | ||
904 | err = __orinoco_down(dev); | 897 | err = __orinoco_down(dev); |
905 | if (err) | 898 | if (err) |
906 | printk(KERN_WARNING "%s: Error %d downing interface\n", | 899 | printk(KERN_WARNING "%s: Error %d downing interface\n", |
907 | dev->name, err); | 900 | dev->name, err); |
908 | 901 | ||
909 | netif_device_detach(dev); | 902 | netif_device_detach(dev); |
910 | priv->hw_unavailable++; | 903 | priv->hw_unavailable++; |
911 | 904 | ||
912 | spin_unlock_irqrestore(&priv->lock, flags); | 905 | spin_unlock_irqrestore(&priv->lock, flags); |
913 | } | ||
914 | 906 | ||
915 | return 0; | 907 | return 0; |
916 | } | 908 | } |
@@ -921,11 +913,10 @@ spectrum_cs_resume(struct pcmcia_device *link) | |||
921 | struct net_device *dev = link->priv; | 913 | struct net_device *dev = link->priv; |
922 | struct orinoco_private *priv = netdev_priv(dev); | 914 | struct orinoco_private *priv = netdev_priv(dev); |
923 | 915 | ||
924 | if (link->state & DEV_CONFIG) { | 916 | netif_device_attach(dev); |
925 | netif_device_attach(dev); | 917 | priv->hw_unavailable--; |
926 | priv->hw_unavailable--; | 918 | schedule_work(&priv->reset_work); |
927 | schedule_work(&priv->reset_work); | 919 | |
928 | } | ||
929 | return 0; | 920 | return 0; |
930 | } | 921 | } |
931 | 922 | ||
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index 6b6769654777..f7724eb2fa7e 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c | |||
@@ -3983,12 +3983,9 @@ wv_pcmcia_config(struct pcmcia_device * link) | |||
3983 | if(i != CS_SUCCESS) | 3983 | if(i != CS_SUCCESS) |
3984 | { | 3984 | { |
3985 | cs_error(link, ParseTuple, i); | 3985 | cs_error(link, ParseTuple, i); |
3986 | link->state &= ~DEV_CONFIG_PENDING; | ||
3987 | return FALSE; | 3986 | return FALSE; |
3988 | } | 3987 | } |
3989 | 3988 | ||
3990 | /* Configure card */ | ||
3991 | link->state |= DEV_CONFIG; | ||
3992 | do | 3989 | do |
3993 | { | 3990 | { |
3994 | i = pcmcia_request_io(link, &link->io); | 3991 | i = pcmcia_request_io(link, &link->io); |
@@ -4071,7 +4068,6 @@ wv_pcmcia_config(struct pcmcia_device * link) | |||
4071 | } | 4068 | } |
4072 | while(0); /* Humm... Disguised goto !!! */ | 4069 | while(0); /* Humm... Disguised goto !!! */ |
4073 | 4070 | ||
4074 | link->state &= ~DEV_CONFIG_PENDING; | ||
4075 | /* If any step failed, release any partially configured state */ | 4071 | /* If any step failed, release any partially configured state */ |
4076 | if(i != 0) | 4072 | if(i != 0) |
4077 | { | 4073 | { |
@@ -4651,7 +4647,6 @@ wavelan_probe(struct pcmcia_device *p_dev) | |||
4651 | /* Other specific data */ | 4647 | /* Other specific data */ |
4652 | dev->mtu = WAVELAN_MTU; | 4648 | dev->mtu = WAVELAN_MTU; |
4653 | 4649 | ||
4654 | p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
4655 | ret = wv_pcmcia_config(p_dev); | 4650 | ret = wv_pcmcia_config(p_dev); |
4656 | if (ret) | 4651 | if (ret) |
4657 | return ret; | 4652 | return ret; |
@@ -4686,17 +4681,8 @@ wavelan_detach(struct pcmcia_device *link) | |||
4686 | printk(KERN_DEBUG "-> wavelan_detach(0x%p)\n", link); | 4681 | printk(KERN_DEBUG "-> wavelan_detach(0x%p)\n", link); |
4687 | #endif | 4682 | #endif |
4688 | 4683 | ||
4689 | /* | 4684 | /* Some others haven't done their job : give them another chance */ |
4690 | * If the device is currently configured and active, we won't | 4685 | wv_pcmcia_release(link); |
4691 | * actually delete it yet. Instead, it is marked so that when the | ||
4692 | * release() function is called, that will trigger a proper | ||
4693 | * detach(). | ||
4694 | */ | ||
4695 | if(link->state & DEV_CONFIG) | ||
4696 | { | ||
4697 | /* Some others haven't done their job : give them another chance */ | ||
4698 | wv_pcmcia_release(link); | ||
4699 | } | ||
4700 | 4686 | ||
4701 | /* Free pieces */ | 4687 | /* Free pieces */ |
4702 | if(link->priv) | 4688 | if(link->priv) |
@@ -4731,7 +4717,7 @@ static int wavelan_suspend(struct pcmcia_device *link) | |||
4731 | /* Stop receiving new messages and wait end of transmission */ | 4717 | /* Stop receiving new messages and wait end of transmission */ |
4732 | wv_ru_stop(dev); | 4718 | wv_ru_stop(dev); |
4733 | 4719 | ||
4734 | if ((link->state & DEV_CONFIG) && (link->open)) | 4720 | if (link->open) |
4735 | netif_device_detach(dev); | 4721 | netif_device_detach(dev); |
4736 | 4722 | ||
4737 | /* Power down the module */ | 4723 | /* Power down the module */ |
@@ -4744,7 +4730,7 @@ static int wavelan_resume(struct pcmcia_device *link) | |||
4744 | { | 4730 | { |
4745 | struct net_device * dev = (struct net_device *) link->priv; | 4731 | struct net_device * dev = (struct net_device *) link->priv; |
4746 | 4732 | ||
4747 | if ((link->state & DEV_CONFIG) && (link->open)) { | 4733 | if (link->open) { |
4748 | wv_hw_reset(dev); | 4734 | wv_hw_reset(dev); |
4749 | netif_device_attach(dev); | 4735 | netif_device_attach(dev); |
4750 | } | 4736 | } |
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 6b3a605897bd..b6578059de34 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c | |||
@@ -1485,13 +1485,11 @@ static void wl3501_detach(struct pcmcia_device *link) | |||
1485 | * delete it yet. Instead, it is marked so that when the release() | 1485 | * delete it yet. Instead, it is marked so that when the release() |
1486 | * function is called, that will trigger a proper detach(). */ | 1486 | * function is called, that will trigger a proper detach(). */ |
1487 | 1487 | ||
1488 | if (link->state & DEV_CONFIG) { | 1488 | while (link->open > 0) |
1489 | while (link->open > 0) | 1489 | wl3501_close(dev); |
1490 | wl3501_close(dev); | ||
1491 | 1490 | ||
1492 | netif_device_detach(dev); | 1491 | netif_device_detach(dev); |
1493 | wl3501_release(link); | 1492 | wl3501_release(link); |
1494 | } | ||
1495 | 1493 | ||
1496 | if (link->priv) | 1494 | if (link->priv) |
1497 | free_netdev(link->priv); | 1495 | free_netdev(link->priv); |
@@ -1959,7 +1957,6 @@ static int wl3501_probe(struct pcmcia_device *p_dev) | |||
1959 | netif_stop_queue(dev); | 1957 | netif_stop_queue(dev); |
1960 | p_dev->priv = p_dev->irq.Instance = dev; | 1958 | p_dev->priv = p_dev->irq.Instance = dev; |
1961 | 1959 | ||
1962 | p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
1963 | return wl3501_config(p_dev); | 1960 | return wl3501_config(p_dev); |
1964 | out_link: | 1961 | out_link: |
1965 | return -ENOMEM; | 1962 | return -ENOMEM; |
@@ -1997,9 +1994,6 @@ static int wl3501_config(struct pcmcia_device *link) | |||
1997 | link->conf.ConfigBase = parse.config.base; | 1994 | link->conf.ConfigBase = parse.config.base; |
1998 | link->conf.Present = parse.config.rmask[0]; | 1995 | link->conf.Present = parse.config.rmask[0]; |
1999 | 1996 | ||
2000 | /* Configure card */ | ||
2001 | link->state |= DEV_CONFIG; | ||
2002 | |||
2003 | /* Try allocating IO ports. This tries a few fixed addresses. If you | 1997 | /* Try allocating IO ports. This tries a few fixed addresses. If you |
2004 | * want, you can also read the card's config table to pick addresses -- | 1998 | * want, you can also read the card's config table to pick addresses -- |
2005 | * see the serial driver for an example. */ | 1999 | * see the serial driver for an example. */ |
@@ -2044,7 +2038,6 @@ static int wl3501_config(struct pcmcia_device *link) | |||
2044 | * arranged in a linked list at link->dev_node. | 2038 | * arranged in a linked list at link->dev_node. |
2045 | */ | 2039 | */ |
2046 | link->dev_node = &this->node; | 2040 | link->dev_node = &this->node; |
2047 | link->state &= ~DEV_CONFIG_PENDING; | ||
2048 | 2041 | ||
2049 | this->base_addr = dev->base_addr; | 2042 | this->base_addr = dev->base_addr; |
2050 | 2043 | ||
@@ -2113,7 +2106,7 @@ static int wl3501_suspend(struct pcmcia_device *link) | |||
2113 | struct net_device *dev = link->priv; | 2106 | struct net_device *dev = link->priv; |
2114 | 2107 | ||
2115 | wl3501_pwr_mgmt(dev->priv, WL3501_SUSPEND); | 2108 | wl3501_pwr_mgmt(dev->priv, WL3501_SUSPEND); |
2116 | if ((link->state & DEV_CONFIG) && (link->open)) | 2109 | if (link->open) |
2117 | netif_device_detach(dev); | 2110 | netif_device_detach(dev); |
2118 | 2111 | ||
2119 | return 0; | 2112 | return 0; |
@@ -2124,7 +2117,7 @@ static int wl3501_resume(struct pcmcia_device *link) | |||
2124 | struct net_device *dev = link->priv; | 2117 | struct net_device *dev = link->priv; |
2125 | 2118 | ||
2126 | wl3501_pwr_mgmt(dev->priv, WL3501_RESUME); | 2119 | wl3501_pwr_mgmt(dev->priv, WL3501_RESUME); |
2127 | if ((link->state & DEV_CONFIG) && (link->open)) { | 2120 | if (link->open) { |
2128 | wl3501_reset(dev); | 2121 | wl3501_reset(dev); |
2129 | netif_device_attach(dev); | 2122 | netif_device_attach(dev); |
2130 | } | 2123 | } |
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index e4be826c48ba..b953d5907c05 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c | |||
@@ -119,7 +119,6 @@ static int parport_probe(struct pcmcia_device *link) | |||
119 | link->conf.Attributes = CONF_ENABLE_IRQ; | 119 | link->conf.Attributes = CONF_ENABLE_IRQ; |
120 | link->conf.IntType = INT_MEMORY_AND_IO; | 120 | link->conf.IntType = INT_MEMORY_AND_IO; |
121 | 121 | ||
122 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
123 | return parport_config(link); | 122 | return parport_config(link); |
124 | } /* parport_attach */ | 123 | } /* parport_attach */ |
125 | 124 | ||
@@ -136,8 +135,7 @@ static void parport_detach(struct pcmcia_device *link) | |||
136 | { | 135 | { |
137 | DEBUG(0, "parport_detach(0x%p)\n", link); | 136 | DEBUG(0, "parport_detach(0x%p)\n", link); |
138 | 137 | ||
139 | if (link->state & DEV_CONFIG) | 138 | parport_cs_release(link); |
140 | parport_cs_release(link); | ||
141 | 139 | ||
142 | kfree(link->priv); | 140 | kfree(link->priv); |
143 | } /* parport_detach */ | 141 | } /* parport_detach */ |
@@ -175,9 +173,6 @@ static int parport_config(struct pcmcia_device *link) | |||
175 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | 173 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
176 | link->conf.ConfigBase = parse.config.base; | 174 | link->conf.ConfigBase = parse.config.base; |
177 | link->conf.Present = parse.config.rmask[0]; | 175 | link->conf.Present = parse.config.rmask[0]; |
178 | |||
179 | /* Configure card */ | ||
180 | link->state |= DEV_CONFIG; | ||
181 | 176 | ||
182 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 177 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
183 | tuple.Attributes = 0; | 178 | tuple.Attributes = 0; |
@@ -233,14 +228,12 @@ static int parport_config(struct pcmcia_device *link) | |||
233 | strcpy(info->node.dev_name, p->name); | 228 | strcpy(info->node.dev_name, p->name); |
234 | link->dev_node = &info->node; | 229 | link->dev_node = &info->node; |
235 | 230 | ||
236 | link->state &= ~DEV_CONFIG_PENDING; | ||
237 | return 0; | 231 | return 0; |
238 | 232 | ||
239 | cs_failed: | 233 | cs_failed: |
240 | cs_error(link, last_fn, last_ret); | 234 | cs_error(link, last_fn, last_ret); |
241 | failed: | 235 | failed: |
242 | parport_cs_release(link); | 236 | parport_cs_release(link); |
243 | link->state &= ~DEV_CONFIG_PENDING; | ||
244 | return -ENODEV; | 237 | return -ENODEV; |
245 | } /* parport_config */ | 238 | } /* parport_config */ |
246 | 239 | ||
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index ecc579bbaeba..d6164cd583fd 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h | |||
@@ -23,7 +23,7 @@ | |||
23 | #define CLIENT_IO_REQ 0x0004 | 23 | #define CLIENT_IO_REQ 0x0004 |
24 | #define CLIENT_UNBOUND 0x0008 | 24 | #define CLIENT_UNBOUND 0x0008 |
25 | #define CLIENT_STALE 0x0010 | 25 | #define CLIENT_STALE 0x0010 |
26 | #define CLIENT_WIN_REQ(i) (0x20<<(i)) | 26 | #define CLIENT_WIN_REQ(i) (0x1<<(i)) |
27 | #define CLIENT_CARDBUS 0x8000 | 27 | #define CLIENT_CARDBUS 0x8000 |
28 | 28 | ||
29 | #define REGION_MAGIC 0xE3C9 | 29 | #define REGION_MAGIC 0xE3C9 |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 34e634aa48e4..8c87343707cf 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -390,8 +390,6 @@ static int pcmcia_device_probe(struct device * dev) | |||
390 | goto put_dev; | 390 | goto put_dev; |
391 | } | 391 | } |
392 | 392 | ||
393 | p_dev->p_state &= ~CLIENT_UNBOUND; | ||
394 | |||
395 | ret = p_drv->probe(p_dev); | 393 | ret = p_drv->probe(p_dev); |
396 | if (ret) | 394 | if (ret) |
397 | goto put_module; | 395 | goto put_module; |
@@ -433,17 +431,16 @@ static int pcmcia_device_remove(struct device * dev) | |||
433 | p_drv->remove(p_dev); | 431 | p_drv->remove(p_dev); |
434 | 432 | ||
435 | /* check for proper unloading */ | 433 | /* check for proper unloading */ |
436 | if (p_dev->p_state & (CLIENT_IRQ_REQ|CLIENT_IO_REQ|CLIENT_CONFIG_LOCKED)) | 434 | if (p_dev->_irq || p_dev->_io || p_dev->_locked) |
437 | printk(KERN_INFO "pcmcia: driver %s did not release config properly\n", | 435 | printk(KERN_INFO "pcmcia: driver %s did not release config properly\n", |
438 | p_drv->drv.name); | 436 | p_drv->drv.name); |
439 | 437 | ||
440 | for (i = 0; i < MAX_WIN; i++) | 438 | for (i = 0; i < MAX_WIN; i++) |
441 | if (p_dev->p_state & CLIENT_WIN_REQ(i)) | 439 | if (p_dev->_win & CLIENT_WIN_REQ(i)) |
442 | printk(KERN_INFO "pcmcia: driver %s did not release windows properly\n", | 440 | printk(KERN_INFO "pcmcia: driver %s did not release windows properly\n", |
443 | p_drv->drv.name); | 441 | p_drv->drv.name); |
444 | 442 | ||
445 | /* references from pcmcia_probe_device */ | 443 | /* references from pcmcia_probe_device */ |
446 | p_dev->p_state = CLIENT_UNBOUND; | ||
447 | pcmcia_put_dev(p_dev); | 444 | pcmcia_put_dev(p_dev); |
448 | module_put(p_drv->owner); | 445 | module_put(p_drv->owner); |
449 | 446 | ||
@@ -472,7 +469,6 @@ static void pcmcia_card_remove(struct pcmcia_socket *s) | |||
472 | } | 469 | } |
473 | p_dev = list_entry((&s->devices_list)->next, struct pcmcia_device, socket_device_list); | 470 | p_dev = list_entry((&s->devices_list)->next, struct pcmcia_device, socket_device_list); |
474 | list_del(&p_dev->socket_device_list); | 471 | list_del(&p_dev->socket_device_list); |
475 | p_dev->p_state |= CLIENT_STALE; | ||
476 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); | 472 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); |
477 | 473 | ||
478 | device_unregister(&p_dev->dev); | 474 | device_unregister(&p_dev->dev); |
@@ -602,9 +598,6 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
602 | sprintf (p_dev->devname, "pcmcia%s", p_dev->dev.bus_id); | 598 | sprintf (p_dev->devname, "pcmcia%s", p_dev->dev.bus_id); |
603 | 599 | ||
604 | /* compat */ | 600 | /* compat */ |
605 | p_dev->p_state = CLIENT_UNBOUND; | ||
606 | |||
607 | |||
608 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); | 601 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); |
609 | 602 | ||
610 | /* | 603 | /* |
@@ -1033,15 +1026,18 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state) | |||
1033 | if (dev->driver) | 1026 | if (dev->driver) |
1034 | p_drv = to_pcmcia_drv(dev->driver); | 1027 | p_drv = to_pcmcia_drv(dev->driver); |
1035 | 1028 | ||
1036 | if (p_drv && p_drv->suspend) { | 1029 | if (!p_drv) |
1030 | goto out; | ||
1031 | |||
1032 | if (p_drv->suspend) { | ||
1037 | ret = p_drv->suspend(p_dev); | 1033 | ret = p_drv->suspend(p_dev); |
1038 | if (ret) | 1034 | if (ret) |
1039 | goto out; | 1035 | goto out; |
1040 | if ((p_dev->state & DEV_CONFIG) && | ||
1041 | !(p_dev->state & DEV_SUSPEND_NORELEASE)) | ||
1042 | pcmcia_release_configuration(p_dev); | ||
1043 | } | 1036 | } |
1044 | 1037 | ||
1038 | if (p_dev->device_no == p_dev->func) | ||
1039 | pcmcia_release_configuration(p_dev); | ||
1040 | |||
1045 | out: | 1041 | out: |
1046 | if (!ret) | 1042 | if (!ret) |
1047 | p_dev->suspended = 1; | 1043 | p_dev->suspended = 1; |
@@ -1058,17 +1054,18 @@ static int pcmcia_dev_resume(struct device * dev) | |||
1058 | if (dev->driver) | 1054 | if (dev->driver) |
1059 | p_drv = to_pcmcia_drv(dev->driver); | 1055 | p_drv = to_pcmcia_drv(dev->driver); |
1060 | 1056 | ||
1061 | if (p_drv && p_drv->resume) { | 1057 | if (!p_drv) |
1062 | if ((p_dev->state & DEV_CONFIG) && | 1058 | goto out; |
1063 | !(p_dev->state & DEV_SUSPEND_NORELEASE)){ | 1059 | |
1064 | ret = pcmcia_request_configuration(p_dev, | 1060 | if (p_dev->device_no == p_dev->func) { |
1065 | &p_dev->conf); | 1061 | ret = pcmcia_request_configuration(p_dev, &p_dev->conf); |
1066 | if (ret) | 1062 | if (ret) |
1067 | goto out; | 1063 | goto out; |
1068 | } | ||
1069 | ret = p_drv->resume(p_dev); | ||
1070 | } | 1064 | } |
1071 | 1065 | ||
1066 | if (p_drv->resume) | ||
1067 | ret = p_drv->resume(p_dev); | ||
1068 | |||
1072 | out: | 1069 | out: |
1073 | if (!ret) | 1070 | if (!ret) |
1074 | p_dev->suspended = 0; | 1071 | p_dev->suspended = 0; |
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 2b11a332175e..c53db7ceda5e 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c | |||
@@ -304,6 +304,7 @@ static int get_device_info(struct pcmcia_socket *s, bind_info_t *bind_info, int | |||
304 | { | 304 | { |
305 | dev_node_t *node; | 305 | dev_node_t *node; |
306 | struct pcmcia_device *p_dev; | 306 | struct pcmcia_device *p_dev; |
307 | struct pcmcia_driver *p_drv; | ||
307 | unsigned long flags; | 308 | unsigned long flags; |
308 | int ret = 0; | 309 | int ret = 0; |
309 | 310 | ||
@@ -358,7 +359,8 @@ static int get_device_info(struct pcmcia_socket *s, bind_info_t *bind_info, int | |||
358 | found: | 359 | found: |
359 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); | 360 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); |
360 | 361 | ||
361 | if (p_dev->state & DEV_CONFIG_PENDING) { | 362 | p_drv = to_pcmcia_drv(p_dev->dev.driver); |
363 | if (p_drv && !p_dev->_locked) { | ||
362 | ret = -EAGAIN; | 364 | ret = -EAGAIN; |
363 | goto err_put; | 365 | goto err_put; |
364 | } | 366 | } |
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index dbf167c979f6..45063b4e5b78 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
@@ -476,8 +476,8 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev) | |||
476 | config_t *c = p_dev->function_config; | 476 | config_t *c = p_dev->function_config; |
477 | int i; | 477 | int i; |
478 | 478 | ||
479 | if (p_dev->p_state & CLIENT_CONFIG_LOCKED) { | 479 | if (p_dev->_locked) { |
480 | p_dev->p_state &= ~CLIENT_CONFIG_LOCKED; | 480 | p_dev->_locked = 0; |
481 | if (--(s->lock_count) == 0) { | 481 | if (--(s->lock_count) == 0) { |
482 | s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */ | 482 | s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */ |
483 | s->socket.Vpp = 0; | 483 | s->socket.Vpp = 0; |
@@ -516,10 +516,10 @@ static int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req) | |||
516 | struct pcmcia_socket *s = p_dev->socket; | 516 | struct pcmcia_socket *s = p_dev->socket; |
517 | config_t *c = p_dev->function_config; | 517 | config_t *c = p_dev->function_config; |
518 | 518 | ||
519 | if (!(p_dev->p_state & CLIENT_IO_REQ)) | 519 | if (!p_dev->_io ) |
520 | return CS_BAD_HANDLE; | 520 | return CS_BAD_HANDLE; |
521 | 521 | ||
522 | p_dev->p_state &= ~CLIENT_IO_REQ; | 522 | p_dev->_io = 0; |
523 | 523 | ||
524 | if ((c->io.BasePort1 != req->BasePort1) || | 524 | if ((c->io.BasePort1 != req->BasePort1) || |
525 | (c->io.NumPorts1 != req->NumPorts1) || | 525 | (c->io.NumPorts1 != req->NumPorts1) || |
@@ -542,9 +542,9 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
542 | struct pcmcia_socket *s = p_dev->socket; | 542 | struct pcmcia_socket *s = p_dev->socket; |
543 | config_t *c= p_dev->function_config; | 543 | config_t *c= p_dev->function_config; |
544 | 544 | ||
545 | if (!(p_dev->p_state & CLIENT_IRQ_REQ)) | 545 | if (!p_dev->_irq) |
546 | return CS_BAD_HANDLE; | 546 | return CS_BAD_HANDLE; |
547 | p_dev->p_state &= ~CLIENT_IRQ_REQ; | 547 | p_dev->_irq = 0; |
548 | 548 | ||
549 | if (c->state & CONFIG_LOCKED) | 549 | if (c->state & CONFIG_LOCKED) |
550 | return CS_CONFIGURATION_LOCKED; | 550 | return CS_CONFIGURATION_LOCKED; |
@@ -576,7 +576,7 @@ int pcmcia_release_window(window_handle_t win) | |||
576 | if ((win == NULL) || (win->magic != WINDOW_MAGIC)) | 576 | if ((win == NULL) || (win->magic != WINDOW_MAGIC)) |
577 | return CS_BAD_HANDLE; | 577 | return CS_BAD_HANDLE; |
578 | s = win->sock; | 578 | s = win->sock; |
579 | if (!(win->handle->p_state & CLIENT_WIN_REQ(win->index))) | 579 | if (!(win->handle->_win & CLIENT_WIN_REQ(win->index))) |
580 | return CS_BAD_HANDLE; | 580 | return CS_BAD_HANDLE; |
581 | 581 | ||
582 | /* Shut down memory window */ | 582 | /* Shut down memory window */ |
@@ -590,7 +590,7 @@ int pcmcia_release_window(window_handle_t win) | |||
590 | kfree(win->ctl.res); | 590 | kfree(win->ctl.res); |
591 | win->ctl.res = NULL; | 591 | win->ctl.res = NULL; |
592 | } | 592 | } |
593 | win->handle->p_state &= ~CLIENT_WIN_REQ(win->index); | 593 | win->handle->_win &= ~CLIENT_WIN_REQ(win->index); |
594 | 594 | ||
595 | win->magic = 0; | 595 | win->magic = 0; |
596 | 596 | ||
@@ -708,7 +708,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, | |||
708 | } | 708 | } |
709 | 709 | ||
710 | c->state |= CONFIG_LOCKED; | 710 | c->state |= CONFIG_LOCKED; |
711 | p_dev->p_state |= CLIENT_CONFIG_LOCKED; | 711 | p_dev->_locked = 1; |
712 | return CS_SUCCESS; | 712 | return CS_SUCCESS; |
713 | } /* pcmcia_request_configuration */ | 713 | } /* pcmcia_request_configuration */ |
714 | EXPORT_SYMBOL(pcmcia_request_configuration); | 714 | EXPORT_SYMBOL(pcmcia_request_configuration); |
@@ -754,7 +754,7 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req) | |||
754 | 754 | ||
755 | c->io = *req; | 755 | c->io = *req; |
756 | c->state |= CONFIG_IO_REQ; | 756 | c->state |= CONFIG_IO_REQ; |
757 | p_dev->p_state |= CLIENT_IO_REQ; | 757 | p_dev->_io = 1; |
758 | return CS_SUCCESS; | 758 | return CS_SUCCESS; |
759 | } /* pcmcia_request_io */ | 759 | } /* pcmcia_request_io */ |
760 | EXPORT_SYMBOL(pcmcia_request_io); | 760 | EXPORT_SYMBOL(pcmcia_request_io); |
@@ -850,7 +850,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
850 | s->irq.Config++; | 850 | s->irq.Config++; |
851 | 851 | ||
852 | c->state |= CONFIG_IRQ_REQ; | 852 | c->state |= CONFIG_IRQ_REQ; |
853 | p_dev->p_state |= CLIENT_IRQ_REQ; | 853 | p_dev->_irq = 1; |
854 | 854 | ||
855 | #ifdef CONFIG_PCMCIA_PROBE | 855 | #ifdef CONFIG_PCMCIA_PROBE |
856 | pcmcia_used_irq[irq]++; | 856 | pcmcia_used_irq[irq]++; |
@@ -910,7 +910,7 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h | |||
910 | if (!win->ctl.res) | 910 | if (!win->ctl.res) |
911 | return CS_IN_USE; | 911 | return CS_IN_USE; |
912 | } | 912 | } |
913 | (*p_dev)->p_state |= CLIENT_WIN_REQ(w); | 913 | (*p_dev)->_win |= CLIENT_WIN_REQ(w); |
914 | 914 | ||
915 | /* Configure the socket controller */ | 915 | /* Configure the socket controller */ |
916 | win->ctl.map = w+1; | 916 | win->ctl.map = w+1; |
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index 7caa700cf189..ee449b29fc82 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c | |||
@@ -122,7 +122,6 @@ static int aha152x_probe(struct pcmcia_device *link) | |||
122 | link->conf.IntType = INT_MEMORY_AND_IO; | 122 | link->conf.IntType = INT_MEMORY_AND_IO; |
123 | link->conf.Present = PRESENT_OPTION; | 123 | link->conf.Present = PRESENT_OPTION; |
124 | 124 | ||
125 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
126 | return aha152x_config_cs(link); | 125 | return aha152x_config_cs(link); |
127 | } /* aha152x_attach */ | 126 | } /* aha152x_attach */ |
128 | 127 | ||
@@ -132,8 +131,7 @@ static void aha152x_detach(struct pcmcia_device *link) | |||
132 | { | 131 | { |
133 | DEBUG(0, "aha152x_detach(0x%p)\n", link); | 132 | DEBUG(0, "aha152x_detach(0x%p)\n", link); |
134 | 133 | ||
135 | if (link->state & DEV_CONFIG) | 134 | aha152x_release_cs(link); |
136 | aha152x_release_cs(link); | ||
137 | 135 | ||
138 | /* Unlink device structure, free bits */ | 136 | /* Unlink device structure, free bits */ |
139 | kfree(link->priv); | 137 | kfree(link->priv); |
@@ -165,9 +163,6 @@ static int aha152x_config_cs(struct pcmcia_device *link) | |||
165 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | 163 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
166 | link->conf.ConfigBase = parse.config.base; | 164 | link->conf.ConfigBase = parse.config.base; |
167 | 165 | ||
168 | /* Configure card */ | ||
169 | link->state |= DEV_CONFIG; | ||
170 | |||
171 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 166 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
172 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 167 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
173 | while (1) { | 168 | while (1) { |
@@ -216,7 +211,6 @@ static int aha152x_config_cs(struct pcmcia_device *link) | |||
216 | link->dev_node = &info->node; | 211 | link->dev_node = &info->node; |
217 | info->host = host; | 212 | info->host = host; |
218 | 213 | ||
219 | link->state &= ~DEV_CONFIG_PENDING; | ||
220 | return 0; | 214 | return 0; |
221 | 215 | ||
222 | cs_failed: | 216 | cs_failed: |
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index 80afd3e879cc..85f7ffac19a0 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c | |||
@@ -105,7 +105,6 @@ static int fdomain_probe(struct pcmcia_device *link) | |||
105 | link->conf.IntType = INT_MEMORY_AND_IO; | 105 | link->conf.IntType = INT_MEMORY_AND_IO; |
106 | link->conf.Present = PRESENT_OPTION; | 106 | link->conf.Present = PRESENT_OPTION; |
107 | 107 | ||
108 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
109 | return fdomain_config(link); | 108 | return fdomain_config(link); |
110 | } /* fdomain_attach */ | 109 | } /* fdomain_attach */ |
111 | 110 | ||
@@ -115,8 +114,7 @@ static void fdomain_detach(struct pcmcia_device *link) | |||
115 | { | 114 | { |
116 | DEBUG(0, "fdomain_detach(0x%p)\n", link); | 115 | DEBUG(0, "fdomain_detach(0x%p)\n", link); |
117 | 116 | ||
118 | if (link->state & DEV_CONFIG) | 117 | fdomain_release(link); |
119 | fdomain_release(link); | ||
120 | 118 | ||
121 | kfree(link->priv); | 119 | kfree(link->priv); |
122 | } /* fdomain_detach */ | 120 | } /* fdomain_detach */ |
@@ -147,9 +145,6 @@ static int fdomain_config(struct pcmcia_device *link) | |||
147 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | 145 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
148 | link->conf.ConfigBase = parse.config.base; | 146 | link->conf.ConfigBase = parse.config.base; |
149 | 147 | ||
150 | /* Configure card */ | ||
151 | link->state |= DEV_CONFIG; | ||
152 | |||
153 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 148 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
154 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 149 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
155 | while (1) { | 150 | while (1) { |
@@ -188,7 +183,6 @@ static int fdomain_config(struct pcmcia_device *link) | |||
188 | link->dev_node = &info->node; | 183 | link->dev_node = &info->node; |
189 | info->host = host; | 184 | info->host = host; |
190 | 185 | ||
191 | link->state &= ~DEV_CONFIG_PENDING; | ||
192 | return 0; | 186 | return 0; |
193 | 187 | ||
194 | cs_failed: | 188 | cs_failed: |
@@ -214,8 +208,7 @@ static void fdomain_release(struct pcmcia_device *link) | |||
214 | 208 | ||
215 | static int fdomain_resume(struct pcmcia_device *link) | 209 | static int fdomain_resume(struct pcmcia_device *link) |
216 | { | 210 | { |
217 | if (link->state & DEV_CONFIG) | 211 | fdomain_16x0_bus_reset(NULL); |
218 | fdomain_16x0_bus_reset(NULL); | ||
219 | 212 | ||
220 | return 0; | 213 | return 0; |
221 | } | 214 | } |
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index deec1c3a2619..231f9c311c69 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c | |||
@@ -1630,7 +1630,6 @@ static int nsp_cs_probe(struct pcmcia_device *link) | |||
1630 | link->conf.IntType = INT_MEMORY_AND_IO; | 1630 | link->conf.IntType = INT_MEMORY_AND_IO; |
1631 | link->conf.Present = PRESENT_OPTION; | 1631 | link->conf.Present = PRESENT_OPTION; |
1632 | 1632 | ||
1633 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
1634 | ret = nsp_cs_config(link); | 1633 | ret = nsp_cs_config(link); |
1635 | 1634 | ||
1636 | nsp_dbg(NSP_DEBUG_INIT, "link=0x%p", link); | 1635 | nsp_dbg(NSP_DEBUG_INIT, "link=0x%p", link); |
@@ -1648,10 +1647,8 @@ static void nsp_cs_detach(struct pcmcia_device *link) | |||
1648 | { | 1647 | { |
1649 | nsp_dbg(NSP_DEBUG_INIT, "in, link=0x%p", link); | 1648 | nsp_dbg(NSP_DEBUG_INIT, "in, link=0x%p", link); |
1650 | 1649 | ||
1651 | if (link->state & DEV_CONFIG) { | 1650 | ((scsi_info_t *)link->priv)->stop = 1; |
1652 | ((scsi_info_t *)link->priv)->stop = 1; | 1651 | nsp_cs_release(link); |
1653 | nsp_cs_release(link); | ||
1654 | } | ||
1655 | 1652 | ||
1656 | kfree(link->priv); | 1653 | kfree(link->priv); |
1657 | link->priv = NULL; | 1654 | link->priv = NULL; |
@@ -1698,9 +1695,6 @@ static int nsp_cs_config(struct pcmcia_device *link) | |||
1698 | link->conf.ConfigBase = parse.config.base; | 1695 | link->conf.ConfigBase = parse.config.base; |
1699 | link->conf.Present = parse.config.rmask[0]; | 1696 | link->conf.Present = parse.config.rmask[0]; |
1700 | 1697 | ||
1701 | /* Configure card */ | ||
1702 | link->state |= DEV_CONFIG; | ||
1703 | |||
1704 | /* Look up the current Vcc */ | 1698 | /* Look up the current Vcc */ |
1705 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &conf)); | 1699 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &conf)); |
1706 | 1700 | ||
@@ -1921,7 +1915,6 @@ static int nsp_cs_config(struct pcmcia_device *link) | |||
1921 | req.Base+req.Size-1); | 1915 | req.Base+req.Size-1); |
1922 | printk("\n"); | 1916 | printk("\n"); |
1923 | 1917 | ||
1924 | link->state &= ~DEV_CONFIG_PENDING; | ||
1925 | return 0; | 1918 | return 0; |
1926 | 1919 | ||
1927 | cs_failed: | 1920 | cs_failed: |
@@ -2071,19 +2064,7 @@ static int __init nsp_cs_init(void) | |||
2071 | static void __exit nsp_cs_exit(void) | 2064 | static void __exit nsp_cs_exit(void) |
2072 | { | 2065 | { |
2073 | nsp_msg(KERN_INFO, "unloading..."); | 2066 | nsp_msg(KERN_INFO, "unloading..."); |
2074 | |||
2075 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,68)) | ||
2076 | pcmcia_unregister_driver(&nsp_driver); | 2067 | pcmcia_unregister_driver(&nsp_driver); |
2077 | #else | ||
2078 | unregister_pcmcia_driver(&dev_info); | ||
2079 | /* XXX: this really needs to move into generic code.. */ | ||
2080 | while (dev_list != NULL) { | ||
2081 | if (dev_list->state & DEV_CONFIG) { | ||
2082 | nsp_cs_release(dev_list); | ||
2083 | } | ||
2084 | nsp_cs_detach(dev_list); | ||
2085 | } | ||
2086 | #endif | ||
2087 | } | 2068 | } |
2088 | 2069 | ||
2089 | 2070 | ||
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c index 61c2eb03a9b5..86c2ac6ae623 100644 --- a/drivers/scsi/pcmcia/qlogic_stub.c +++ b/drivers/scsi/pcmcia/qlogic_stub.c | |||
@@ -178,7 +178,6 @@ static int qlogic_probe(struct pcmcia_device *link) | |||
178 | link->conf.IntType = INT_MEMORY_AND_IO; | 178 | link->conf.IntType = INT_MEMORY_AND_IO; |
179 | link->conf.Present = PRESENT_OPTION; | 179 | link->conf.Present = PRESENT_OPTION; |
180 | 180 | ||
181 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
182 | return qlogic_config(link); | 181 | return qlogic_config(link); |
183 | } /* qlogic_attach */ | 182 | } /* qlogic_attach */ |
184 | 183 | ||
@@ -188,9 +187,7 @@ static void qlogic_detach(struct pcmcia_device *link) | |||
188 | { | 187 | { |
189 | DEBUG(0, "qlogic_detach(0x%p)\n", link); | 188 | DEBUG(0, "qlogic_detach(0x%p)\n", link); |
190 | 189 | ||
191 | if (link->state & DEV_CONFIG) | 190 | qlogic_release(link); |
192 | qlogic_release(link); | ||
193 | |||
194 | kfree(link->priv); | 191 | kfree(link->priv); |
195 | 192 | ||
196 | } /* qlogic_detach */ | 193 | } /* qlogic_detach */ |
@@ -224,9 +221,6 @@ static int qlogic_config(struct pcmcia_device * link) | |||
224 | if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) && (pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS)) | 221 | if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) && (pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS)) |
225 | info->manf_id = le16_to_cpu(tuple.TupleData[0]); | 222 | info->manf_id = le16_to_cpu(tuple.TupleData[0]); |
226 | 223 | ||
227 | /* Configure card */ | ||
228 | link->state |= DEV_CONFIG; | ||
229 | |||
230 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 224 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
231 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 225 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
232 | while (1) { | 226 | while (1) { |
@@ -272,7 +266,6 @@ static int qlogic_config(struct pcmcia_device * link) | |||
272 | link->dev_node = &info->node; | 266 | link->dev_node = &info->node; |
273 | info->host = host; | 267 | info->host = host; |
274 | 268 | ||
275 | link->state &= ~DEV_CONFIG_PENDING; | ||
276 | return 0; | 269 | return 0; |
277 | 270 | ||
278 | cs_failed: | 271 | cs_failed: |
@@ -302,20 +295,18 @@ static void qlogic_release(struct pcmcia_device *link) | |||
302 | 295 | ||
303 | static int qlogic_resume(struct pcmcia_device *link) | 296 | static int qlogic_resume(struct pcmcia_device *link) |
304 | { | 297 | { |
305 | if (link->state & DEV_CONFIG) { | 298 | scsi_info_t *info = link->priv; |
306 | scsi_info_t *info = link->priv; | 299 | |
307 | 300 | pcmcia_request_configuration(link, &link->conf); | |
308 | pcmcia_request_configuration(link, &link->conf); | 301 | if ((info->manf_id == MANFID_MACNICA) || |
309 | if ((info->manf_id == MANFID_MACNICA) || | 302 | (info->manf_id == MANFID_PIONEER) || |
310 | (info->manf_id == MANFID_PIONEER) || | 303 | (info->manf_id == 0x0098)) { |
311 | (info->manf_id == 0x0098)) { | 304 | outb(0x80, link->io.BasePort1 + 0xd); |
312 | outb(0x80, link->io.BasePort1 + 0xd); | 305 | outb(0x24, link->io.BasePort1 + 0x9); |
313 | outb(0x24, link->io.BasePort1 + 0x9); | 306 | outb(0x04, link->io.BasePort1 + 0xd); |
314 | outb(0x04, link->io.BasePort1 + 0xd); | ||
315 | } | ||
316 | /* Ugggglllyyyy!!! */ | ||
317 | qlogicfas408_bus_reset(NULL); | ||
318 | } | 307 | } |
308 | /* Ugggglllyyyy!!! */ | ||
309 | qlogicfas408_bus_reset(NULL); | ||
319 | 310 | ||
320 | return 0; | 311 | return 0; |
321 | } | 312 | } |
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index b4432206a881..9f59827707f0 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c | |||
@@ -736,9 +736,6 @@ SYM53C500_config(struct pcmcia_device *link) | |||
736 | (pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS)) | 736 | (pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS)) |
737 | info->manf_id = le16_to_cpu(tuple.TupleData[0]); | 737 | info->manf_id = le16_to_cpu(tuple.TupleData[0]); |
738 | 738 | ||
739 | /* Configure card */ | ||
740 | link->state |= DEV_CONFIG; | ||
741 | |||
742 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 739 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
743 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 740 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
744 | while (1) { | 741 | while (1) { |
@@ -836,7 +833,6 @@ next_entry: | |||
836 | 833 | ||
837 | scsi_scan_host(host); | 834 | scsi_scan_host(host); |
838 | 835 | ||
839 | link->state &= ~DEV_CONFIG_PENDING; | ||
840 | return 0; | 836 | return 0; |
841 | 837 | ||
842 | err_free_irq: | 838 | err_free_irq: |
@@ -846,7 +842,6 @@ err_free_scsi: | |||
846 | err_release: | 842 | err_release: |
847 | release_region(port_base, 0x10); | 843 | release_region(port_base, 0x10); |
848 | printk(KERN_INFO "sym53c500_cs: no SCSI devices found\n"); | 844 | printk(KERN_INFO "sym53c500_cs: no SCSI devices found\n"); |
849 | link->state &= ~DEV_CONFIG_PENDING; | ||
850 | return -ENODEV; | 845 | return -ENODEV; |
851 | 846 | ||
852 | cs_failed: | 847 | cs_failed: |
@@ -859,21 +854,19 @@ static int sym53c500_resume(struct pcmcia_device *link) | |||
859 | { | 854 | { |
860 | struct scsi_info_t *info = link->priv; | 855 | struct scsi_info_t *info = link->priv; |
861 | 856 | ||
862 | if (link->state & DEV_CONFIG) { | 857 | /* See earlier comment about manufacturer IDs. */ |
863 | /* See earlier comment about manufacturer IDs. */ | 858 | if ((info->manf_id == MANFID_MACNICA) || |
864 | if ((info->manf_id == MANFID_MACNICA) || | 859 | (info->manf_id == MANFID_PIONEER) || |
865 | (info->manf_id == MANFID_PIONEER) || | 860 | (info->manf_id == 0x0098)) { |
866 | (info->manf_id == 0x0098)) { | 861 | outb(0x80, link->io.BasePort1 + 0xd); |
867 | outb(0x80, link->io.BasePort1 + 0xd); | 862 | outb(0x24, link->io.BasePort1 + 0x9); |
868 | outb(0x24, link->io.BasePort1 + 0x9); | 863 | outb(0x04, link->io.BasePort1 + 0xd); |
869 | outb(0x04, link->io.BasePort1 + 0xd); | ||
870 | } | ||
871 | /* | ||
872 | * If things don't work after a "resume", | ||
873 | * this is a good place to start looking. | ||
874 | */ | ||
875 | SYM53C500_int_host_reset(link->io.BasePort1); | ||
876 | } | 864 | } |
865 | /* | ||
866 | * If things don't work after a "resume", | ||
867 | * this is a good place to start looking. | ||
868 | */ | ||
869 | SYM53C500_int_host_reset(link->io.BasePort1); | ||
877 | 870 | ||
878 | return 0; | 871 | return 0; |
879 | } | 872 | } |
@@ -883,8 +876,7 @@ SYM53C500_detach(struct pcmcia_device *link) | |||
883 | { | 876 | { |
884 | DEBUG(0, "SYM53C500_detach(0x%p)\n", link); | 877 | DEBUG(0, "SYM53C500_detach(0x%p)\n", link); |
885 | 878 | ||
886 | if (link->state & DEV_CONFIG) | 879 | SYM53C500_release(link); |
887 | SYM53C500_release(link); | ||
888 | 880 | ||
889 | kfree(link->priv); | 881 | kfree(link->priv); |
890 | link->priv = NULL; | 882 | link->priv = NULL; |
@@ -913,7 +905,6 @@ SYM53C500_probe(struct pcmcia_device *link) | |||
913 | link->conf.IntType = INT_MEMORY_AND_IO; | 905 | link->conf.IntType = INT_MEMORY_AND_IO; |
914 | link->conf.Present = PRESENT_OPTION; | 906 | link->conf.Present = PRESENT_OPTION; |
915 | 907 | ||
916 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
917 | return SYM53C500_config(link); | 908 | return SYM53C500_config(link); |
918 | } /* SYM53C500_attach */ | 909 | } /* SYM53C500_attach */ |
919 | 910 | ||
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index e7875090dc4c..eec05a0a86f6 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c | |||
@@ -128,38 +128,27 @@ static void serial_remove(struct pcmcia_device *link) | |||
128 | struct serial_info *info = link->priv; | 128 | struct serial_info *info = link->priv; |
129 | int i; | 129 | int i; |
130 | 130 | ||
131 | link->state &= ~DEV_PRESENT; | ||
132 | |||
133 | DEBUG(0, "serial_release(0x%p)\n", link); | 131 | DEBUG(0, "serial_release(0x%p)\n", link); |
134 | 132 | ||
135 | /* | 133 | /* |
136 | * Recheck to see if the device is still configured. | 134 | * Recheck to see if the device is still configured. |
137 | */ | 135 | */ |
138 | if (info->p_dev->state & DEV_CONFIG) { | 136 | for (i = 0; i < info->ndev; i++) |
139 | for (i = 0; i < info->ndev; i++) | 137 | serial8250_unregister_port(info->line[i]); |
140 | serial8250_unregister_port(info->line[i]); | ||
141 | |||
142 | info->p_dev->dev_node = NULL; | ||
143 | 138 | ||
144 | if (!info->slave) | 139 | info->p_dev->dev_node = NULL; |
145 | pcmcia_disable_device(link); | ||
146 | 140 | ||
147 | info->p_dev->state &= ~DEV_CONFIG; | 141 | if (!info->slave) |
148 | } | 142 | pcmcia_disable_device(link); |
149 | } | 143 | } |
150 | 144 | ||
151 | static int serial_suspend(struct pcmcia_device *link) | 145 | static int serial_suspend(struct pcmcia_device *link) |
152 | { | 146 | { |
153 | if (link->state & DEV_CONFIG) { | 147 | struct serial_info *info = link->priv; |
154 | struct serial_info *info = link->priv; | 148 | int i; |
155 | int i; | ||
156 | |||
157 | for (i = 0; i < info->ndev; i++) | ||
158 | serial8250_suspend_port(info->line[i]); | ||
159 | 149 | ||
160 | if (info->slave) | 150 | for (i = 0; i < info->ndev; i++) |
161 | link->state &= DEV_SUSPEND_NORELEASE; | 151 | serial8250_suspend_port(info->line[i]); |
162 | } | ||
163 | 152 | ||
164 | return 0; | 153 | return 0; |
165 | } | 154 | } |
@@ -210,7 +199,6 @@ static int serial_probe(struct pcmcia_device *link) | |||
210 | } | 199 | } |
211 | link->conf.IntType = INT_MEMORY_AND_IO; | 200 | link->conf.IntType = INT_MEMORY_AND_IO; |
212 | 201 | ||
213 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
214 | return serial_config(link); | 202 | return serial_config(link); |
215 | } | 203 | } |
216 | 204 | ||
@@ -586,9 +574,6 @@ static int serial_config(struct pcmcia_device * link) | |||
586 | link->conf.ConfigBase = parse->config.base; | 574 | link->conf.ConfigBase = parse->config.base; |
587 | link->conf.Present = parse->config.rmask[0]; | 575 | link->conf.Present = parse->config.rmask[0]; |
588 | 576 | ||
589 | /* Configure card */ | ||
590 | link->state |= DEV_CONFIG; | ||
591 | |||
592 | /* Is this a compliant multifunction card? */ | 577 | /* Is this a compliant multifunction card? */ |
593 | tuple->DesiredTuple = CISTPL_LONGLINK_MFC; | 578 | tuple->DesiredTuple = CISTPL_LONGLINK_MFC; |
594 | tuple->Attributes = TUPLE_RETURN_COMMON | TUPLE_RETURN_LINK; | 579 | tuple->Attributes = TUPLE_RETURN_COMMON | TUPLE_RETURN_LINK; |
@@ -648,7 +633,6 @@ static int serial_config(struct pcmcia_device * link) | |||
648 | } | 633 | } |
649 | 634 | ||
650 | link->dev_node = &info->node[0]; | 635 | link->dev_node = &info->node[0]; |
651 | link->state &= ~DEV_CONFIG_PENDING; | ||
652 | kfree(cfg_mem); | 636 | kfree(cfg_mem); |
653 | return 0; | 637 | return 0; |
654 | 638 | ||
@@ -656,7 +640,6 @@ static int serial_config(struct pcmcia_device * link) | |||
656 | cs_error(link, last_fn, last_ret); | 640 | cs_error(link, last_fn, last_ret); |
657 | failed: | 641 | failed: |
658 | serial_remove(link); | 642 | serial_remove(link); |
659 | link->state &= ~DEV_CONFIG_PENDING; | ||
660 | kfree(cfg_mem); | 643 | kfree(cfg_mem); |
661 | return -ENODEV; | 644 | return -ENODEV; |
662 | } | 645 | } |
diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c index 5c7611c2ac6c..dda0ca45d904 100644 --- a/drivers/telephony/ixj_pcmcia.c +++ b/drivers/telephony/ixj_pcmcia.c | |||
@@ -52,7 +52,6 @@ static int ixj_probe(struct pcmcia_device *p_dev) | |||
52 | } | 52 | } |
53 | memset(p_dev->priv, 0, sizeof(struct ixj_info_t)); | 53 | memset(p_dev->priv, 0, sizeof(struct ixj_info_t)); |
54 | 54 | ||
55 | p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
56 | return ixj_config(p_dev); | 55 | return ixj_config(p_dev); |
57 | } | 56 | } |
58 | 57 | ||
@@ -60,8 +59,7 @@ static void ixj_detach(struct pcmcia_device *link) | |||
60 | { | 59 | { |
61 | DEBUG(0, "ixj_detach(0x%p)\n", link); | 60 | DEBUG(0, "ixj_detach(0x%p)\n", link); |
62 | 61 | ||
63 | if (link->state & DEV_CONFIG) | 62 | ixj_cs_release(link); |
64 | ixj_cs_release(link); | ||
65 | 63 | ||
66 | kfree(link->priv); | 64 | kfree(link->priv); |
67 | } | 65 | } |
@@ -155,7 +153,6 @@ static int ixj_config(struct pcmcia_device * link) | |||
155 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | 153 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
156 | link->conf.ConfigBase = parse.config.base; | 154 | link->conf.ConfigBase = parse.config.base; |
157 | link->conf.Present = parse.config.rmask[0]; | 155 | link->conf.Present = parse.config.rmask[0]; |
158 | link->state |= DEV_CONFIG; | ||
159 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 156 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
160 | tuple.Attributes = 0; | 157 | tuple.Attributes = 0; |
161 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 158 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
@@ -194,7 +191,6 @@ static int ixj_config(struct pcmcia_device * link) | |||
194 | info->node.major = PHONE_MAJOR; | 191 | info->node.major = PHONE_MAJOR; |
195 | link->dev_node = &info->node; | 192 | link->dev_node = &info->node; |
196 | ixj_get_serial(link, j); | 193 | ixj_get_serial(link, j); |
197 | link->state &= ~DEV_CONFIG_PENDING; | ||
198 | return 0; | 194 | return 0; |
199 | cs_failed: | 195 | cs_failed: |
200 | cs_error(link, last_fn, last_ret); | 196 | cs_error(link, last_fn, last_ret); |
diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c index e8b8e9a93084..302aa1ec312f 100644 --- a/drivers/usb/host/sl811_cs.c +++ b/drivers/usb/host/sl811_cs.c | |||
@@ -142,9 +142,7 @@ static void sl811_cs_detach(struct pcmcia_device *link) | |||
142 | { | 142 | { |
143 | DBG(0, "sl811_cs_detach(0x%p)\n", link); | 143 | DBG(0, "sl811_cs_detach(0x%p)\n", link); |
144 | 144 | ||
145 | link->state &= ~DEV_PRESENT; | 145 | sl811_cs_release(link); |
146 | if (link->state & DEV_CONFIG) | ||
147 | sl811_cs_release(link); | ||
148 | 146 | ||
149 | /* This points to the parent local_info_t struct */ | 147 | /* This points to the parent local_info_t struct */ |
150 | kfree(link->priv); | 148 | kfree(link->priv); |
@@ -182,9 +180,6 @@ static int sl811_cs_config(struct pcmcia_device *link) | |||
182 | link->conf.ConfigBase = parse.config.base; | 180 | link->conf.ConfigBase = parse.config.base; |
183 | link->conf.Present = parse.config.rmask[0]; | 181 | link->conf.Present = parse.config.rmask[0]; |
184 | 182 | ||
185 | /* Configure card */ | ||
186 | link->state |= DEV_CONFIG; | ||
187 | |||
188 | /* Look up the current Vcc */ | 183 | /* Look up the current Vcc */ |
189 | CS_CHECK(GetConfigurationInfo, | 184 | CS_CHECK(GetConfigurationInfo, |
190 | pcmcia_get_configuration_info(link, &conf)); | 185 | pcmcia_get_configuration_info(link, &conf)); |
@@ -276,15 +271,12 @@ next_entry: | |||
276 | link->io.BasePort1+link->io.NumPorts1-1); | 271 | link->io.BasePort1+link->io.NumPorts1-1); |
277 | printk("\n"); | 272 | printk("\n"); |
278 | 273 | ||
279 | link->state &= ~DEV_CONFIG_PENDING; | ||
280 | |||
281 | if (sl811_hc_init(parent, link->io.BasePort1, link->irq.AssignedIRQ) | 274 | if (sl811_hc_init(parent, link->io.BasePort1, link->irq.AssignedIRQ) |
282 | < 0) { | 275 | < 0) { |
283 | cs_failed: | 276 | cs_failed: |
284 | printk("sl811_cs_config failed\n"); | 277 | printk("sl811_cs_config failed\n"); |
285 | cs_error(link, last_fn, last_ret); | 278 | cs_error(link, last_fn, last_ret); |
286 | sl811_cs_release(link); | 279 | sl811_cs_release(link); |
287 | link->state &= ~DEV_CONFIG_PENDING; | ||
288 | return -ENODEV; | 280 | return -ENODEV; |
289 | } | 281 | } |
290 | return 0; | 282 | return 0; |
@@ -309,7 +301,6 @@ static int sl811_cs_probe(struct pcmcia_device *link) | |||
309 | link->conf.Attributes = 0; | 301 | link->conf.Attributes = 0; |
310 | link->conf.IntType = INT_MEMORY_AND_IO; | 302 | link->conf.IntType = INT_MEMORY_AND_IO; |
311 | 303 | ||
312 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
313 | return sl811_cs_config(link); | 304 | return sl811_cs_config(link); |
314 | } | 305 | } |
315 | 306 | ||