aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/comedi/proc.c
AgeCommit message (Collapse)Author
2013-11-11staging: comedi: use refcount while reading /proc/comediIan Abbott
In the seq_file 'show' handler for "/proc/comedi" - `comedi_read()` in "comedi/proc.c", call `comedi_dev_get_from_minor()` instead of `comedi_dev_from_minor()` to increment the reference counter for the `struct comedi_device` while it is being examined. Call `comedi_dev_put()` to decrement the reference afterwards. Also acquire the `attach_lock` rwsem while checking whether the device is attached. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-23staging: comedi: use a mutex when accessing driver listIan Abbott
Low-level comedi drivers registered with the comedi core by `comedi_driver_register()` are linked together into a simple linked list headed by the `comedi_drivers` variable and chained by the `next` member of `struct comedi_driver`. A driver is removed from the list by `comedi_driver_unregister()`. The driver list is iterated through by `comedi_device_attach()` when the `COMEDI_DEVCONFIG` ioctl is used to attach a "legacy" device to a driver, and is also iterated through by `comedi_read()` in "proc.c" when reading "/proc/comedi". There is currently no protection against items being added or removed from the list while it is being iterated. Add a mutex `comedi_drivers_list_lock` to be locked while adding or removing an item on the list, or when iterating through the list. `comedi_driver_unregister()` also checks for and detaches any devices using the driver. This is currently done before unlinking the driver from the list, but it makes more sense to unlink the driver from the list first to prevent `comedi_device_attach()` attempting to use it, so move the unlinking part to the start of the function. Also, in `comedi_device_attach()` hold on to the mutex until we've finished attempting to attach the device to avoid it interfering with the detachment in `comedi_driver_unregister()`. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-13staging: comedi: remove FSF address from boilerplate textH Hartley Sweeten
Addresses change... Remove the paragraph with the FSF address from all the comedi source files. Also, remove the paragraph about the finding the complete GPL in the COPYING file since it's unnecessary. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-05staging: single_open() leaksAl Viro
Cc: stable@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-04-29comedi: Don't use create_proc_read_entry()David Howells
Don't use create_proc_read_entry() as that is deprecated, but rather use proc_create_data() and seq_file instead. Signed-off-by: David Howells <dhowells@redhat.com> cc: David Schleef <ds@schleef.org> cc: Ian Abbott <abbotti@mev.co.uk> cc: Mori Hess <fmhess@users.sourceforge.net> cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> cc: H Hartley Sweeten <hsweeten@visionengravers.com> cc: devel@driverdev.osuosl.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-04-09get rid of a bunch of open-coded create_proc_read_entry()Al Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-01-07staging: comedi: Makefile: conditionally compile multi-file core moduleH Hartley Sweeten
Instead of using the #ifdef'ery in the comedi_compat32.c and proc.c files to include/exclude them from the comedi core, modify the Makefile to include those files automatically when enabled in the .config. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-07staging: comedi: use comedi_dev_from_minor()H Hartley Sweeten
Remove the need to export comedi_get_device_file_info() by using the new helper comedi_dev_from_minor(). This will also allow us to make the comedi_device_file_info struct private. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-27staging: comedi: remove unnecessary '#define __NO_VERSION__'H Hartley Sweeten
This define is no longer required for multi-file modules. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-20staging: comedi: remove comedi_fops.hIan Abbott
Move the contents of "comedi_fops.h" into "comedi_internal.h" and delete "comedi_fops.h". It only contains a couple of external variable declarations (and #include <linux/types.h>) and one of those isn't even declared in "comedi_fops.c". The other one is an external declaration of a variable used to store a module parameter and some of those are already externally declared in "comedi_internal.h", so they can keep it company! Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2010-05-11Staging: comedi: clean up sparse issues in proc.cGreg Kroah-Hartman
The whole file should be converted to use seqfile, if it's even still needed. Or move to debugfs. Anyway, I fixed up the minor issues here. 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-11Staging: comedi: fix up remaining coding style issue in proc.cGreg Kroah-Hartman
Move the external variable into a .h file, where it belongs. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-11Staging: comedi: fix up coding issues in proc.cGreg Kroah-Hartman
Fixes all but one. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15Staging: Comedi: Lindent changes to comdi driver in staging treeMithlesh Thukral
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-04-03Staging: comedi: Remove comedi_driver typedefBill Pemberton
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03Staging: comedi: Remove comedi_device typedefBill Pemberton
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03Staging: comedi: Remove curly braces where they are not neededBill Pemberton
Changes as suggested by checkpatch.pl. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03Staging: comedi: Move trailing statements to next line as requested by ↵Bill Pemberton
checkpatch Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03Staging: comedi: Add spaces around parens as requested by checkpatch.plBill Pemberton
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03Staging: comedi: Convert C99 style comments to traditional style commentsBill Pemberton
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-01-06Staging: comedi: fix build if CONFIG_PROC_FS is not setJ.R. Mauro
Don't include procfs functions if CONFIG_PROC_FS is not set Signed-off by: J.R. Mauro <jrm8005@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-01-06Staging: add comedi coreDavid Schleef
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>