aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/ds.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-07-24 07:14:44 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2010-08-03 03:02:44 -0400
commit2ce4905e4da9f512b38f56a53ece9da2072dd164 (patch)
tree64ca3ecc0dea9b4fbdca2c9b1353ee282e9afc82 /drivers/pcmcia/ds.c
parent3dace8cf15ae1dd7c9384758b3a29556b441a90a (diff)
pcmcia: use struct resource for PCMCIA devices
Introduce a new field into struct pcmcia_device named "resource" and of type struct resource *, which contains the IO port ranges allocated for this device. Memory window ranges and registration with the resource trees will follow at a later date. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/ds.c')
-rw-r--r--drivers/pcmcia/ds.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index bacfc55f2026..7ddd19a4033d 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -531,7 +531,6 @@ static struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s,
531 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)
532 if (p_dev->func == tmp_dev->func) { 532 if (p_dev->func == tmp_dev->func) {
533 p_dev->function_config = tmp_dev->function_config; 533 p_dev->function_config = tmp_dev->function_config;
534 p_dev->io = tmp_dev->io;
535 p_dev->irq = tmp_dev->irq; 534 p_dev->irq = tmp_dev->irq;
536 kref_get(&p_dev->function_config->ref); 535 kref_get(&p_dev->function_config->ref);
537 } 536 }
@@ -544,15 +543,23 @@ static struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s,
544 "IRQ setup failed -- device might not work\n"); 543 "IRQ setup failed -- device might not work\n");
545 544
546 if (!p_dev->function_config) { 545 if (!p_dev->function_config) {
546 config_t *c;
547 dev_dbg(&p_dev->dev, "creating config_t\n"); 547 dev_dbg(&p_dev->dev, "creating config_t\n");
548 p_dev->function_config = kzalloc(sizeof(struct config_t), 548 c = kzalloc(sizeof(struct config_t), GFP_KERNEL);
549 GFP_KERNEL); 549 if (!c) {
550 if (!p_dev->function_config) {
551 mutex_unlock(&s->ops_mutex); 550 mutex_unlock(&s->ops_mutex);
552 goto err_unreg; 551 goto err_unreg;
553 } 552 }
554 kref_init(&p_dev->function_config->ref); 553 p_dev->function_config = c;
554 kref_init(&c->ref);
555 for (i = 0; i < MAX_IO_WIN; i++) {
556 c->io[i].name = dev_name(&p_dev->dev);
557 c->io[i].flags = IORESOURCE_IO;
558 }
555 } 559 }
560 for (i = 0; i < MAX_IO_WIN; i++)
561 p_dev->resource[i] = &p_dev->function_config->io[i];
562
556 mutex_unlock(&s->ops_mutex); 563 mutex_unlock(&s->ops_mutex);
557 564
558 dev_printk(KERN_NOTICE, &p_dev->dev, 565 dev_printk(KERN_NOTICE, &p_dev->dev,