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/isdn/hisax | |
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/isdn/hisax')
-rw-r--r-- | drivers/isdn/hisax/avma1_cs.c | 17 | ||||
-rw-r--r-- | drivers/isdn/hisax/elsa_cs.c | 19 | ||||
-rw-r--r-- | drivers/isdn/hisax/sedlbauer_cs.c | 18 | ||||
-rw-r--r-- | drivers/isdn/hisax/teles_cs.c | 19 |
4 files changed, 19 insertions, 54 deletions
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; |