History log of /drivers/staging/comedi/comedi_fops.c
Revision Date Author Comments
d026b7150e38a1764d83fc57b6e4448d5e278eaf 22-Apr-2012 Julia Lawall <Julia.Lawall@lip6.fr> drivers/staging/comedi/comedi_fops.c: add missing vfree

commit abae41e6438b798e046d721b6ccdd55b4a398170 upstream.

aux_free is freed on all other exits from the function. By removing the
return, we can benefit from the vfree already at the end of the function.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
90ab5ee94171b3e28de6bb42ee30b527014e0be7 13-Jan-2012 Rusty Russell <rusty@rustcorp.com.au> module_param: make bool parameters really bool (drivers & misc)

module_param(bool) used to counter-intuitively take an int. In
fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy
trick.

It's time to remove the int/unsigned int option. For this version
it'll simply give a warning, but it'll break next kernel version.

Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
70fe742c94d4d5e7763c3f864f13c0e907ac3d48 14-Dec-2011 Florian Schmaus <fschmaus@gmail.com> staging: comedi_fops.c whitespace fixes

Changed whitespaces in comedi/*.c to tabs where necessary. All .c
files within comedi now have no obvious style problems as reported by
checkpatch.pl

Signed-off-by: Florian Schmaus <fschmaus@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
c5018168a59b92ec3bd0f7b598e6d0d64d507e1e 08-Dec-2011 Florian Schmaus <fschmaus@gmail.com> staging: comedi: comedi_fops: Removed int overflow check

This became unnecessary with the previous commit.
Improved the readability of the remaining check, by using UINT_MAX.

Signed-off-by: Florian Schmaus <fschmaus@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2e1c394fc398afb75d89c53f933149d33dc9e280 08-Dec-2011 Florian Schmaus <fschmaus@gmail.com> staging: comedi: comedi_fops: Replace deprecated strict_strtoul with kstrtouint

As reported by checkpatch.pl strict_strtoul should be replaced. It was
replaced with kstrtouint since async->max_bufsize is an unsigned int
anyway.

Signed-off-by: Florian Schmaus <fschmaus@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
dfd8ee92a9192d78aa38cf8699df3630a7c88c85 25-Nov-2011 Xi Wang <xi.wang@gmail.com> Staging: comedi: fix integer overflow in do_insnlist_ioctl()

There is a potential integer overflow in do_insnlist_ioctl() if
userspace passes in a large insnlist.n_insns. The call to kmalloc()
would allocate a small buffer, leading to a memory corruption.

The bug was reported by Dan Carpenter <dan.carpenter@oracle.com>
and Haogang Chen <haogangchen@gmail.com>. The patch was suggested by
Ian Abbott <abbotti@mev.co.uk> and Lars-Peter Clausen <lars@metafoo.de>.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reported-by: Haogang Chen <haogangchen@gmail.com>.
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
06b446c8af5db5a98b2eaa30b513c79089ed254b 27-Nov-2011 Greg Kroah-Hartman <gregkh@suse.de> Revert "Staging: comedi: integer overflow in do_insnlist_ioctl()"

This reverts commit e384a41141949843899affcf51f4e6e646c1fe9f.
It's not the correct way to solve this issue.

Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
e384a41141949843899affcf51f4e6e646c1fe9f 04-Nov-2011 Dan Carpenter <dan.carpenter@oracle.com> Staging: comedi: integer overflow in do_insnlist_ioctl()

There is an integer overflow here that could cause memory corruption
on 32 bit systems.

insnlist.n_insns could be a very high value size calculation for
kmalloc() could overflow resulting in a smaller "insns" than
expected. In the for (i = 0; i < insnlist.n_insns; i++) {... loop
we would read past the end of the buffer, possibly corrupting memory
as well.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
6a9ce6b654e491981f6ef7e214cbd4f63e033848 29-Oct-2011 Federico Vaga <federico.vaga@gmail.com> Staging: comedi: fix signal handling in read and write

After sleeping on a wait queue, signal_pending(current) should be
checked (not before sleeping).

Acked-by: Alessandro Rubini <rubini@gnudd.com>
Signed-off-by: Federico Vaga <federico.vaga@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
df30b21cb0eed5ba8a8e0cdfeebc66ba8cde821d 29-Oct-2011 Federico Vaga <federico.vaga@gmail.com> Staging: comedi: fix mmap_count

In comedi_fops, mmap_count is decremented at comedi_vm_ops->close but
it is not incremented at comedi_vm_ops->open. This may result in a negative
counter. The patch introduces the open method to keep the counter
consistent.

The bug was triggerd by this sample code:

mmap(0, ...., comedi_fd);
fork();
exit(0);

Acked-by: Alessandro Rubini <rubini@gnudd.com>
Signed-off-by: Federico Vaga <federico.vaga@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
3ffab428f40849ed5f21bcfd7285bdef7902f9ca 08-Nov-2011 Bernd Porr <berndporr@f2s.com> staging: comedi: fix oops for USB DAQ devices.

This fixes kernel oops when an USB DAQ device is plugged out while it's
communicating with the userspace software.

Signed-off-by: Bernd Porr <berndporr@f2s.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
f5283a4bb8f5ef274e9de58c751edb2a2d66bef4 10-Jul-2011 Mark Pearson <markpearson_de@yahoo.de> Staging: comedi: Fixed coding style issues.

comedi_fops.c : A forward decleration was declared as extern although it
is a function private to this file. Changed the
decleration to static.

Signed-off-by: Mark Pearson <markpearson_de@yahoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
0435f9337f051db77b4eaf02eee83e7a29f3474a 06-Jul-2011 Pavel Roskin <proski@gnu.org> staging: comedi: remove COMEDI_DEVICE_CREATE macro, expand all callers

This is no longer needed as the code is now in the main kernel tree.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
819cbb120eaec7e014e5abd029260db1ca8c5735 25-Jun-2011 Vasiliy Kulikov <segoon@openwall.com> staging: comedi: fix infoleak to userspace

driver_name and board_name are pointers to strings, not buffers of size
COMEDI_NAMELEN. Copying COMEDI_NAMELEN bytes of a string containing
less than COMEDI_NAMELEN-1 bytes would leak some unrelated bytes.

Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
c5274ab09747d0ef829f9b8f040756758e5de55c 13-Jun-2011 Greg Dietsche <Gregory.Dietsche@cuw.edu> staging: remove unnecessary code

Compile tested.
remove unnecessary code that matches this coccinelle pattern
if (...)
return ret;
return ret;

Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>
Acked-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
25985edcedea6396277003854657b5f3cb31a628 31-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi> Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2f644ccfc5a3195290d12b8eedf18a37bba27d98 18-Jan-2011 Ian Abbott <abbotti@mev.co.uk> staging: comedi: Make INSN_BITS behavior consistent across drivers

Most comedi hardware drivers that support the INSN_BITS instruction
ignore the base channel (specified by insn->chanspec) and assume it is
0. The base channel is supposed to affect how the mask (in data[0]) and
bits (in data[1]) are treated. Bit 0 applies to the base channel, bit 1
applies to base channel plus 1, etc.

For subdevices with no more than 32 channels, this patch modifies the
chanspec and data before presenting it to the hardware driver, and
modifies the data bits read back by the hardware driver (into data[1]).
This makes it appear to the hardware driver that the base channel was
set to 0.

For subdevices with more than 32 channels, the instruction is left
unmodified, as it is assumed that the hardware driver takes note of the
base channel in this case in order to provide access beyond channel 31.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
6038f373a3dc1f1c26496e60b6c40b164716f07e 15-Aug-2010 Arnd Bergmann <arnd@arndb.de> llseek: automatically add .llseek fop

All file_operations should get a .llseek operation so we can make
nonseekable_open the default for future file operations without a
.llseek pointer.

The three cases that we can automatically detect are no_llseek, seq_lseek
and default_llseek. For cases where we can we can automatically prove that
the file offset is always ignored, we use noop_llseek, which maintains
the current behavior of not returning an error from a seek.

New drivers should normally not use noop_llseek but instead use no_llseek
and call nonseekable_open at open time. Existing drivers can be converted
to do the same when the maintainer knows for certain that no user code
relies on calling seek on the device file.

The generated code is often incorrectly indented and right now contains
comments that clarify for each added line why a specific variant was
chosen. In the version that gets submitted upstream, the comments will
be gone and I will manually fix the indentation, because there does not
seem to be a way to do that using coccinelle.

Some amount of new code is currently sitting in linux-next that should get
the same modifications, which I will do at the end of the merge window.

Many thanks to Julia Lawall for helping me learn to write a semantic
patch that does all this.

===== begin semantic patch =====
// This adds an llseek= method to all file operations,
// as a preparation for making no_llseek the default.
//
// The rules are
// - use no_llseek explicitly if we do nonseekable_open
// - use seq_lseek for sequential files
// - use default_llseek if we know we access f_pos
// - use noop_llseek if we know we don't access f_pos,
// but we still want to allow users to call lseek
//
@ open1 exists @
identifier nested_open;
@@
nested_open(...)
{
<+...
nonseekable_open(...)
...+>
}

@ open exists@
identifier open_f;
identifier i, f;
identifier open1.nested_open;
@@
int open_f(struct inode *i, struct file *f)
{
<+...
(
nonseekable_open(...)
|
nested_open(...)
)
...+>
}

@ read disable optional_qualifier exists @
identifier read_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
expression E;
identifier func;
@@
ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
{
<+...
(
*off = E
|
*off += E
|
func(..., off, ...)
|
E = *off
)
...+>
}

@ read_no_fpos disable optional_qualifier exists @
identifier read_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
@@
ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
{
... when != off
}

@ write @
identifier write_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
expression E;
identifier func;
@@
ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
{
<+...
(
*off = E
|
*off += E
|
func(..., off, ...)
|
E = *off
)
...+>
}

@ write_no_fpos @
identifier write_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
@@
ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
{
... when != off
}

@ fops0 @
identifier fops;
@@
struct file_operations fops = {
...
};

@ has_llseek depends on fops0 @
identifier fops0.fops;
identifier llseek_f;
@@
struct file_operations fops = {
...
.llseek = llseek_f,
...
};

@ has_read depends on fops0 @
identifier fops0.fops;
identifier read_f;
@@
struct file_operations fops = {
...
.read = read_f,
...
};

@ has_write depends on fops0 @
identifier fops0.fops;
identifier write_f;
@@
struct file_operations fops = {
...
.write = write_f,
...
};

@ has_open depends on fops0 @
identifier fops0.fops;
identifier open_f;
@@
struct file_operations fops = {
...
.open = open_f,
...
};

// use no_llseek if we call nonseekable_open
////////////////////////////////////////////
@ nonseekable1 depends on !has_llseek && has_open @
identifier fops0.fops;
identifier nso ~= "nonseekable_open";
@@
struct file_operations fops = {
... .open = nso, ...
+.llseek = no_llseek, /* nonseekable */
};

