Commit Graph

46 Commits (e546f485e1d7520ca0200502cdcc11b503f4805c)

Author SHA1 Message Date
Ian Abbott 3c17ba0743 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>
2010-06-17 13:28:56 -07:00
Ian Abbott 53fa827e29 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>
2010-06-04 13:38:53 -07:00
Ian Abbott 4772c018e3 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>
2010-06-04 13:38:53 -07:00
Ian Abbott d261154057 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>
2010-06-04 13:38:53 -07:00
Mark 21fe2eea63 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>
2010-05-14 13:48:02 -07:00
Greg Kroah-Hartman 92d0127c9d 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>
2010-05-11 11:36:03 -07:00
Greg Kroah-Hartman 9e8c604821 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>
2010-05-11 11:36:03 -07:00
Greg Kroah-Hartman 242e7ad91a 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>
2010-05-11 11:36:03 -07:00
Greg Kroah-Hartman 181bd67bf5 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>
2010-05-11 11:36:03 -07:00
Greg Kroah-Hartman 0fd0ca75fd 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>
2010-05-11 11:36:00 -07:00
Greg Kroah-Hartman 18736438ae 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>
2010-05-11 11:36:00 -07:00
Mark Rankilor 3fffdf2045 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>
2010-05-11 11:35:57 -07:00
Pieter De Praetere 20617f22b0 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>
2010-05-11 11:35:35 -07:00
Andrea Gelmini 6705b68d0b 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>
2010-03-04 07:59:01 -08:00
Shawn Bohrer 5d7ae22554 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>
2009-12-11 12:23:01 -08:00
Shawn Bohrer 00a1855c21 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>
2009-12-11 12:23:01 -08:00
Ian Abbott b8b5cd9f87 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>
2009-10-09 13:47:24 -07:00
Mithlesh Thukral 0a85b6f0ab 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>
2009-09-15 12:01:33 -07:00
Eric Paris a8f80e8ff9 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>
2009-08-14 11:18:34 +10:00
Greg Kroah-Hartman fcea115462 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>
2009-06-19 11:00:33 -07:00
Greg Kroah-Hartman 25436dc9d8 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>
2009-06-19 11:00:33 -07:00
Greg Kroah-Hartman 5f74ea14c0 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>
2009-06-19 11:00:33 -07:00
Frank Mori Hess 883db3d9bb 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>
2009-06-19 11:00:30 -07:00
Bill Pemberton 9aa5339ac1 Staging: comedi: Remove comedi_bufinfo typedef
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03 14:53:58 -07:00
Bill Pemberton be6aba4a42 Staging: comedi: Remove comedi_bufconfig typedef
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03 14:53:58 -07:00
Bill Pemberton 0707bb04be Staging: comedi: Remove comedi_devconfig typedef
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03 14:53:58 -07:00
Bill Pemberton 063db04b89 Staging: comedi: Remove comedi_devinfo typedef
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03 14:53:58 -07:00
Bill Pemberton bd52efbbcc Staging: comedi: Remove comedi_subdinfo typedef
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03 14:53:57 -07:00
Bill Pemberton a18b416dc1 Staging: comedi: Remove comedi_chaninfo typedef
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03 14:53:57 -07:00
Bill Pemberton da613f4fab Staging: comedi: Remove comedi_insnlist typedef
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03 14:53:57 -07:00
Bill Pemberton 90035c0886 Staging: comedi: Remove comedi_insn typedef
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03 14:53:57 -07:00
Bill Pemberton ea6d0d4cab Staging: comedi: Remove comedi_cmd typedef
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03 14:53:57 -07:00
Bill Pemberton 0bfbbe8f09 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>
2009-04-03 14:53:56 -07:00
Bill Pemberton d163679cee Staging: comedi: Remove comedi_async typedef
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03 14:53:56 -07:00
Bill Pemberton 34c43922e6 Staging: comedi: Remove comedi_subdevice typedef
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03 14:53:56 -07:00
Bill Pemberton 71b5f4f119 Staging: comedi: Remove comedi_device typedef
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03 14:53:56 -07:00
Bill Pemberton 790c55415a 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>
2009-04-03 14:53:55 -07:00
Ian Abbott 979200719d 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>
2009-04-03 14:53:52 -07:00
Ian Abbott 56d92c60e6 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>
2009-04-03 14:53:52 -07:00
Frank Mori Hess 53b670a75b 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>
2009-04-03 14:53:52 -07:00
Frank Mori Hess a3cb729ef4 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>
2009-04-03 14:53:52 -07:00
Frank Mori Hess 4c41f3ae3b 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>
2009-04-03 14:53:52 -07:00
Bernd Porr 1dd33ab8a9 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>
2009-04-03 14:53:51 -07:00
Ian Abbott 6a9d7a21d7 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>
2009-04-03 14:53:51 -07:00
Greg Kroah-Hartman 476b847733 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>
2009-01-06 13:52:16 -08:00
David Schleef ed9eccbe89 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>
2009-01-06 13:52:16 -08:00