aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-05 04:45:09 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:15:57 -0500
commitfd238232cd0ff4840ae6946bb338502154096d88 (patch)
treed20e8f5871f7cff9d0867a84f6ba088fbffcbe28 /drivers/pcmcia
parenta78f4dd331a4f6a396eb5849656a4a72a70a56d7 (diff)
[PATCH] pcmcia: embed dev_link_t into struct pcmcia_device
Embed dev_link_t into struct pcmcia_device(), as they basically address the same entity. The actual contents of dev_link_t will be cleaned up step by step. This patch includes a bugfix from and signed-off-by Andrew Morton. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/ds.c19
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c9
-rw-r--r--drivers/pcmcia/pcmcia_resource.c13
3 files changed, 17 insertions, 24 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 488448a12b2f..4ab956843d86 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -391,6 +391,7 @@ static int pcmcia_device_probe(struct device * dev)
391 } 391 }
392 392
393 p_dev->p_state &= ~CLIENT_UNBOUND; 393 p_dev->p_state &= ~CLIENT_UNBOUND;
394 p_dev->handle = p_dev;
394 395
395 ret = p_drv->probe(p_dev); 396 ret = p_drv->probe(p_dev);
396 if (ret) 397 if (ret)
@@ -1039,12 +1040,10 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state)
1039 ret = p_drv->suspend(p_dev); 1040 ret = p_drv->suspend(p_dev);
1040 if (ret) 1041 if (ret)
1041 return ret; 1042 return ret;
1042 if (p_dev->instance) { 1043 p_dev->state |= DEV_SUSPEND;
1043 p_dev->instance->state |= DEV_SUSPEND; 1044 if ((p_dev->state & DEV_CONFIG) &&
1044 if ((p_dev->instance->state & DEV_CONFIG) && 1045 !(p_dev->state & DEV_SUSPEND_NORELEASE))
1045 !(p_dev->instance->state & DEV_SUSPEND_NORELEASE))
1046 pcmcia_release_configuration(p_dev); 1046 pcmcia_release_configuration(p_dev);
1047 }
1048 } 1047 }
1049 1048
1050 return 0; 1049 return 0;
@@ -1061,16 +1060,14 @@ static int pcmcia_dev_resume(struct device * dev)
1061 p_drv = to_pcmcia_drv(dev->driver); 1060 p_drv = to_pcmcia_drv(dev->driver);
1062 1061
1063 if (p_drv && p_drv->resume) { 1062 if (p_drv && p_drv->resume) {
1064 if (p_dev->instance) { 1063 p_dev->state &= ~DEV_SUSPEND;
1065 p_dev->instance->state &= ~DEV_SUSPEND; 1064 if ((p_dev->state & DEV_CONFIG) &&
1066 if ((p_dev->instance->state & DEV_CONFIG) && 1065 !(p_dev->state & DEV_SUSPEND_NORELEASE)){
1067 !(p_dev->instance->state & DEV_SUSPEND_NORELEASE)){
1068 ret = pcmcia_request_configuration(p_dev, 1066 ret = pcmcia_request_configuration(p_dev,
1069 &p_dev->instance->conf); 1067 &p_dev->conf);
1070 if (ret) 1068 if (ret)
1071 return ret; 1069 return ret;
1072 } 1070 }
1073 }
1074 return p_drv->resume(p_dev); 1071 return p_drv->resume(p_dev);
1075 } 1072 }
1076 1073
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index be08bc9e99fd..2b11a332175e 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -229,7 +229,7 @@ static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info)
229 * by userspace before, we need to 229 * by userspace before, we need to
230 * return the "instance". */ 230 * return the "instance". */
231 spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 231 spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
232 bind_info->instance = p_dev->instance; 232 bind_info->instance = p_dev;
233 ret = -EBUSY; 233 ret = -EBUSY;
234 goto err_put_module; 234 goto err_put_module;
235 } else { 235 } else {
@@ -358,16 +358,15 @@ static int get_device_info(struct pcmcia_socket *s, bind_info_t *bind_info, int
358 found: 358 found:
359 spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 359 spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
360 360
361 if ((!p_dev->instance) || 361 if (p_dev->state & DEV_CONFIG_PENDING) {
362 (p_dev->instance->state & DEV_CONFIG_PENDING)) {
363 ret = -EAGAIN; 362 ret = -EAGAIN;
364 goto err_put; 363 goto err_put;
365 } 364 }
366 365
367 if (first) 366 if (first)
368 node = p_dev->instance->dev; 367 node = p_dev->dev_node;
369 else 368 else
370 for (node = p_dev->instance->dev; node; node = node->next) 369 for (node = p_dev->dev_node; node; node = node->next)
371 if (node == bind_info->next) 370 if (node == bind_info->next)
372 break; 371 break;
373 if (!node) { 372 if (!node) {
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index ab0bbb6207b2..93ab9402d37f 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -942,15 +942,12 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h
942EXPORT_SYMBOL(pcmcia_request_window); 942EXPORT_SYMBOL(pcmcia_request_window);
943 943
944void pcmcia_disable_device(struct pcmcia_device *p_dev) { 944void pcmcia_disable_device(struct pcmcia_device *p_dev) {
945 if (!p_dev->instance)
946 return;
947
948 pcmcia_release_configuration(p_dev); 945 pcmcia_release_configuration(p_dev);
949 pcmcia_release_io(p_dev, &p_dev->instance->io); 946 pcmcia_release_io(p_dev, &p_dev->io);
950 pcmcia_release_irq(p_dev, &p_dev->instance->irq); 947 pcmcia_release_irq(p_dev, &p_dev->irq);
951 if (&p_dev->instance->win) 948 if (&p_dev->win)
952 pcmcia_release_window(p_dev->instance->win); 949 pcmcia_release_window(p_dev->win);
953 950
954 p_dev->instance->dev = NULL; 951 p_dev->dev_node = NULL;
955} 952}
956EXPORT_SYMBOL(pcmcia_disable_device); 953EXPORT_SYMBOL(pcmcia_disable_device);