diff options
author | Paul Mundt <lethal@linux-sh.org> | 2010-05-23 19:52:55 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-05-23 19:52:55 -0400 |
commit | 1f782fee18b39b9ad438ebbd82c2915a16c879ee (patch) | |
tree | f292930065e6c860714c134790ab8882680ac739 /drivers/pcmcia/ds.c | |
parent | 8eda2f21ed9c936a54fd7bc16cbfa5ee656635c2 (diff) | |
parent | f4b87dee923342505e1ddba8d34ce9de33e75050 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'drivers/pcmcia/ds.c')
-rw-r--r-- | drivers/pcmcia/ds.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 041eee43fd8d..7ef7adee5e4f 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -371,8 +371,6 @@ static int pcmcia_device_remove(struct device *dev) | |||
371 | if (p_drv->remove) | 371 | if (p_drv->remove) |
372 | p_drv->remove(p_dev); | 372 | p_drv->remove(p_dev); |
373 | 373 | ||
374 | p_dev->dev_node = NULL; | ||
375 | |||
376 | /* check for proper unloading */ | 374 | /* check for proper unloading */ |
377 | if (p_dev->_irq || p_dev->_io || p_dev->_locked) | 375 | if (p_dev->_irq || p_dev->_io || p_dev->_locked) |
378 | dev_printk(KERN_INFO, dev, | 376 | dev_printk(KERN_INFO, dev, |
@@ -479,15 +477,6 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev) | |||
479 | } | 477 | } |
480 | 478 | ||
481 | 479 | ||
482 | /* device_add_lock is needed to avoid double registration by cardmgr and kernel. | ||
483 | * Serializes pcmcia_device_add; will most likely be removed in future. | ||
484 | * | ||
485 | * While it has the caveat that adding new PCMCIA devices inside(!) device_register() | ||
486 | * won't work, this doesn't matter much at the moment: the driver core doesn't | ||
487 | * support it either. | ||
488 | */ | ||
489 | static DEFINE_MUTEX(device_add_lock); | ||
490 | |||
491 | struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int function) | 480 | struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int function) |
492 | { | 481 | { |
493 | struct pcmcia_device *p_dev, *tmp_dev; | 482 | struct pcmcia_device *p_dev, *tmp_dev; |
@@ -497,8 +486,6 @@ struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int fu | |||
497 | if (!s) | 486 | if (!s) |
498 | return NULL; | 487 | return NULL; |
499 | 488 | ||
500 | mutex_lock(&device_add_lock); | ||
501 | |||
502 | pr_debug("adding device to %d, function %d\n", s->sock, function); | 489 | pr_debug("adding device to %d, function %d\n", s->sock, function); |
503 | 490 | ||
504 | p_dev = kzalloc(sizeof(struct pcmcia_device), GFP_KERNEL); | 491 | p_dev = kzalloc(sizeof(struct pcmcia_device), GFP_KERNEL); |
@@ -538,8 +525,8 @@ struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int fu | |||
538 | 525 | ||
539 | /* | 526 | /* |
540 | * p_dev->function_config must be the same for all card functions. | 527 | * p_dev->function_config must be the same for all card functions. |
541 | * Note that this is serialized by the device_add_lock, so that | 528 | * Note that this is serialized by ops_mutex, so that only one |
542 | * only one such struct will be created. | 529 | * such struct will be created. |
543 | */ | 530 | */ |
544 | list_for_each_entry(tmp_dev, &s->devices_list, socket_device_list) | 531 | list_for_each_entry(tmp_dev, &s->devices_list, socket_device_list) |
545 | if (p_dev->func == tmp_dev->func) { | 532 | if (p_dev->func == tmp_dev->func) { |
@@ -552,28 +539,31 @@ struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int fu | |||
552 | /* Add to the list in pcmcia_bus_socket */ | 539 | /* Add to the list in pcmcia_bus_socket */ |
553 | list_add(&p_dev->socket_device_list, &s->devices_list); | 540 | list_add(&p_dev->socket_device_list, &s->devices_list); |
554 | 541 | ||
555 | mutex_unlock(&s->ops_mutex); | 542 | if (pcmcia_setup_irq(p_dev)) |
543 | dev_warn(&p_dev->dev, | ||
544 | "IRQ setup failed -- device might not work\n"); | ||
556 | 545 | ||
557 | if (!p_dev->function_config) { | 546 | if (!p_dev->function_config) { |
558 | dev_dbg(&p_dev->dev, "creating config_t\n"); | 547 | dev_dbg(&p_dev->dev, "creating config_t\n"); |
559 | p_dev->function_config = kzalloc(sizeof(struct config_t), | 548 | p_dev->function_config = kzalloc(sizeof(struct config_t), |
560 | GFP_KERNEL); | 549 | GFP_KERNEL); |
561 | if (!p_dev->function_config) | 550 | if (!p_dev->function_config) { |
551 | mutex_unlock(&s->ops_mutex); | ||
562 | goto err_unreg; | 552 | goto err_unreg; |
553 | } | ||
563 | kref_init(&p_dev->function_config->ref); | 554 | kref_init(&p_dev->function_config->ref); |
564 | } | 555 | } |
556 | mutex_unlock(&s->ops_mutex); | ||
565 | 557 | ||
566 | dev_printk(KERN_NOTICE, &p_dev->dev, | 558 | dev_printk(KERN_NOTICE, &p_dev->dev, |
567 | "pcmcia: registering new device %s\n", | 559 | "pcmcia: registering new device %s (IRQ: %d)\n", |
568 | p_dev->devname); | 560 | p_dev->devname, p_dev->irq); |
569 | 561 | ||
570 | pcmcia_device_query(p_dev); | 562 | pcmcia_device_query(p_dev); |
571 | 563 | ||
572 | if (device_register(&p_dev->dev)) | 564 | if (device_register(&p_dev->dev)) |
573 | goto err_unreg; | 565 | goto err_unreg; |
574 | 566 | ||
575 | mutex_unlock(&device_add_lock); | ||
576 | |||
577 | return p_dev; | 567 | return p_dev; |
578 | 568 | ||
579 | err_unreg: | 569 | err_unreg: |
@@ -591,7 +581,6 @@ struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int fu | |||
591 | kfree(p_dev->devname); | 581 | kfree(p_dev->devname); |
592 | kfree(p_dev); | 582 | kfree(p_dev); |
593 | err_put: | 583 | err_put: |
594 | mutex_unlock(&device_add_lock); | ||
595 | pcmcia_put_socket(s); | 584 | pcmcia_put_socket(s); |
596 | 585 | ||
597 | return NULL; | 586 | return NULL; |
@@ -1258,6 +1247,7 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority) | |||
1258 | handle_event(skt, event); | 1247 | handle_event(skt, event); |
1259 | mutex_lock(&s->ops_mutex); | 1248 | mutex_lock(&s->ops_mutex); |
1260 | destroy_cis_cache(s); | 1249 | destroy_cis_cache(s); |
1250 | pcmcia_cleanup_irq(s); | ||
1261 | mutex_unlock(&s->ops_mutex); | 1251 | mutex_unlock(&s->ops_mutex); |
1262 | break; | 1252 | break; |
1263 | 1253 | ||