summaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/comedi_fops.c
diff options
context:
space:
mode:
authorIan Abbott2013-04-04 15:58:55 +0200
committerGreg Kroah-Hartman2013-04-05 23:33:18 +0200
commitd9740a0314a744a8f6406c55e033d60c45b67f74 (patch)
treec0115e6dc6276fac4b6dab1625c22afb38da715b /drivers/staging/comedi/comedi_fops.c
parentstaging: comedi: remove manually unconfigured dynamic devices (diff)
downloadkernel-qcow2-linux-d9740a0314a744a8f6406c55e033d60c45b67f74.tar.gz
kernel-qcow2-linux-d9740a0314a744a8f6406c55e033d60c45b67f74.tar.xz
kernel-qcow2-linux-d9740a0314a744a8f6406c55e033d60c45b67f74.zip
staging: comedi: avoid forward declarations
Move a few functions and variables to avoid a couple of forward declarations. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/comedi_fops.c')
-rw-r--r--drivers/staging/comedi/comedi_fops.c115
1 files changed, 56 insertions, 59 deletions
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index d80060a14977..1c310e790b62 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -87,8 +87,62 @@ struct comedi_file_info {
static DEFINE_SPINLOCK(comedi_file_info_table_lock);
static struct comedi_file_info *comedi_file_info_table[COMEDI_NUM_MINORS];
-static struct comedi_file_info *comedi_clear_minor(unsigned minor);
-static void comedi_free_board_file_info(struct comedi_file_info *info);
+static struct class *comedi_class;
+static struct cdev comedi_cdev;
+
+static void comedi_device_init(struct comedi_device *dev)
+{
+ spin_lock_init(&dev->spinlock);
+ mutex_init(&dev->mutex);
+ dev->minor = -1;
+}
+
+static void comedi_device_cleanup(struct comedi_device *dev)
+{
+ struct module *driver_module = NULL;
+
+ if (dev == NULL)
+ return;
+ mutex_lock(&dev->mutex);
+ if (dev->attached)
+ driver_module = dev->driver->module;
+ comedi_device_detach(dev);
+ while (dev->use_count > 0) {
+ if (driver_module)
+ module_put(driver_module);
+ module_put(THIS_MODULE);
+ dev->use_count--;
+ }
+ mutex_unlock(&dev->mutex);
+ mutex_destroy(&dev->mutex);
+}
+
+static struct comedi_file_info *comedi_clear_minor(unsigned minor)
+{
+ struct comedi_file_info *info;
+
+ spin_lock(&comedi_file_info_table_lock);
+ info = comedi_file_info_table[minor];
+ comedi_file_info_table[minor] = NULL;
+ spin_unlock(&comedi_file_info_table_lock);
+ return info;
+}
+
+static void comedi_free_board_file_info(struct comedi_file_info *info)
+{
+ if (info) {
+ struct comedi_device *dev = info->device;
+ if (dev) {
+ if (dev->class_dev) {
+ device_destroy(comedi_class,
+ MKDEV(COMEDI_MAJOR, dev->minor));
+ }
+ comedi_device_cleanup(dev);
+ kfree(dev);
+ }
+ kfree(info);
+ }
+}
static struct comedi_file_info *comedi_file_info_from_minor(unsigned minor)
{
@@ -2212,9 +2266,6 @@ static const struct file_operations comedi_fops = {
.llseek = noop_llseek,
};
-static struct class *comedi_class;
-static struct cdev comedi_cdev;
-
void comedi_error(const struct comedi_device *dev, const char *s)
{
dev_err(dev->class_dev, "%s: %s\n", dev->driver->driver_name, s);
@@ -2264,33 +2315,6 @@ void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s)
}
EXPORT_SYMBOL(comedi_event);
-static void comedi_device_init(struct comedi_device *dev)
-{
- spin_lock_init(&dev->spinlock);
- mutex_init(&dev->mutex);
- dev->minor = -1;
-}
-
-static void comedi_device_cleanup(struct comedi_device *dev)
-{
- struct module *driver_module = NULL;
-
- if (dev == NULL)
- return;
- mutex_lock(&dev->mutex);
- if (dev->attached)
- driver_module = dev->driver->module;
- comedi_device_detach(dev);
- while (dev->use_count > 0) {
- if (driver_module)
- module_put(driver_module);
- module_put(THIS_MODULE);
- dev->use_count--;
- }
- mutex_unlock(&dev->mutex);
- mutex_destroy(&dev->mutex);
-}
-
/* Note: the ->mutex is pre-locked on successful return */
struct comedi_device *comedi_alloc_board_minor(struct device *hardware_device)
{
@@ -2339,33 +2363,6 @@ struct comedi_device *comedi_alloc_board_minor(struct device *hardware_device)
return dev;
}
-static struct comedi_file_info *comedi_clear_minor(unsigned minor)
-{
- struct comedi_file_info *info;
-
- spin_lock(&comedi_file_info_table_lock);
- info = comedi_file_info_table[minor];
- comedi_file_info_table[minor] = NULL;
- spin_unlock(&comedi_file_info_table_lock);
- return info;
-}
-
-static void comedi_free_board_file_info(struct comedi_file_info *info)
-{
- if (info) {
- struct comedi_device *dev = info->device;
- if (dev) {
- if (dev->class_dev) {
- device_destroy(comedi_class,
- MKDEV(COMEDI_MAJOR, dev->minor));
- }
- comedi_device_cleanup(dev);
- kfree(dev);
- }
- kfree(info);
- }
-}
-
static void comedi_free_board_minor(unsigned minor)
{
BUG_ON(minor >= COMEDI_NUM_BOARD_MINORS);