summaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/comedi_fops.c
diff options
context:
space:
mode:
authorIan Abbott2012-04-13 15:12:53 +0200
committerGreg Kroah-Hartman2012-04-13 20:18:23 +0200
commit4d7df821277e82ebe2fc9c9af07c928a83f572b8 (patch)
tree166c802ebf8c67647c85c5cb3f2a2cfa972f8059 /drivers/staging/comedi/comedi_fops.c
parentstaging:iio:adc: Add SPEAr ADC driver (diff)
downloadkernel-qcow2-linux-4d7df821277e82ebe2fc9c9af07c928a83f572b8.tar.gz
kernel-qcow2-linux-4d7df821277e82ebe2fc9c9af07c928a83f572b8.tar.xz
kernel-qcow2-linux-4d7df821277e82ebe2fc9c9af07c928a83f572b8.zip
staging: comedi: Add module parameters for default buffer size
For comedi subdevices that support asynchronous transfer commands, the initial buffer size and maximum buffer size for the transfer are both set to 64 KiB when the comedi device is "attached" to the hardware device. For many applications with reasonable fast sample rates and slow user-space (e.g. Python) these sizes are a bit too small. A task with CAP_SYS_ADMIN privileges can change the maximum buffer size for a comedi subdevice with an ioctl call or by writing to a device attribute file in sysfs, but that's not very convenient. For comedi devices attached during system startup, this could be done by a start-up script, but for hot-plugged devices it would require scripts run by udev rules, etc. Rather than use hardwired values, this patch introduces a couple of module parameters to set the defaults for the initial buffer size (comedi_default_buf_size_kb) and maximum buffer size (comedi_default_buf_maxsize_kb). These values are applied in place of the previous hard-wired values when the comedi device is "attached". The module parameter values are in units of KiB for consistency with the existing device attribute files. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> 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.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index fdf42822b962..ef7bbe416614 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -55,17 +55,40 @@ MODULE_AUTHOR("http://www.comedi.org");
MODULE_DESCRIPTION("Comedi core module");
MODULE_LICENSE("GPL");
+#define DEFAULT_BUF_MAXSIZE_KB 64
+#define DEFAULT_BUF_SIZE_KB 64
+
#ifdef CONFIG_COMEDI_DEBUG
int comedi_debug;
EXPORT_SYMBOL(comedi_debug);
-module_param(comedi_debug, int, 0644);
+module_param(comedi_debug, int, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(comedi_debug,
+ "enable comedi core and driver debugging if non-zero (default 0)"
+ );
#endif
bool comedi_autoconfig = 1;
-module_param(comedi_autoconfig, bool, 0444);
+module_param(comedi_autoconfig, bool, S_IRUGO);
+MODULE_PARM_DESC(comedi_autoconfig,
+ "enable drivers to auto-configure comedi devices (default 1)");
static int comedi_num_legacy_minors;
-module_param(comedi_num_legacy_minors, int, 0444);
+module_param(comedi_num_legacy_minors, int, S_IRUGO);
+MODULE_PARM_DESC(comedi_num_legacy_minors,
+ "number of comedi minor devices to reserve for non-auto-configured devices (default 0)"
+ );
+
+unsigned int comedi_default_buf_size_kb = DEFAULT_BUF_SIZE_KB;
+module_param(comedi_default_buf_size_kb, uint, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(comedi_default_buf_size_kb,
+ "default asynchronous buffer size in KiB (default "
+ __MODULE_STRING(DEFAULT_BUF_SIZE_KB) ")");
+
+unsigned int comedi_default_buf_maxsize_kb = DEFAULT_BUF_MAXSIZE_KB;
+module_param(comedi_default_buf_maxsize_kb, uint, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(comedi_default_buf_maxsize_kb,
+ "default maximum size of asynchronous buffer in KiB (default "
+ __MODULE_STRING(DEFAULT_BUF_MAXSIZE_KB) ")");
static DEFINE_SPINLOCK(comedi_file_info_table_lock);
static struct comedi_device_file_info