Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 304356
b: refs/heads/master
c: 4d7df82
h: refs/heads/master
v: v3
  • Loading branch information
Ian Abbott authored and Greg Kroah-Hartman committed Apr 13, 2012
1 parent a91b19e commit 90d83b2
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b3201b563d36eb799d3f9e14871d5dda2b11f3e8
refs/heads/master: 4d7df821277e82ebe2fc9c9af07c928a83f572b8
29 changes: 26 additions & 3 deletions trunk/drivers/staging/comedi/comedi_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 9 additions & 6 deletions trunk/drivers/staging/comedi/drivers.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ static int postconfig(struct comedi_device *dev)
s->len_chanlist = 1;

if (s->do_cmd) {
unsigned int buf_size;

BUG_ON((s->subdev_flags & (SDF_CMD_READ |
SDF_CMD_WRITE)) == 0);
BUG_ON(!s->do_cmdtest);
Expand All @@ -254,19 +256,20 @@ static int postconfig(struct comedi_device *dev)
async->subdevice = s;
s->async = async;

#define DEFAULT_BUF_MAXSIZE (64*1024)
#define DEFAULT_BUF_SIZE (64*1024)

async->max_bufsize = DEFAULT_BUF_MAXSIZE;
async->max_bufsize =
comedi_default_buf_maxsize_kb * 1024;
buf_size = comedi_default_buf_size_kb * 1024;
if (buf_size > async->max_bufsize)
buf_size = async->max_bufsize;

async->prealloc_buf = NULL;
async->prealloc_bufsz = 0;
if (comedi_buf_alloc(dev, s, DEFAULT_BUF_SIZE) < 0) {
if (comedi_buf_alloc(dev, s, buf_size) < 0) {
printk(KERN_INFO "Buffer allocation failed\n");
return -ENOMEM;
}
if (s->buf_change) {
ret = s->buf_change(dev, s, DEFAULT_BUF_SIZE);
ret = s->buf_change(dev, s, buf_size);
if (ret < 0)
return ret;
}
Expand Down
5 changes: 4 additions & 1 deletion trunk/drivers/staging/comedi/internal.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* various internal comedi functions
* various internal comedi stuff
*/
int do_rangeinfo_ioctl(struct comedi_device *dev,
struct comedi_rangeinfo __user *arg);
Expand All @@ -11,3 +11,6 @@ int comedi_find_board_minor(struct device *hardware_device);
void comedi_reset_async_buf(struct comedi_async *async);
int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
unsigned long new_size);

extern unsigned int comedi_default_buf_size_kb;
extern unsigned int comedi_default_buf_maxsize_kb;

0 comments on commit 90d83b2

Please sign in to comment.