@ nonseekable2 depends on !has_llseek @
identifier fops0.fops;
identifier open.open_f;
@@
struct file_operations fops = {
... .open = open_f, ...
+.llseek = no_llseek, /* open uses nonseekable */
};

// use seq_lseek for sequential files
/////////////////////////////////////
@ seq depends on !has_llseek @
identifier fops0.fops;
identifier sr ~= "seq_read";
@@
struct file_operations fops = {
... .read = sr, ...
+.llseek = seq_lseek, /* we have seq_read */
};

// use default_llseek if there is a readdir
///////////////////////////////////////////
@ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier readdir_e;
@@
// any other fop is used that changes pos
struct file_operations fops = {
... .readdir = readdir_e, ...
+.llseek = default_llseek, /* readdir is present */
};

// use default_llseek if at least one of read/write touches f_pos
/////////////////////////////////////////////////////////////////
@ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier read.read_f;
@@
// read fops use offset
struct file_operations fops = {
... .read = read_f, ...
+.llseek = default_llseek, /* read accesses f_pos */
};

@ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier write.write_f;
@@
// write fops use offset
struct file_operations fops = {
... .write = write_f, ...
+ .llseek = default_llseek, /* write accesses f_pos */
};

// Use noop_llseek if neither read nor write accesses f_pos
///////////////////////////////////////////////////////////

@ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier read_no_fpos.read_f;
identifier write_no_fpos.write_f;
@@
// write fops use offset
struct file_operations fops = {
...
.write = write_f,
.read = read_f,
...
+.llseek = noop_llseek, /* read and write both use no f_pos */
};

@ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier write_no_fpos.write_f;
@@
struct file_operations fops = {
... .write = write_f, ...
+.llseek = noop_llseek, /* write uses no f_pos */
};

@ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier read_no_fpos.read_f;
@@
struct file_operations fops = {
... .read = read_f, ...
+.llseek = noop_llseek, /* read uses no f_pos */
};

@ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
@@
struct file_operations fops = {
...
+.llseek = noop_llseek, /* no read or write fn */
};
===== End semantic patch =====

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Julia Lawall <julia@diku.dk>
Cc: Christoph Hellwig <hch@infradead.org>
81604d43ade6abd316444f99ddb633f2e5a3f3eb 05-Sep-2010 Vasiliy Kulikov <segooon@gmail.com> staging: comedi: check return code of put_user

Function put_user may fail. Check for it.

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
3c17ba0743d75f9888d905ddf9f8551c7dd36493 19-May-2010 Ian Abbott <abbotti@mev.co.uk> Staging: comedi: Allow 'open' driver method to fail

Some comedi drivers should return an error from their 'open' method when
something goes wrong. Change the prototype of the 'open' method in
'struct comedi_device' to allow this, and change the drivers that use it.
Propagate any error to the 'open' file operation.

