diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-01 18:09:29 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:26:33 -0500 |
commit | e2d4096365e06b9a3799afbadc28b4519c0b3526 (patch) | |
tree | 90ec691d71f9c0309048714e359b8ba351b533f7 /drivers/bluetooth | |
parent | f6fbe01ac976f3ec618cd5fb71ad9ce2cfa7ab2b (diff) |
[PATCH] pcmcia: use bitfield instead of p_state and state
Instead of the two status values struct pcmcia_device->p_state and state,
use descriptive bitfields. Most value-checking in drivers was invalid, as
the core now only calls the ->remove() (a.k.a. detach) function in case the
attachement _and_ configuration was successful.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r-- | drivers/bluetooth/bluecard_cs.c | 14 | ||||
-rw-r--r-- | drivers/bluetooth/bt3c_cs.c | 14 | ||||
-rw-r--r-- | drivers/bluetooth/btuart_cs.c | 14 | ||||
-rw-r--r-- | drivers/bluetooth/dtl1_cs.c | 13 |
4 files changed, 12 insertions, 43 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 | } |