aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/ds.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-04-08 14:33:16 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2010-05-10 04:23:11 -0400
commit6f0f38c45a8f2f511c25893e33011ff32fc811db (patch)
treed44382f7b5c7db15e39ce7d5dc2b2feb7bd108a8 /drivers/pcmcia/ds.c
parent0cb3c49cdd275aa9ef4b1afd090117b1b86a16d4 (diff)
pcmcia: setup IRQ to be used by PCMCIA drivers at card insert
Setup the IRQ to be used by PCMCIA drivers already during the device registration stage, making use of a new function pcmcia_setup_irq(). This will allow us to get rid of quite a lot of indirection in the future. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/ds.c')
-rw-r--r--drivers/pcmcia/ds.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 041eee43fd8..5fd2948c7ed 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -546,26 +546,32 @@ struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int fu
546 p_dev->function_config = tmp_dev->function_config; 546 p_dev->function_config = tmp_dev->function_config;
547 p_dev->io = tmp_dev->io; 547 p_dev->io = tmp_dev->io;
548 p_dev->irq = tmp_dev->irq; 548 p_dev->irq = tmp_dev->irq;
549 p_dev->irq_v = tmp_dev->irq_v;
549 kref_get(&p_dev->function_config->ref); 550 kref_get(&p_dev->function_config->ref);
550 } 551 }
551 552
552 /* Add to the list in pcmcia_bus_socket */ 553 /* Add to the list in pcmcia_bus_socket */
553 list_add(&p_dev->socket_device_list, &s->devices_list); 554 list_add(&p_dev->socket_device_list, &s->devices_list);
554 555
555 mutex_unlock(&s->ops_mutex); 556 if (pcmcia_setup_irq(p_dev))
557 dev_warn(&p_dev->dev,
558 "IRQ setup failed -- device might not work\n");
556 559
557 if (!p_dev->function_config) { 560 if (!p_dev->function_config) {
558 dev_dbg(&p_dev->dev, "creating config_t\n"); 561 dev_dbg(&p_dev->dev, "creating config_t\n");
559 p_dev->function_config = kzalloc(sizeof(struct config_t), 562 p_dev->function_config = kzalloc(sizeof(struct config_t),
560 GFP_KERNEL); 563 GFP_KERNEL);
561 if (!p_dev->function_config) 564 if (!p_dev->function_config) {
565 mutex_unlock(&s->ops_mutex);
562 goto err_unreg; 566 goto err_unreg;
567 }
563 kref_init(&p_dev->function_config->ref); 568 kref_init(&p_dev->function_config->ref);
564 } 569 }
570 mutex_unlock(&s->ops_mutex);
565 571
566 dev_printk(KERN_NOTICE, &p_dev->dev, 572 dev_printk(KERN_NOTICE, &p_dev->dev,
567 "pcmcia: registering new device %s\n", 573 "pcmcia: registering new device %s (IRQ: %d)\n",
568 p_dev->devname); 574 p_dev->devname, p_dev->irq_v);
569 575
570 pcmcia_device_query(p_dev); 576 pcmcia_device_query(p_dev);
571 577
@@ -1258,6 +1264,7 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
1258 handle_event(skt, event); 1264 handle_event(skt, event);
1259 mutex_lock(&s->ops_mutex); 1265 mutex_lock(&s->ops_mutex);
1260 destroy_cis_cache(s); 1266 destroy_cis_cache(s);
1267 pcmcia_cleanup_irq(s);
1261 mutex_unlock(&s->ops_mutex); 1268 mutex_unlock(&s->ops_mutex);
1262 break; 1269 break;
1263 1270