staging: comedi: remove in_request_module
authorIan Abbott <abbotti@mev.co.uk>
Tue, 27 May 2014 14:06:17 +0000 (15:06 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 May 2014 18:57:31 +0000 (11:57 -0700)
The `in_request_module` member of `struct comedi_device` is only ever
set to `false`, so remove the code that checks for it being `true` and
remove the member.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedi_fops.c
drivers/staging/comedi/comedidev.h

index 70ad00c501ef58f154a1221738a5393866216bf8..9d99fb3c18a65d4b25dd4c20e40d84abf78871b4 100644 (file)
@@ -2327,38 +2327,12 @@ static int comedi_open(struct inode *inode, struct file *file)
                return -ENODEV;
        }
 
-       /* This is slightly hacky, but we want module autoloading
-        * to work for root.
-        * case: user opens device, attached -> ok
-        * case: user opens device, unattached, !in_request_module -> autoload
-        * case: user opens device, unattached, in_request_module -> fail
-        * case: root opens device, attached -> ok
-        * case: root opens device, unattached, in_request_module -> ok
-        *   (typically called from modprobe)
-        * case: root opens device, unattached, !in_request_module -> autoload
-        *
-        * The last could be changed to "-> ok", which would deny root
-        * autoloading.
-        */
        mutex_lock(&dev->mutex);
-       if (dev->attached)
-               goto ok;
-       if (!capable(CAP_NET_ADMIN) && dev->in_request_module) {
-               dev_dbg(dev->class_dev, "in request module\n");
-               rc = -ENODEV;
-               goto out;
-       }
-       if (capable(CAP_NET_ADMIN) && dev->in_request_module)
-               goto ok;
-
-       dev->in_request_module = false;
-
        if (!dev->attached && !capable(CAP_NET_ADMIN)) {
                dev_dbg(dev->class_dev, "not attached and not CAP_NET_ADMIN\n");
                rc = -ENODEV;
                goto out;
        }
-ok:
        if (dev->attached && dev->use_count == 0) {
                if (!try_module_get(dev->driver->module)) {
                        rc = -ENOSYS;
index d07d47f5db81223cbca825e7f325fa96e525f3f4..8f4e44bfbe00d28d7bfcf9e1e2bdf1eddd13e401 100644 (file)
@@ -180,7 +180,6 @@ struct comedi_device {
        const char *board_name;
        const void *board_ptr;
        bool attached:1;
-       bool in_request_module:1;
        bool ioenabled:1;
        spinlock_t spinlock;
        struct mutex mutex;