diff options
Diffstat (limited to 'drivers/net/wireless/ray_cs.c')
-rw-r--r-- | drivers/net/wireless/ray_cs.c | 53 |
1 files changed, 23 insertions, 30 deletions
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 | } |