diff options
author | Ian Abbott <abbotti@mev.co.uk> | 2013-03-15 09:15:34 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-15 12:16:31 -0400 |
commit | 13f12b5aea501bce146cdf213d1819083aadc847 (patch) | |
tree | 78e645fcfcbcec587767c083faf1fae04f97364c | |
parent | a7401cddcdf739d3cb9598c9b3787a732fc87809 (diff) |
staging: comedi: make 'in_request_module' a bool bit-field
Change the `in_request_module` member of `struct comedi_device` to a
1-bit bit-field of type `bool` and move it into a suitable hole in the
data type to save a few bytes. Change the assigned values to `true` and
`false`.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/comedi_fops.c | 12 | ||||
-rw-r--r-- | drivers/staging/comedi/comedidev.h | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index e336b281b847..6bcbb52510ef 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c | |||
@@ -2067,12 +2067,12 @@ static int comedi_open(struct inode *inode, struct file *file) | |||
2067 | /* This is slightly hacky, but we want module autoloading | 2067 | /* This is slightly hacky, but we want module autoloading |
2068 | * to work for root. | 2068 | * to work for root. |
2069 | * case: user opens device, attached -> ok | 2069 | * case: user opens device, attached -> ok |
2070 | * case: user opens device, unattached, in_request_module=0 -> autoload | 2070 | * case: user opens device, unattached, !in_request_module -> autoload |
2071 | * case: user opens device, unattached, in_request_module=1 -> fail | 2071 | * case: user opens device, unattached, in_request_module -> fail |
2072 | * case: root opens device, attached -> ok | 2072 | * case: root opens device, attached -> ok |
2073 | * case: root opens device, unattached, in_request_module=1 -> ok | 2073 | * case: root opens device, unattached, in_request_module -> ok |
2074 | * (typically called from modprobe) | 2074 | * (typically called from modprobe) |
2075 | * case: root opens device, unattached, in_request_module=0 -> autoload | 2075 | * case: root opens device, unattached, !in_request_module -> autoload |
2076 | * | 2076 | * |
2077 | * The last could be changed to "-> ok", which would deny root | 2077 | * The last could be changed to "-> ok", which would deny root |
2078 | * autoloading. | 2078 | * autoloading. |
@@ -2088,7 +2088,7 @@ static int comedi_open(struct inode *inode, struct file *file) | |||
2088 | if (capable(CAP_NET_ADMIN) && dev->in_request_module) | 2088 | if (capable(CAP_NET_ADMIN) && dev->in_request_module) |
2089 | goto ok; | 2089 | goto ok; |
2090 | 2090 | ||
2091 | dev->in_request_module = 1; | 2091 | dev->in_request_module = true; |
2092 | 2092 | ||
2093 | #ifdef CONFIG_KMOD | 2093 | #ifdef CONFIG_KMOD |
2094 | mutex_unlock(&dev->mutex); | 2094 | mutex_unlock(&dev->mutex); |
@@ -2096,7 +2096,7 @@ static int comedi_open(struct inode *inode, struct file *file) | |||
2096 | mutex_lock(&dev->mutex); | 2096 | mutex_lock(&dev->mutex); |
2097 | #endif | 2097 | #endif |
2098 | 2098 | ||
2099 | dev->in_request_module = 0; | 2099 | dev->in_request_module = false; |
2100 | 2100 | ||
2101 | if (!dev->attached && !capable(CAP_NET_ADMIN)) { | 2101 | if (!dev->attached && !capable(CAP_NET_ADMIN)) { |
2102 | DPRINTK("not attached and not CAP_NET_ADMIN\n"); | 2102 | DPRINTK("not attached and not CAP_NET_ADMIN\n"); |
diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index bdd2936e509b..86de4ff9501a 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h | |||
@@ -208,9 +208,9 @@ struct comedi_device { | |||
208 | const char *board_name; | 208 | const char *board_name; |
209 | const void *board_ptr; | 209 | const void *board_ptr; |
210 | bool attached:1; | 210 | bool attached:1; |
211 | bool in_request_module:1; | ||
211 | spinlock_t spinlock; | 212 | spinlock_t spinlock; |
212 | struct mutex mutex; | 213 | struct mutex mutex; |
213 | int in_request_module; | ||
214 | 214 | ||
215 | int n_subdevices; | 215 | int n_subdevices; |
216 | struct comedi_subdevice *subdevices; | 216 | struct comedi_subdevice *subdevices; |