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/scsi/pcmcia | |
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/scsi/pcmcia')
-rw-r--r-- | drivers/scsi/pcmcia/aha152x_stub.c | 8 | ||||
-rw-r--r-- | drivers/scsi/pcmcia/fdomain_stub.c | 11 | ||||
-rw-r--r-- | drivers/scsi/pcmcia/nsp_cs.c | 23 | ||||
-rw-r--r-- | drivers/scsi/pcmcia/qlogic_stub.c | 33 | ||||
-rw-r--r-- | drivers/scsi/pcmcia/sym53c500_cs.c | 35 |
5 files changed, 30 insertions, 80 deletions
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 | ||