Merge trivial low-risk suspend hotkey bugzilla-5918 into release
[sfrench/cifs-2.6.git] / drivers / pcmcia / pcmcia_ioctl.c
index 8eceba7391027c014d3d82ecc46325d28c74df99..9ad18e62658d6da302f70290027410eaace11c7d 100644 (file)
@@ -18,7 +18,6 @@
  */
 
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
@@ -230,7 +229,7 @@ static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info)
                                         * by userspace before, we need to
                                         * return the "instance". */
                                        spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
-                                       bind_info->instance = p_dev->instance;
+                                       bind_info->instance = p_dev;
                                        ret = -EBUSY;
                                        goto err_put_module;
                                } else {
@@ -305,6 +304,7 @@ static int get_device_info(struct pcmcia_socket *s, bind_info_t *bind_info, int
 {
        dev_node_t *node;
        struct pcmcia_device *p_dev;
+       struct pcmcia_driver *p_drv;
        unsigned long flags;
        int ret = 0;
 
@@ -359,16 +359,16 @@ static int get_device_info(struct pcmcia_socket *s, bind_info_t *bind_info, int
  found:
        spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
 
-       if ((!p_dev->instance) ||
-           (p_dev->instance->state & DEV_CONFIG_PENDING)) {
+       p_drv = to_pcmcia_drv(p_dev->dev.driver);
+       if (p_drv && !p_dev->_locked) {
                ret = -EAGAIN;
                goto err_put;
        }
 
        if (first)
-               node = p_dev->instance->dev;
+               node = p_dev->dev_node;
        else
-               for (node = p_dev->instance->dev; node; node = node->next)
+               for (node = p_dev->dev_node; node; node = node->next)
                        if (node == bind_info->next)
                                break;
        if (!node) {
@@ -426,7 +426,7 @@ static int ds_open(struct inode *inode, struct file *file)
 
     if (!warning_printed) {
            printk(KERN_INFO "pcmcia: Detected deprecated PCMCIA ioctl "
-                       "usage.\n");
+                       "usage from process: %s.\n", current->comm);
            printk(KERN_INFO "pcmcia: This interface will soon be removed from "
                        "the kernel; please expect breakage unless you upgrade "
                        "to new tools.\n");
@@ -665,9 +665,10 @@ static int ds_ioctl(struct inode * inode, struct file * file,
        if (!(buf->conf_reg.Function &&
             (buf->conf_reg.Function >= s->functions))) {
                struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->conf_reg.Function);
-               if (p_dev)
+               if (p_dev) {
                        ret = pcmcia_access_configuration_register(p_dev, &buf->conf_reg);
-               pcmcia_put_dev(p_dev);
+                       pcmcia_put_dev(p_dev);
+               }
        }
        break;
     case DS_GET_FIRST_REGION: