aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/card.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp/card.c')
-rw-r--r--drivers/pnp/card.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c
index fae28913f459..3b48aef8f4eb 100644
--- a/drivers/pnp/card.c
+++ b/drivers/pnp/card.c
@@ -197,33 +197,34 @@ int pnp_add_card(struct pnp_card *card)
197 card->dev.bus = NULL; 197 card->dev.bus = NULL;
198 card->dev.release = &pnp_release_card; 198 card->dev.release = &pnp_release_card;
199 error = device_register(&card->dev); 199 error = device_register(&card->dev);
200 200 if (error) {
201 if (error == 0) {
202 pnp_interface_attach_card(card);
203 spin_lock(&pnp_lock);
204 list_add_tail(&card->global_list, &pnp_cards);
205 list_add_tail(&card->protocol_list, &card->protocol->cards);
206 spin_unlock(&pnp_lock);
207
208 /* we wait until now to add devices in order to ensure the drivers
209 * will be able to use all of the related devices on the card
210 * without waiting any unresonable length of time */
211 list_for_each(pos, &card->devices) {
212 struct pnp_dev *dev = card_to_pnp_dev(pos);
213 __pnp_add_device(dev);
214 }
215
216 /* match with card drivers */
217 list_for_each_safe(pos, temp, &pnp_card_drivers) {
218 struct pnp_card_driver *drv =
219 list_entry(pos, struct pnp_card_driver,
220 global_list);
221 card_probe(card, drv);
222 }
223 } else
224 pnp_err("sysfs failure, card '%s' will be unavailable", 201 pnp_err("sysfs failure, card '%s' will be unavailable",
225 card->dev.bus_id); 202 card->dev.bus_id);
226 return error; 203 return error;
204 }
205
206 pnp_interface_attach_card(card);
207 spin_lock(&pnp_lock);
208 list_add_tail(&card->global_list, &pnp_cards);
209 list_add_tail(&card->protocol_list, &card->protocol->cards);
210 spin_unlock(&pnp_lock);
211
212 /* we wait until now to add devices in order to ensure the drivers
213 * will be able to use all of the related devices on the card
214 * without waiting an unreasonable length of time */
215 list_for_each(pos, &card->devices) {
216 struct pnp_dev *dev = card_to_pnp_dev(pos);
217 __pnp_add_device(dev);
218 }
219
220 /* match with card drivers */
221 list_for_each_safe(pos, temp, &pnp_card_drivers) {
222 struct pnp_card_driver *drv =
223 list_entry(pos, struct pnp_card_driver,
224 global_list);
225 card_probe(card, drv);
226 }
227 return 0;
227} 228}
228 229
229/** 230/**
@@ -291,14 +292,15 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
291 struct pnp_card *card; 292 struct pnp_card *card;
292 293
293 if (!clink || !id) 294 if (!clink || !id)
294 goto done; 295 return NULL;
296
295 card = clink->card; 297 card = clink->card;
296 drv = clink->driver; 298 drv = clink->driver;
297 if (!from) { 299 if (!from) {
298 pos = card->devices.next; 300 pos = card->devices.next;
299 } else { 301 } else {
300 if (from->card != card) 302 if (from->card != card)
301 goto done; 303 return NULL;
302 pos = from->card_list.next; 304 pos = from->card_list.next;
303 } 305 }
304 while (pos != &card->devices) { 306 while (pos != &card->devices) {
@@ -308,7 +310,6 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
308 pos = pos->next; 310 pos = pos->next;
309 } 311 }
310 312
311done:
312 return NULL; 313 return NULL;
313 314
314found: 315found: