History log of /drivers/staging/comedi/drivers/comedi_fc.h
Revision Date Author Comments
bfa9facdb13fb7bc47677bc8f590fc816ccd0c9a 15-Sep-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: add comedi_read_array_from_buffer()

The "comedi_fc" module contains a few functions useful to Comedi
drivers. Their functionality is being migrated to the core "comedi"
module and renamed to start with the prefix `comedi_`. As part of this
migration, move `cfc_read_array_from_buffer()` into the core comedi
module and rename it to `comedi_read_array_from_buffer()`. Change the
external declaration of `cfc_read_array_from_buffer()` into an inline
function that calls `comedi_read_array_from_buffer()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
af2c6a8a2429dd40555a9efd4f286eca2ab9add0 15-Sep-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: comedi_fc.h: use comedi_write_array_to_buffer()

Since `cfc_write_array_to_buffer()` is just an inline function that
calls `comedi_write_array_to_buffer()`, replace calls to the former to
the latter in the "comedi_fc.h" header. This is part of the migration
of functionality from the "comedi_fc" module to the core "comedi"
module.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ea29c1d563a4d57db1c2955c22468a0947f110b0 15-Sep-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: add comedi_write_array_to_buffer()

The "comedi_fc" module contains a few functions useful to Comedi
drivers. Their functionality is being migrated to the core "comedi"
module and renamed to start with the prefix `comedi_`. As part of this
migration, move `cfc_write_array_to_buffer()` into the core comedi
module and rename it to `comedi_write_array_to_buffer()`. Change the
external declaration of `cfc_write_array_to_buffer()` into an inline
function that calls `comedi_write_array_to_buffer()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5c520aafa0cb234a9124569f742e82d04ab5006b 15-Sep-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: comedi_fc: cfc_write_array_to_buffer() data is const

The `data` pointer of `cfc_write_array_to_buffer()` ought to point to
`const` data.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5a7803592409dc3b6ea3bce53a7517114f748dc8 15-Sep-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: add comedi_handle_events()

The "comedi_fc" module contains a few functions useful to Comedi
drivers. Their functionality is being migrated to the core "comedi"
module and renamed to start with the prefix `comedi_`. As part of this
migration, move `cfc_handle_events()` into the core comedi module and
rename it to `comedi_handle_events()`. Change the external declaration
of `cfc_handle_events()` into an inline function that calls
`comedi_handle_events()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2b4e1f632478f43bda1b38e04e0d740980fff1f3 15-Sep-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: add comedi_inc_scan_progress()

The "comedi_fc" module contains a few functions useful to Comedi
drivers. Their functionality is being migrated to the core "comedi"
module and renamed to start with the prefix `comedi_`. As part of this
migration, move `cfc_inc_scan_progress()` into the core comedi module
and rename it to `comedi_inc_scan_progress()`. Change the external
declaration of `cfc_inc_scan_progress()` into an inline function that
calls `comedi_inc_scan_progress()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
f146fe63416de7162090a48135d33a2b74a4efcc 15-Sep-2014 Ian Abbott <abbotti@mev.co.uk> staging: comedi: add comedi_bytes_per_scan()

