summaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/comedi_fops.c
diff options
context:
space:
mode:
authorMithlesh Thukral2009-06-08 17:34:41 +0200
committerGreg Kroah-Hartman2009-09-15 21:01:33 +0200
commit0a85b6f0ab0d2edb0d41b32697111ce0e4f43496 (patch)
tree4a3d939afc8473f6eaa3c462da60e71b8e0ba879 /drivers/staging/comedi/comedi_fops.c
parentStaging: otus: Drop an unnecessary NULL test (diff)
downloadkernel-qcow2-linux-0a85b6f0ab0d2edb0d41b32697111ce0e4f43496.tar.gz
kernel-qcow2-linux-0a85b6f0ab0d2edb0d41b32697111ce0e4f43496.tar.xz
kernel-qcow2-linux-0a85b6f0ab0d2edb0d41b32697111ce0e4f43496.zip
Staging: Comedi: Lindent changes to comdi driver in staging tree
Lindent changes to comdi driver in staging tree. This patch is followed by the checkpatch.pl error fixes. Did not make them part of this patch as the patch size is already huge. Signed-off-by: Mithlesh Thukral <mithlesh@linsyssoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/comedi/comedi_fops.c')
-rw-r--r--drivers/staging/comedi/comedi_fops.c278
1 files changed, 151 insertions, 127 deletions
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 640f65c6ef84..f54bb9b3ee37 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -68,26 +68,33 @@ module_param(comedi_num_legacy_minors, int, 0444);
static DEFINE_SPINLOCK(comedi_file_info_table_lock);
static struct comedi_device_file_info
- *comedi_file_info_table[COMEDI_NUM_MINORS];
+*comedi_file_info_table[COMEDI_NUM_MINORS];
-static int do_devconfig_ioctl(struct comedi_device *dev, struct comedi_devconfig *arg);
+static int do_devconfig_ioctl(struct comedi_device *dev,
+ struct comedi_devconfig *arg);
static int do_bufconfig_ioctl(struct comedi_device *dev, void *arg);
-static int do_devinfo_ioctl(struct comedi_device *dev, struct comedi_devinfo *arg,
- struct file *file);
-static int do_subdinfo_ioctl(struct comedi_device *dev, struct comedi_subdinfo *arg,
- void *file);
-static int do_chaninfo_ioctl(struct comedi_device *dev, struct comedi_chaninfo *arg);
+static int do_devinfo_ioctl(struct comedi_device *dev,
+ struct comedi_devinfo *arg, struct file *file);
+static int do_subdinfo_ioctl(struct comedi_device *dev,
+ struct comedi_subdinfo *arg, void *file);
+static int do_chaninfo_ioctl(struct comedi_device *dev,
+ struct comedi_chaninfo *arg);
static int do_bufinfo_ioctl(struct comedi_device *dev, void *arg);
static int do_cmd_ioctl(struct comedi_device *dev, void *arg, void *file);
-static int do_lock_ioctl(struct comedi_device *dev, unsigned int arg, void *file);
-static int do_unlock_ioctl(struct comedi_device *dev, unsigned int arg, void *file);
-static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg, void *file);
+static int do_lock_ioctl(struct comedi_device *dev, unsigned int arg,
+ void *file);
+static int do_unlock_ioctl(struct comedi_device *dev, unsigned int arg,
+ void *file);
+static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg,
+ void *file);
static int do_cmdtest_ioctl(struct comedi_device *dev, void *arg, void *file);
static int do_insnlist_ioctl(struct comedi_device *dev, void *arg, void *file);
static int do_insn_ioctl(struct comedi_device *dev, void *arg, void *file);
-static int do_poll_ioctl(struct comedi_device *dev, unsigned int subd, void *file);
+static int do_poll_ioctl(struct comedi_device *dev, unsigned int subd,
+ void *file);
-extern void do_become_nonbusy(struct comedi_device *dev, struct comedi_subdevice *s);
+extern void do_become_nonbusy(struct comedi_device *dev,
+ struct comedi_subdevice *s);
static int do_cancel(struct comedi_device *dev, struct comedi_subdevice *s);
static int comedi_fasync(int fd, struct file *file, int on);
@@ -202,7 +209,8 @@ done:
writes:
none
*/
-static int do_devconfig_ioctl(struct comedi_device *dev, struct comedi_devconfig *arg)
+static int do_devconfig_ioctl(struct comedi_device *dev,
+ struct comedi_devconfig *arg)
{
struct comedi_devconfig it;
int ret;
@@ -342,8 +350,8 @@ copyback:
devinfo structure
*/
-static int do_devinfo_ioctl(struct comedi_device *dev, struct comedi_devinfo *arg,
- struct file *file)
+static int do_devinfo_ioctl(struct comedi_device *dev,
+ struct comedi_devinfo *arg, struct file *file)
{
struct comedi_devinfo devinfo;
const unsigned minor = iminor(file->f_dentry->d_inode);
@@ -392,14 +400,16 @@ static int do_devinfo_ioctl(struct comedi_device *dev, struct comedi_devinfo *ar
array of subdevice info structures at arg
*/
-static int do_subdinfo_ioctl(struct comedi_device *dev, struct comedi_subdinfo *arg,
- void *file)
+static int do_subdinfo_ioctl(struct comedi_device *dev,
+ struct comedi_subdinfo *arg, void *file)
{
int ret, i;
struct comedi_subdinfo *tmp, *us;
struct comedi_subdevice *s;
- tmp = kcalloc(dev->n_subdevices, sizeof(struct comedi_subdinfo), GFP_KERNEL);
+ tmp =
+ kcalloc(dev->n_subdevices, sizeof(struct comedi_subdinfo),
+ GFP_KERNEL);
if (!tmp)
return -ENOMEM;
@@ -472,7 +482,8 @@ static int do_subdinfo_ioctl(struct comedi_device *dev, struct comedi_subdinfo *
arrays at elements of chaninfo structure
*/
-static int do_chaninfo_ioctl(struct comedi_device *dev, struct comedi_chaninfo *arg)
+static int do_chaninfo_ioctl(struct comedi_device *dev,
+ struct comedi_chaninfo *arg)
{
struct comedi_subdevice *s;
struct comedi_chaninfo it;
@@ -514,7 +525,7 @@ static int do_chaninfo_ioctl(struct comedi_device *dev, struct comedi_chaninfo *
}
#if 0
if (copy_to_user(it.rangelist, s->range_type_list,
- s->n_chan*sizeof(unsigned int)))
+ s->n_chan * sizeof(unsigned int)))
return -EFAULT;
#endif
}
@@ -589,8 +600,8 @@ copyback:
return 0;
}
-static int parse_insn(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data,
- void *file);
+static int parse_insn(struct comedi_device *dev, struct comedi_insn *insn,
+ unsigned int *data, void *file);
/*
* COMEDI_INSNLIST
* synchronous instructions
@@ -626,7 +637,8 @@ static int do_insnlist_ioctl(struct comedi_device *dev, void *arg, void *file)
goto error;
}
- insns = kmalloc(sizeof(struct comedi_insn) * insnlist.n_insns, GFP_KERNEL);
+ insns =
+ kmalloc(sizeof(struct comedi_insn) * insnlist.n_insns, GFP_KERNEL);
if (!insns) {
DPRINTK("kmalloc failed\n");
ret = -ENOMEM;
@@ -678,7 +690,8 @@ error:
return i;
}
-static int check_insn_config_length(struct comedi_insn *insn, unsigned int *data)
+static int check_insn_config_length(struct comedi_insn *insn,
+ unsigned int *data)
{
if (insn->n < 1)
return -EINVAL;
@@ -725,22 +738,22 @@ static int check_insn_config_length(struct comedi_insn *insn, unsigned int *data
if (insn->n == 5)
return 0;
break;
- /* by default we allow the insn since we don't have checks for
- * all possible cases yet */
+ /* by default we allow the insn since we don't have checks for
+ * all possible cases yet */
default:
printk("comedi: no check for data length of config insn id "
- "%i is implemented.\n"
- " Add a check to %s in %s.\n"
- " Assuming n=%i is correct.\n", data[0], __func__,
- __FILE__, insn->n);
+ "%i is implemented.\n"
+ " Add a check to %s in %s.\n"
+ " Assuming n=%i is correct.\n", data[0], __func__,
+ __FILE__, insn->n);
return 0;
break;
}
return -EINVAL;
}
-static int parse_insn(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data,
- void *file)
+static int parse_insn(struct comedi_device *dev, struct comedi_insn *insn,
+ unsigned int *data, void *file)
{
struct comedi_subdevice *s;
int ret = 0;
@@ -920,7 +933,8 @@ static int do_insn_ioctl(struct comedi_device *dev, void *arg, void *file)
if (insn.n > MAX_SAMPLES)
insn.n = MAX_SAMPLES;
if (insn.insn & INSN_MASK_WRITE) {
- if (copy_from_user(data, insn.data, insn.n * sizeof(unsigned int))) {
+ if (copy_from_user
+ (data, insn.data, insn.n * sizeof(unsigned int))) {
ret = -EFAULT;
goto error;
}
@@ -929,7 +943,8 @@ static int do_insn_ioctl(struct comedi_device *dev, void *arg, void *file)
if (ret < 0)
goto error;
if (insn.insn & INSN_MASK_READ) {
- if (copy_to_user(insn.data, data, insn.n * sizeof(unsigned int))) {
+ if (copy_to_user
+ (insn.data, data, insn.n * sizeof(unsigned int))) {
ret = -EFAULT;
goto error;
}
@@ -1202,7 +1217,8 @@ cleanup:
*/
-static int do_lock_ioctl(struct comedi_device *dev, unsigned int arg, void *file)
+static int do_lock_ioctl(struct comedi_device *dev, unsigned int arg,
+ void *file)
{
int ret = 0;
unsigned long flags;
@@ -1246,7 +1262,8 @@ static int do_lock_ioctl(struct comedi_device *dev, unsigned int arg, void *file
This function isn't protected by the semaphore, since
we already own the lock.
*/
-static int do_unlock_ioctl(struct comedi_device *dev, unsigned int arg, void *file)
+static int do_unlock_ioctl(struct comedi_device *dev, unsigned int arg,
+ void *file)
{
struct comedi_subdevice *s;
@@ -1286,7 +1303,8 @@ static int do_unlock_ioctl(struct comedi_device *dev, unsigned int arg, void *fi
nothing
*/
-static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg, void *file)
+static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg,
+ void *file)
{
struct comedi_subdevice *s;
@@ -1322,7 +1340,8 @@ static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg, void *fi
nothing
*/
-static int do_poll_ioctl(struct comedi_device *dev, unsigned int arg, void *file)
+static int do_poll_ioctl(struct comedi_device *dev, unsigned int arg,
+ void *file)
{
struct comedi_subdevice *s;
@@ -1371,7 +1390,7 @@ void comedi_unmap(struct vm_area_struct *area)
}
static struct vm_operations_struct comedi_vm_ops = {
- .close = comedi_unmap,
+ .close = comedi_unmap,
};
static int comedi_mmap(struct file *file, struct vm_area_struct *vma)
@@ -1428,10 +1447,10 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma)
n_pages = size >> PAGE_SHIFT;
for (i = 0; i < n_pages; ++i) {
if (remap_pfn_range(vma, start,
- page_to_pfn(virt_to_page(async->
- buf_page_list[i].
- virt_addr)),
- PAGE_SIZE, PAGE_SHARED)) {
+ page_to_pfn(virt_to_page
+ (async->buf_page_list
+ [i].virt_addr)), PAGE_SIZE,
+ PAGE_SHARED)) {
retval = -EAGAIN;
goto done;
}
@@ -1449,7 +1468,7 @@ done:
return retval;
}
-static unsigned int comedi_poll(struct file *file, poll_table *wait)
+static unsigned int comedi_poll(struct file *file, poll_table * wait)
{
unsigned int mask = 0;
const unsigned minor = iminor(file->f_dentry->d_inode);
@@ -1496,7 +1515,7 @@ static unsigned int comedi_poll(struct file *file, poll_table *wait)
}
static ssize_t comedi_write(struct file *file, const char *buf, size_t nbytes,
- loff_t *offset)
+ loff_t * offset)
{
struct comedi_subdevice *s;
struct comedi_async *async;
@@ -1598,7 +1617,7 @@ done:
}
static ssize_t comedi_read(struct file *file, char *buf, size_t nbytes,
- loff_t *offset)
+ loff_t * offset)
{
struct comedi_subdevice *s;
struct comedi_async *async;
@@ -1729,7 +1748,8 @@ static int comedi_open(struct inode *inode, struct file *file)
const unsigned minor = iminor(inode);
struct comedi_device_file_info *dev_file_info =
comedi_get_device_file_info(minor);
- struct comedi_device *dev = dev_file_info ? dev_file_info->device : NULL;
+ struct comedi_device *dev =
+ dev_file_info ? dev_file_info->device : NULL;
if (dev == NULL) {
DPRINTK("invalid minor number\n");
@@ -1846,22 +1866,22 @@ static int comedi_fasync(int fd, struct file *file, int on)
}
const struct file_operations comedi_fops = {
- .owner = THIS_MODULE,
+ .owner = THIS_MODULE,
#ifdef HAVE_UNLOCKED_IOCTL
- .unlocked_ioctl = comedi_unlocked_ioctl,
+ .unlocked_ioctl = comedi_unlocked_ioctl,
#else
- .ioctl = comedi_ioctl,
+ .ioctl = comedi_ioctl,
#endif
#ifdef HAVE_COMPAT_IOCTL
- .compat_ioctl = comedi_compat_ioctl,
+ .compat_ioctl = comedi_compat_ioctl,
#endif
- .open = comedi_open,
- .release = comedi_close,
- .read = comedi_read,
- .write = comedi_write,
- .mmap = comedi_mmap,
- .poll = comedi_poll,
- .fasync = comedi_fasync,
+ .open = comedi_open,
+ .release = comedi_close,
+ .read = comedi_read,
+ .write = comedi_write,
+ .mmap = comedi_mmap,
+ .poll = comedi_poll,
+ .fasync = comedi_fasync,
};
struct class *comedi_class;
@@ -1952,7 +1972,6 @@ static void __exit comedi_cleanup(void)
for (i = 0; i < COMEDI_NUM_MINORS; ++i)
BUG_ON(comedi_file_info_table[i]);
-
class_destroy(comedi_class);
cdev_del(&comedi_cdev);
unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0), COMEDI_NUM_MINORS);
@@ -1981,8 +2000,9 @@ void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s)
if ((comedi_get_subdevice_runflags(s) & SRF_RUNNING) == 0)
return;
- if (s->async->
- events & (COMEDI_CB_EOA | COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW)) {
+ if (s->
+ async->events & (COMEDI_CB_EOA | COMEDI_CB_ERROR |
+ COMEDI_CB_OVERFLOW)) {
runflags_mask |= SRF_RUNNING;
}
/* remember if an error event has occured, so an error
@@ -2000,12 +2020,10 @@ void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s)
if (comedi_get_subdevice_runflags(s) & SRF_USER) {
wake_up_interruptible(&async->wait_head);
if (s->subdev_flags & SDF_CMD_READ) {
- kill_fasync(&dev->async_queue, SIGIO,
- POLL_IN);
+ kill_fasync(&dev->async_queue, SIGIO, POLL_IN);
}
if (s->subdev_flags & SDF_CMD_WRITE) {
- kill_fasync(&dev->async_queue, SIGIO,
- POLL_OUT);
+ kill_fasync(&dev->async_queue, SIGIO, POLL_OUT);
}
} else {
if (async->cb_func)
@@ -2103,7 +2121,8 @@ int comedi_alloc_board_minor(struct device *hardware_device)
comedi_device_cleanup(info->device);
kfree(info->device);
kfree(info);
- printk(KERN_ERR "comedi: error: ran out of minor numbers for board device files.\n");
+ printk(KERN_ERR
+ "comedi: error: ran out of minor numbers for board device files.\n");
return -EBUSY;
}
info->device->minor = i;
@@ -2115,29 +2134,33 @@ int comedi_alloc_board_minor(struct device *hardware_device)
dev_set_drvdata(csdev, info);
retval = device_create_file(csdev, &dev_attr_max_read_buffer_kb);
if (retval) {
- printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n",
- dev_attr_max_read_buffer_kb.attr.name);
+ printk(KERN_ERR
+ "comedi: failed to create sysfs attribute file \"%s\".\n",
+ dev_attr_max_read_buffer_kb.attr.name);
comedi_free_board_minor(i);
return retval;
}
retval = device_create_file(csdev, &dev_attr_read_buffer_kb);
if (retval) {
- printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n",
- dev_attr_read_buffer_kb.attr.name);
+ printk(KERN_ERR
+ "comedi: failed to create sysfs attribute file \"%s\".\n",
+ dev_attr_read_buffer_kb.attr.name);
comedi_free_board_minor(i);
return retval;
}
retval = device_create_file(csdev, &dev_attr_max_write_buffer_kb);
if (retval) {
- printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n",
- dev_attr_max_write_buffer_kb.attr.name);
+ printk(KERN_ERR
+ "comedi: failed to create sysfs attribute file \"%s\".\n",
+ dev_attr_max_write_buffer_kb.attr.name);
comedi_free_board_minor(i);
return retval;
}
retval = device_create_file(csdev, &dev_attr_write_buffer_kb);
if (retval) {
- printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n",
- dev_attr_write_buffer_kb.attr.name);
+ printk(KERN_ERR
+ "comedi: failed to create sysfs attribute file \"%s\".\n",
+ dev_attr_write_buffer_kb.attr.name);
comedi_free_board_minor(i);
return retval;
}
@@ -2194,7 +2217,8 @@ int comedi_alloc_subdevice_minor(struct comedi_device *dev,
spin_unlock_irqrestore(&comedi_file_info_table_lock, flags);
if (i == COMEDI_NUM_MINORS) {
kfree(info);
- printk(KERN_ERR "comedi: error: ran out of minor numbers for board device files.\n");
+ printk(KERN_ERR
+ "comedi: error: ran out of minor numbers for board device files.\n");
return -EBUSY;
}
s->minor = i;
@@ -2207,29 +2231,33 @@ int comedi_alloc_subdevice_minor(struct comedi_device *dev,
dev_set_drvdata(csdev, info);
retval = device_create_file(csdev, &dev_attr_max_read_buffer_kb);
if (retval) {
- printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n",
- dev_attr_max_read_buffer_kb.attr.name);
+ printk(KERN_ERR
+ "comedi: failed to create sysfs attribute file \"%s\".\n",
+ dev_attr_max_read_buffer_kb.attr.name);
comedi_free_subdevice_minor(s);
return retval;
}
retval = device_create_file(csdev, &dev_attr_read_buffer_kb);
if (retval) {
- printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n",
- dev_attr_read_buffer_kb.attr.name);
+ printk(KERN_ERR
+ "comedi: failed to create sysfs attribute file \"%s\".\n",
+ dev_attr_read_buffer_kb.attr.name);
comedi_free_subdevice_minor(s);
return retval;
}
retval = device_create_file(csdev, &dev_attr_max_write_buffer_kb);
if (retval) {
- printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n",
- dev_attr_max_write_buffer_kb.attr.name);
+ printk(KERN_ERR
+ "comedi: failed to create sysfs attribute file \"%s\".\n",
+ dev_attr_max_write_buffer_kb.attr.name);
comedi_free_subdevice_minor(s);
return retval;
}
retval = device_create_file(csdev, &dev_attr_write_buffer_kb);
if (retval) {
- printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n",
- dev_attr_write_buffer_kb.attr.name);
+ printk(KERN_ERR
+ "comedi: failed to create sysfs attribute file \"%s\".\n",
+ dev_attr_write_buffer_kb.attr.name);
comedi_free_subdevice_minor(s);
return retval;
}
@@ -2295,7 +2323,7 @@ static int resize_async_buffer(struct comedi_device *dev,
return -EINVAL;
/* make sure buffer is an integral number of pages
- * (we round up) */
+ * (we round up) */
new_size = (new_size + PAGE_SIZE - 1) & PAGE_MASK;
retval = comedi_buf_alloc(dev, s, new_size);
@@ -2324,16 +2352,16 @@ static ssize_t show_max_read_buffer_kb(struct device *dev,
struct comedi_device_file_info *info = dev_get_drvdata(dev);
unsigned max_buffer_size_kb = 0;
struct comedi_subdevice *const read_subdevice =
- comedi_get_read_subdevice(info);
+ comedi_get_read_subdevice(info);
mutex_lock(&info->device->mutex);
if (read_subdevice &&
(read_subdevice->subdev_flags & SDF_CMD_READ) &&
read_subdevice->async) {
max_buffer_size_kb = read_subdevice->async->max_bufsize /
- bytes_per_kibi;
+ bytes_per_kibi;
}
- retval = snprintf(buf, PAGE_SIZE, "%i\n", max_buffer_size_kb);
+ retval = snprintf(buf, PAGE_SIZE, "%i\n", max_buffer_size_kb);
mutex_unlock(&info->device->mutex);
return retval;
@@ -2347,14 +2375,14 @@ static ssize_t store_max_read_buffer_kb(struct device *dev,
unsigned long new_max_size_kb;
uint64_t new_max_size;
struct comedi_subdevice *const read_subdevice =
- comedi_get_read_subdevice(info);
+ comedi_get_read_subdevice(info);
if (strict_strtoul(buf, 10, &new_max_size_kb))
return -EINVAL;
- if (new_max_size_kb != (uint32_t)new_max_size_kb)
+ if (new_max_size_kb != (uint32_t) new_max_size_kb)
return -EINVAL;
- new_max_size = ((uint64_t)new_max_size_kb) * bytes_per_kibi;
- if (new_max_size != (uint32_t)new_max_size)
+ new_max_size = ((uint64_t) new_max_size_kb) * bytes_per_kibi;
+ if (new_max_size != (uint32_t) new_max_size)
return -EINVAL;
mutex_lock(&info->device->mutex);
@@ -2372,9 +2400,8 @@ static ssize_t store_max_read_buffer_kb(struct device *dev,
static struct device_attribute dev_attr_max_read_buffer_kb = {
.attr = {
- .name = "max_read_buffer_kb",
- .mode = S_IRUGO | S_IWUSR
- },
+ .name = "max_read_buffer_kb",
+ .mode = S_IRUGO | S_IWUSR},
.show = &show_max_read_buffer_kb,
.store = &store_max_read_buffer_kb
};
@@ -2386,16 +2413,16 @@ static ssize_t show_read_buffer_kb(struct device *dev,
struct comedi_device_file_info *info = dev_get_drvdata(dev);
unsigned buffer_size_kb = 0;
struct comedi_subdevice *const read_subdevice =
- comedi_get_read_subdevice(info);
+ comedi_get_read_subdevice(info);
mutex_lock(&info->device->mutex);
if (read_subdevice &&
- (read_subdevice->subdev_flags & SDF_CMD_READ) &&
- read_subdevice->async) {
+ (read_subdevice->subdev_flags & SDF_CMD_READ) &&
+ read_subdevice->async) {
buffer_size_kb = read_subdevice->async->prealloc_bufsz /
- bytes_per_kibi;
+ bytes_per_kibi;
}
- retval = snprintf(buf, PAGE_SIZE, "%i\n", buffer_size_kb);
+ retval = snprintf(buf, PAGE_SIZE, "%i\n", buffer_size_kb);
mutex_unlock(&info->device->mutex);
return retval;
@@ -2410,14 +2437,14 @@ static ssize_t store_read_buffer_kb(struct device *dev,
uint64_t new_size;
int retval;
struct comedi_subdevice *const read_subdevice =
- comedi_get_read_subdevice(info);
+ comedi_get_read_subdevice(info);
if (strict_strtoul(buf, 10, &new_size_kb))
return -EINVAL;
- if (new_size_kb != (uint32_t)new_size_kb)
+ if (new_size_kb != (uint32_t) new_size_kb)
return -EINVAL;
- new_size = ((uint64_t)new_size_kb) * bytes_per_kibi;
- if (new_size != (uint32_t)new_size)
+ new_size = ((uint64_t) new_size_kb) * bytes_per_kibi;
+ if (new_size != (uint32_t) new_size)
return -EINVAL;
mutex_lock(&info->device->mutex);
@@ -2438,9 +2465,8 @@ static ssize_t store_read_buffer_kb(struct device *dev,
static struct device_attribute dev_attr_read_buffer_kb = {
.attr = {
- .name = "read_buffer_kb",
- .mode = S_IRUGO | S_IWUSR | S_IWGRP
- },
+ .name = "read_buffer_kb",
+ .mode = S_IRUGO | S_IWUSR | S_IWGRP},
.show = &show_read_buffer_kb,
.store = &store_read_buffer_kb
};
@@ -2453,16 +2479,16 @@ static ssize_t show_max_write_buffer_kb(struct device *dev,
struct comedi_device_file_info *info = dev_get_drvdata(dev);
unsigned max_buffer_size_kb = 0;
struct comedi_subdevice *const write_subdevice =
- comedi_get_write_subdevice(info);
+ comedi_get_write_subdevice(info);
mutex_lock(&info->device->mutex);
if (write_subdevice &&
(write_subdevice->subdev_flags & SDF_CMD_WRITE) &&
write_subdevice->async) {
max_buffer_size_kb = write_subdevice->async->max_bufsize /
- bytes_per_kibi;
+ bytes_per_kibi;
}
- retval = snprintf(buf, PAGE_SIZE, "%i\n", max_buffer_size_kb);
+ retval = snprintf(buf, PAGE_SIZE, "%i\n", max_buffer_size_kb);
mutex_unlock(&info->device->mutex);
return retval;
@@ -2476,14 +2502,14 @@ static ssize_t store_max_write_buffer_kb(struct device *dev,
unsigned long new_max_size_kb;
uint64_t new_max_size;
struct comedi_subdevice *const write_subdevice =
- comedi_get_write_subdevice(info);
+ comedi_get_write_subdevice(info);
if (strict_strtoul(buf, 10, &new_max_size_kb))
return -EINVAL;
- if (new_max_size_kb != (uint32_t)new_max_size_kb)
+ if (new_max_size_kb != (uint32_t) new_max_size_kb)
return -EINVAL;
- new_max_size = ((uint64_t)new_max_size_kb) * bytes_per_kibi;
- if (new_max_size != (uint32_t)new_max_size)
+ new_max_size = ((uint64_t) new_max_size_kb) * bytes_per_kibi;
+ if (new_max_size != (uint32_t) new_max_size)
return -EINVAL;
mutex_lock(&info->device->mutex);
@@ -2501,9 +2527,8 @@ static ssize_t store_max_write_buffer_kb(struct device *dev,
static struct device_attribute dev_attr_max_write_buffer_kb = {
.attr = {
- .name = "max_write_buffer_kb",
- .mode = S_IRUGO | S_IWUSR
- },
+ .name = "max_write_buffer_kb",
+ .mode = S_IRUGO | S_IWUSR},
.show = &show_max_write_buffer_kb,
.store = &store_max_write_buffer_kb
};
@@ -2515,16 +2540,16 @@ static ssize_t show_write_buffer_kb(struct device *dev,
struct comedi_device_file_info *info = dev_get_drvdata(dev);
unsigned buffer_size_kb = 0;
struct comedi_subdevice *const write_subdevice =
- comedi_get_write_subdevice(info);
+ comedi_get_write_subdevice(info);
mutex_lock(&info->device->mutex);
if (write_subdevice &&
(write_subdevice->subdev_flags & SDF_CMD_WRITE) &&
write_subdevice->async) {
buffer_size_kb = write_subdevice->async->prealloc_bufsz /
- bytes_per_kibi;
+ bytes_per_kibi;
}
- retval = snprintf(buf, PAGE_SIZE, "%i\n", buffer_size_kb);
+ retval = snprintf(buf, PAGE_SIZE, "%i\n", buffer_size_kb);
mutex_unlock(&info->device->mutex);
return retval;
@@ -2539,14 +2564,14 @@ static ssize_t store_write_buffer_kb(struct device *dev,
uint64_t new_size;
int retval;
struct comedi_subdevice *const write_subdevice =
- comedi_get_write_subdevice(info);
+ comedi_get_write_subdevice(info);
if (strict_strtoul(buf, 10, &new_size_kb))
return -EINVAL;
- if (new_size_kb != (uint32_t)new_size_kb)
+ if (new_size_kb != (uint32_t) new_size_kb)
return -EINVAL;
- new_size = ((uint64_t)new_size_kb) * bytes_per_kibi;
- if (new_size != (uint32_t)new_size)
+ new_size = ((uint64_t) new_size_kb) * bytes_per_kibi;
+ if (new_size != (uint32_t) new_size)
return -EINVAL;
mutex_lock(&info->device->mutex);
@@ -2557,7 +2582,7 @@ static ssize_t store_write_buffer_kb(struct device *dev,
return -EINVAL;
}
retval = resize_async_buffer(info->device, write_subdevice,
- write_subdevice->async, new_size);
+ write_subdevice->async, new_size);
mutex_unlock(&info->device->mutex);
if (retval < 0)
@@ -2567,9 +2592,8 @@ static ssize_t store_write_buffer_kb(struct device *dev,
static struct device_attribute dev_attr_write_buffer_kb = {
.attr = {
- .name = "write_buffer_kb",
- .mode = S_IRUGO | S_IWUSR | S_IWGRP
- },
+ .name = "write_buffer_kb",
+ .mode = S_IRUGO | S_IWUSR | S_IWGRP},
.show = &show_write_buffer_kb,
.store = &store_write_buffer_kb
};