The corresponding 'close' method won't be called when the 'open' method
fails, so drivers failing the 'open' need to clean up any mess they
created.

The dt9812 and serial2002 drivers can now return an error on 'open'.
The jr3_pci driver also uses the 'open' method but doesn't fail it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
53fa827e295d8b09a2446b3126577244644d256d 19-May-2010 Ian Abbott <abbotti@mev.co.uk> Staging: comedi: For COMEDI_BUFINFO, check access to command

Don't allow COMEDI_BUFINFO ioctl if some other file object has locked
the subdevice or has an active command. If there is no active command,
just report back the last buffer position.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
4772c018e35b6a21e8a8bde54568b59998540a16 19-May-2010 Ian Abbott <abbotti@mev.co.uk> Staging: comedi: COMEDI_BUFINFO with no async - report no bytes read or written

When the COMEDI_BUFINFO ioctl is used on a subdevice without
asynchronous streaming command support, set 'bytes_read = 0' and
'bytes_written = 0' in the buffer info returned back to the user.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
d261154057c27f6c1d256b6198b0ad08733f1758 19-May-2010 Ian Abbott <abbotti@mev.co.uk> Staging: comedi: don't write to buffer if command finished

For write(), any data copied to the data buffer after the previously
set up streaming acquisition command has finished won't be used, but a
non-empty write() does not currently return 0 (or -EPIPE on error) after
the command has finished until the data buffer has been filled up.
Change this behavior to return 0 (or -EPIPE) any time after the command
has finished, without bothering to fill up the buffer with more useless
data.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
21fe2eea6381845956322e63e441f351774de7f9 13-May-2010 Mark <reodge@gmail.com> Staging: comedi: Fix long line lengths in comedi_fops.c

This patch fixes lots of long line lengths in comedi_fops.c found by
checkpatch.pl

Signed-off-by: Mark Rankilor <reodge@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
92d0127c9d249c078b0939050f25041ed37be7cd 04-May-2010 Greg Kroah-Hartman <gregkh@suse.de> Staging: comedi: __user markup on comedi_fops.c