The "comedi_fc" module contains a few functions useful to Comedi
drivers. Their functionality is being migrated to the core "comedi"
module and renamed to start with the prefix `comedi_`. As part of this
migration, move `cfc_bytes_per_scan()` into the core comedi module and
rename it to `comedi_bytes_per_scan()`. Change the external declaration
of `cfc_bytes_per_scan()` into an inline function that calls
`comedi_bytes_per_scan()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
bcc6df4d64be495a4ec68e9af86eca5199a3a30e 08-Mar-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: comedi_fc: export increment_scan_progress()

Rename this function to cfc_inc_scan_progress() and export it for
use by the comedi drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
a1b5b0bfcd9c050f505a1ab6b33c0c0bc1747ab4 08-Mar-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: comedi_fc: export cfc_bytes_per_scan()

This helper function is a bit long to be inlined. Move it to the
source file and export it.

The mite driver is the only external user right now. Update the
Kconfig to select COMEDI_FC when COMEDI_MITE is enabled.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
68ef50f6cb39b78e0e3e5007d16d644c2f18acab 08-Mar-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: comedi_fc: tidy up cfc_bytes_per_scan()

This function returns the total number of bytes for a full scan of
an async command chanlist. The returned value is an unsigned int.

Change all the local variables to unsigned int and use a local
variable for the s->async->cmd.chanlist_len.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
a3065bc9b420dacd54d333a35701adea104842e8 08-Mar-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: comedi_fc: rename comedi_subdevice variables in header

Typically the comedi_subdevice variable is simply named 's'. Rename
the variables in comedi_fc.h.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8af9dd12118ef85ba93812b3388114966313dc6f 08-Mar-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: comedi_fc: remove 'extern' from function prototypes

The 'extern' is not needed in the prototypes for the exported functions
in the header. Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
b6b9377332833dc81313a45f5edfb178a546c2ac 08-Mar-2014 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: comedi_fc: tidy up multi-line comment in header

Tidy up the multi-line comment to follow the CodingStyle.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ca05b81334f46469c6eb4ba7cf8630f3143c22e5 16-Oct-2013 Ian Abbott <abbotti@mev.co.uk> staging: comedi: use unsigned sample in cfc_write_to_buffer()

Sample values in comedi are generally represented as unsigned values.
`cfc_write_to_buffer()` in "comedi_fc.h" currently uses `short` to hold
a 16-bit sample value to be written to the buffer. Change the type of
the parameter to `unsigned short` for consistency.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
641f064e5df6fb3aaeb6256031a153a5efb16ca6 25-Apr-2013 H Hartley Sweeten <hsweeten@visionengravers.com> staging: comedi: remove FSF address from boilerplate text

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>
61ca8bac45ea2fb263b3a7229e00f040df166501 14-Nov-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: comedi_fc.h: introduce new helpers for do_cmdtest step 3

Step 3 of the do_cmdtest functions validates the arguments for the
command to be executed. Most of these are simple tests to see if the
argument "is" a value, a "min" value, or a "max" value. Each of these
tests then clamps the argument to the value if it fails the test.

Introduce three new helper functions in comedi_fc.h to handle these
tests and remove the boilerplate code from the drivers.

The new helper functions are:

cfc_check_trigger_arg_is() - argument must be == the value
cfc_check_trigger_arg_min() - argument must be >= the value
cfc_check_trigger_arg_max() - argument must be <= the value

All of these helpers set the argument to the value and return -EINVAL
if the validation fails.

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>
6c39eed00cb28d4997ddf3a7aa96a1aff48c8828 11-Sep-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: comedi_fc: introduce cfc_check_trigger_is_unique

"Step 2" of each do_cmdtest checks that the trigger sources are
unique by doing something like this for each trigger:

if (cmd->start_src != TRIG_TIMER &&
cmd->start_src != TRIG_FOLLOW &&
cmd->start_src != TRIG_EXT)
err++;
/* Test the remaining triggers similarly */

if (err)
return 2;

Introduce a helper function in comedi_fc to handle this boilerplate.
The drivers can then just do:

err |= cfc_check_trigger_is_unique(cmd->start_src);
/* Test the remaining triggers similarly */

if (err)
return 2;

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>
43b9778eeb789fbfad3ce66da3bbb3440440fbb8 11-Sep-2012 H Hartley Sweeten <hartleys@visionengravers.com> staging: comedi: comedi_fc: introduce cfc_check_trigger_src

All of the comedi drivers that support the 'cmd' callback also
require a 'do_cmdtest' callback. The do_cmdtest validates the
comedi_cmd before it is executed.

"Step 1" of each do_cmdtest does a trivial validation of the
trigger sources by doing something like this for each trigger:

int err = 0;
unsigned int tmp;

tmp = cmd->start_src;
src &= TRIG_NOW;
if (!src || tmp != src)
err++;
/* Test the remaining triggers similarly */

if (err)
return 1;

Introduce a helper function in comedi_fc to handle this boilerplate.
The drivers can then just do:

err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW);
/* Test the remaining triggers similarly */

if (err)
return 1;

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>
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>
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>
6d62a12bb0fde6a70eb18e2ba25e48f6fd5eee07 19-Nov-2008 Greg Kroah-Hartman <gregkh@suse.de> Staging: comedi: fix comedi_fc.h checkpatch.pl issues.

This resolves all the resolvable checkpatch.pl issues in the
comedi_fc.h file.

Cc: David Schleef <ds@schleef.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>
a9f23e00c17567cc4b7ce50cd07226f7bfb70da6 14-Nov-2008 David Schleef <ds@schleef.org> Staging: comedi: comedi driver common function module

This module is shared by many comedi drivers.

From: David Schleef <ds@schleef.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>