Hm, what a mess. I tried to properly mark up the __user pointers,
but for some of these structures, we use them both in the kernel,
and across the user/kernel boundry, which isn't ok. So we end
up generating a few new sparse warnings in places we were not before,
but the large majority of things are now properly tagged in the fops
file.

The whole ioctl interface needs to be carefully looked at in the future.

Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
9e8c604821b372c6e98e9632f5617913bf92ae45 04-May-2010 Greg Kroah-Hartman <gregkh@suse.de> Staging: comedi: make comedi_free_board_minor local to comedi core

No one outside of the comedi core calls this function, so don't export
it to the world.

Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
242e7ad91a067243d7ab63b6a25ed2e085733446 04-May-2010 Greg Kroah-Hartman <gregkh@suse.de> Staging: comedi: make comedi_alloc_board_minor local to comedi core

No one outside of the comedi core calls this function, so create
an internal.h file to put the prototype in, and don't export
it to the world.

Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
181bd67bf5780b941f2cba6247ed1c0cdfce468a 04-May-2010 Greg Kroah-Hartman <gregkh@suse.de> Staging: comedi: make comedi_set_subdevice_runflags() static

No one calls this anymore, except the core comedi code, so
mark it static and don't export it.

Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
0fd0ca75fd9eb0e9cde49c28ad227c2d8d049366 01-May-2010 Greg Kroah-Hartman <gregkh@suse.de> Staging: comedi: rename check_chanlist to comedi_check_chanlist

It's a global function, so properly name it and move the
export to where the function is located at.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
18736438ae4ab3d96602b92446e07cc03c024b02 01-May-2010 Greg Kroah-Hartman <gregkh@suse.de> Staging: comedi: more EXPORT_SYMBOL movement

This moves the markings to the comedi_fops.c file, where
they belong.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
3fffdf2045d0dbca3833f8f54ae41ce5f2c0b8fa 29-Apr-2010 Mark Rankilor <reodge@gmail.com> Staging: comedi: added log level to printk's in comedi_fops.c

This patches comedi_fops.c to add kernel log level to some printk calls

Signed-off-by: Mark Rankilor <reodge@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
20617f22b006e12b81602d80d85f8f3f7efdef45 10-Mar-2010 Pieter De Praetere <pieterc.depraetere@ugent.be> Staging: comedi: fix whitespace coding style issues in comedi_fops.c

Solves warnings found by the checkpatch.pl tool: spaces before tabs.

Signed-off-by: Pieter De Praetere <pieterc.depraetere@ugent.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
6705b68d0be284e2f9949f3657ea65d426d0f988 26-Feb-2010 Andrea Gelmini <andrea.gelmini@gelma.net> Staging: comedi: comedi_fops.c: Checkpatch cleanup

ERROR: do not initialise externals to 0 or NULL
+int comedi_num_legacy_minors = 0;

WARNING: braces {} are not necessary for single statement blocks
+ if (s->subdev_flags & SDF_CMD_READ) {
+ kill_fasync(&dev->async_queue, SIGIO, POLL_IN);
+ }

WARNING: braces {} are not necessary for single statement blocks
+ if (s->subdev_flags & SDF_CMD_WRITE) {
+ kill_fasync(&dev->async_queue, SIGIO, POLL_OUT);
+ }

Signed-off-by: Andrea Gelmini <andrea.gelmini@gelma.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
f4098b4f8ac65e0e44bbe579ac7d32b6e05ffa3b 04-Feb-2010 Paul Elms <paul@uprocera.co.uk> Staging: comedi: fix brace coding style in comedi_fops.c

This patch to the comedi_fops.c file fixes a brace warning found by the checkpatch.pl tool

Signed-off-by: Paul Elms <paul@uprocera.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
5d7ae225540a98b6ee7ab1447c6a1eed89c219cd 18-Oct-2009 Shawn Bohrer <shawn.bohrer@gmail.com> Staging: comedi: remove check for HAVE_COMPAT_IOCTL

All new kernels have support for compat_ioctl so remove the check and support
for older kernels.

Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
00a1855c21ab1efc71db98b0a87ea3d0ee7b8d92 18-Oct-2009 Shawn Bohrer <shawn.bohrer@gmail.com> staging: comedi: Remove check for HAVE_UNLOCKED_IOCTL

All new kernels have unlocked_ioctl so we don't need to check.

Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
b8b5cd9f87e08f72c78d9197bf199821fda4ba36 21-Sep-2009 Ian Abbott <abbotti@mev.co.uk> Staging: comedi: Corrected type of a printk argument in resize_async_buffer().

Signed-off-by: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
0a85b6f0ab0d2edb0d41b32697111ce0e4f43496 08-Jun-2009 Mithlesh Thukral <mithlesh@linsyssoft.com> 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>
a8f80e8ff94ecba629542d9b4b5f5a8ee3eb565c 13-Aug-2009 Eric Paris <eparis@redhat.com> Networking: use CAP_NET_ADMIN when deciding to call request_module

The networking code checks CAP_SYS_MODULE before using request_module() to
try to load a kernel module. While this seems reasonable it's actually
weakening system security since we have to allow CAP_SYS_MODULE for things
like /sbin/ip and bluetoothd which need to be able to trigger module loads.
CAP_SYS_MODULE actually grants those binaries the ability to directly load
any code into the kernel. We should instead be protecting modprobe and the
modules on disk, rather than granting random programs the ability to load code
directly into the kernel. Instead we are going to gate those networking checks
on CAP_NET_ADMIN which still limits them to root but which does not grant
those processes the ability to load arbitrary code into the kernel.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Acked-by: Paul Moore <paul.moore@hp.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: James Morris <jmorris@namei.org>
fcea115462c690ba09f9df7471d60dda0d86a4ea 28-Apr-2009 Greg Kroah-Hartman <gregkh@suse.de> Staging: comedi: remove some RT code that lingered

This removes some pieces of RT code that was part of the main code
paths.

Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
25436dc9d84f1be60ff549c9ab712bba2835f284 28-Apr-2009 Greg Kroah-Hartman <gregkh@suse.de> Staging: comedi: remove RT code

This removes the unused RT code from the comedi subsystem.

A lot of drivers needed to then include interrupt.h on their own, as they
were picking it up through the comedi_rt.h inclusion.

Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
5f74ea14c07fee91d3bdbaad88bff6264c6200e6 27-Apr-2009 Greg Kroah-Hartman <gregkh@suse.de> Staging: comedi: remove comedi-specific wrappers

There are a number of comedi "wrappers" for some RT functions that are
about to go away. This patch removes all of the wrapper calls within
the comedi drivers and core in order to prepare for removing the RT
comedi code.

Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
883db3d9bb4d50f05cbb8b5197f6aef10c1231a9 14-Apr-2009 Frank Mori Hess <fmhess@users.sourceforge.net> Staging: comedi: Added sysfs attribute files for setting and querying subdevice buffer sizes.

Signed-off-by: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
9aa5339ac1eba5268df69bbcdf1abb9fae5afeca 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove comedi_bufinfo typedef

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
be6aba4a423629126f318d351b2d0eb00abb9dd5 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove comedi_bufconfig typedef

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
0707bb04be89b18ee83b5a997e36cc585f0b988d 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove comedi_devconfig typedef

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
063db04b8901c5cf84c552a5053748d183d34e61 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove comedi_devinfo typedef

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
bd52efbbcc9f5d70c736b9b73c82aee149da1fe5 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove comedi_subdinfo typedef

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
a18b416dc11ff9596ebf2012b1d15f485b951b28 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove comedi_chaninfo typedef

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
da613f4fabb43b8bc551bb874792e1f22a698696 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove comedi_insnlist typedef

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
90035c0886b256d75bced13b3b3cea5234aff136 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove comedi_insn typedef

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
ea6d0d4cab4f4f2d6a88f3bce4707fe92696fd3f 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove comedi_cmd typedef

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
0bfbbe8f09617247c87d3b626cbf007c423afff1 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove device_create_result_type typedef

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
d163679ceec20c50f9aee880fa76c0c1185244a8 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove comedi_async typedef

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
34c43922e62708d45e9660eee4b4f1fb7b4bf2c7 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove comedi_subdevice typedef

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
71b5f4f11971dea972832ad63a994c7e5b45db6b 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove comedi_device typedef

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
790c55415aa31f4c732729f94d2c3a54f7d3bfc2 17-Mar-2009 Bill Pemberton <wfp5p@virginia.edu> Staging: comedi: Remove lsampl_t and sampl_t typedefs

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
979200719d35934367bbf97d9b7d22d5b5281dda 09-Feb-2009 Ian Abbott <abbotti@mev.co.uk> Staging: comedi: comedi_open: Fix null pointer dereference.

This can happen if other minor devices are used.

From: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Cc: David Schleef <ds@schleef.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
56d92c60e6dc708541711e9de4993e7d527d08e8 09-Feb-2009 Ian Abbott <abbotti@mev.co.uk> Staging: comedi: newer gcc warning fixes

Fix GCC warning in call to request_module(): "format not a string
literal and no format arguments".

From: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Cc: David Schleef <ds@schleef.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
53b670a75bef4bf6484bbf6ca6a896c365676fd4 15-Dec-2008 Frank Mori Hess <fmhess@users.sourceforge.net> Staging: comedi: fix bug with invalid minor number usage.

Return error instead of segfaulting if user trys to run comedi_config on
a device file with and invalid minor number.

From: Frank Mori Hess <fmhess@users.sourceforge.net>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: David Schleef <ds@schleef.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
a3cb729ef4a192f04179f780122df78ef1ffe779 15-Dec-2008 Frank Mori Hess <fmhess@users.sourceforge.net> Staging: comedi: Added some validation of comedi module parameter values.

Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: David Schleef <ds@schleef.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
4c41f3ae3bf0bcc53f259b657c2fbc3961ff2b8a 09-Dec-2008 Frank Mori Hess <fmhess@users.sourceforge.net> Staging: comedi: Fixed minor numbers for subdevice files.

Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: David Schleef <ds@schleef.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1dd33ab8a9397793d65b9fc090174ff7cdfaff95 09-Dec-2008 Bernd Porr <BerndPorr@f2s.com> Staging: comedi: add comedi_num_legacy_minors module parameter

As suggested the legacy device count is set to zero. A new module
parameter for comedi_fops allows setting the number of legacy devices:
comedi_num_legacy_minors. The default is zero.


From: Bernd Porr <BerndPorr@f2s.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Cc: David Schleef <ds@schleef.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
6a9d7a21d710e544df20266b83b7829d9f7a1020 08-Dec-2008 Ian Abbott <abbotti@mev.co.uk> Staging: comedi: Add a module parameter 'comedi_autoconfig'.

Set it to 0 or 'N' to disable autoconfiguration.
It is enabled by default.

From: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Cc: David Schleef <ds@schleef.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
476b847733636ce5765093f5d1a369cc470e78e6 14-Nov-2008 Greg Kroah-Hartman <gregkh@suse.de> Staging: comedi: fix checkpatch.pl errors in comedi_fops.c

There are still some >80 character lines in there, but
this catches the majority of the issues.

Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Cc: David Schleef <ds@schleef.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
ed9eccbe8970f6eedc1b978c157caf1251a896d4 05-Nov-2008 David Schleef <ds@schleef.org> Staging: add comedi core

This adds the Comedi core to the staging tree.
This is a data acquision infrastructure for Linux, providing a common
interface for these types of drivers.

Taken directly from the comedi git tree, with only minor tweaks
by Greg to get it to build properly within the kernel tree.

From: David Schleef <ds@schleef.org>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Shawn Bohrer <shawn.bohrer@gmail.com>
Signed-off-by: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>