comedi.git
9 years agom4/as-linux.m4: don't use backported pcmcia_loop_tuple() master
Ian Abbott [Mon, 29 Apr 2013 14:48:44 +0000 (15:48 +0100)]
m4/as-linux.m4: don't use backported pcmcia_loop_tuple()

Red Hat backported pcmcia_loop_tuple() from 2.6.33 to their 2.6.32
kernel (at least in RHEL6) but they use it in hardly anything, and kept
the older configuration mechanism from 2.6.28 involving
pcmcia_get_first_tuple() and pcmcia_get_next_tuple() macros.

Since they didn't change the prototypes of other functions such as
pcmcia_request_window() or pcmcia_map_mem_page() at the same time as
backporting pcmcia_loop_tuple(), our code that uses those functions in
the callback function passed to pcmcia_loop_tuple() fails to compile for
these Red Hat 2.6.32 kernels.

Change the COMEDI_CHECK_PCMCIA_LOOP_TUPLE configuration test to ignore
pcmcia_loop_tuple() if the pcmcia_get_first_tuple() macro is defined.
This will cause our comedi PCMCIA drivers to use the older configuration
mechanism from the 2.6.28 kernel instead of attempting to use the
broken, backported mechanism.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agos526: backwards compatible change for INSN_CONFIG_GPCT_QUADRATURE_ENCODER
Ian Abbott [Mon, 29 Apr 2013 12:19:56 +0000 (13:19 +0100)]
s526: backwards compatible change for INSN_CONFIG_GPCT_QUADRATURE_ENCODER

For INSN_CONFIG_GPCT_QUADRATURE_ENCODER, if insn->n < 2, use the fixed
counter mode register value that was in use before 2009-08-07, otherwise
read the counter mode register value from data[1].

Also, for INSN_CONFIG_GPCT_SINGLE_PULSE_GENERATOR and
INSN_CONFIG_GPCT_PULSE_TRAIN_GENERATOR, return an error if insn->n < 5.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agos526: remove data[] from s526_gpct_config_t
Ian Abbott [Mon, 29 Apr 2013 12:02:10 +0000 (13:02 +0100)]
s526: remove data[] from s526_gpct_config_t

The elements of the data[] member of s526_gpct_config_t are only
assigned and their values never used.  Get rid of it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agorti800: fix straight-binary/2's-complement option for DAC channel 1
Ian Abbott [Tue, 9 Apr 2013 09:53:23 +0000 (10:53 +0100)]
rti800: fix straight-binary/2's-complement option for DAC channel 1

configuration option[8] is supposed to indicate whether the DAC channel
1 jumpers are set for straight binary or 2's complement coding, with
option[6] doing the same for DAC channel 0.  However, the code that
writes the DAC channels currently uses the option[6] value for both
channels.  Fix it to use the correct option for DAC channel 1.  Thanks
to H Hartley Sweeten for spotting this bug.

Also replace the dac0_range and dac1_range members in the private data
with array dac_range[2], and replace dac0_coding and dac1_coding members
with array dac_coding[2].

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agos626: fix continuous acquisition
Ian Abbott [Fri, 22 Mar 2013 15:47:43 +0000 (15:47 +0000)]
s626: fix continuous acquisition

For the s626 driver, there is a bug in the handling of asynchronous
commands on the AI subdevice when the stop source is `TRIG_NONE`.  The
command should run continuously until cancelled, but the interrupt
handler stops the command running after the first scan.

Avoid the problem by setting `devpriv->ai_sample_count = 1` for the
`TRIG_NONE` stop source case in `s626_ai_cmd()`.  This works because the
interrupt handler does not decrement `devpriv->ai_sample_count` if
`devpriv->ai_continous` is true, so the test for
`devpriv->ai_sample_count` being decremented to 0 (or less) will be
false and so it will not stop the acquisition in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agocomedi/comedi_fops.c: Check length of INSN_CONFIG_DIGITAL_TRIG data
Ian Abbott [Thu, 21 Mar 2013 16:21:52 +0000 (16:21 +0000)]
comedi/comedi_fops.c: Check length of INSN_CONFIG_DIGITAL_TRIG data

`check_insn_config_length()` checks the data length for instructions we
know about.  Expect 6 data values for the INSN_CONFIG_DIGITAL_TRIG
instruction.  None of our drivers support this instruction yet.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoinclude/linux/comedi.h: declare enum comedi_digital_trig_op
Ian Abbott [Thu, 21 Mar 2013 16:16:55 +0000 (16:16 +0000)]
include/linux/comedi.h: declare enum comedi_digital_trig_op

Declare the enumerated type `enum comedi_digital_trig_op` for use with
the INSN_CONFIG_DIGITAL_TRIG instruction and add an explanatory comment
about the instruction.

This is copied from the "staging" drivers, but none of our standalone
drivers use it yet.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoinclude/linux/comedi.h: unindent by one tab
Ian Abbott [Thu, 21 Mar 2013 16:14:50 +0000 (16:14 +0000)]
include/linux/comedi.h: unindent by one tab

A lot of declarations are indented by an extra, unnecessary tab.
Unindent them by one tab stop.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoAUTHORS: Add Florent Boudet
Ian Abbott [Thu, 14 Mar 2013 11:03:10 +0000 (11:03 +0000)]
AUTHORS: Add Florent Boudet

Contributed support for NI PXI-6624 in ni_660x driver.

9 years agoni_660x.c: PCI ids for NI PXI 6624 board
Florent Boudet [Thu, 14 Mar 2013 11:00:00 +0000 (11:00 +0000)]
ni_660x.c: PCI ids for NI PXI 6624 board

I have successfuly used a NI PXI 6624 board with the ni_660x driver.
This board is basically the same as the 6602, with isolated channels and
external voltage source.

Here is a patch to apply to ni_660x.c to add the PCI identifiants for
this board.

9 years agodt9812: use CR_CHAN() for channel number
Ian Abbott [Tue, 5 Mar 2013 13:21:01 +0000 (13:21 +0000)]
dt9812: use CR_CHAN() for channel number

Use `CR_CHAN(insn->chanspec)` for the channel number instead of
`insn->chanspec`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agousbdux*: fix DMA buffers on stack
Ian Abbott [Fri, 22 Feb 2013 10:16:58 +0000 (10:16 +0000)]
usbdux*: fix DMA buffers on stack

Fix instances of DMA buffer on stack being passed to usb_control_msg()
for the usbdux, usbduxfast and usbduxsigma drivers.

Spotted by Kumar Amit Mehta <gmate _dot_ amit _at_ gmail _dot_ com> in
the "staging" sources.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoas-linux.m4: update AS_LINUX_OVERRIDE_KERNEL_RELEASE()
Ian Abbott [Thu, 21 Feb 2013 15:39:10 +0000 (15:39 +0000)]
as-linux.m4: update AS_LINUX_OVERRIDE_KERNEL_RELEASE()

Look for "${INCDIR}/generated/utsrelease.h" first, falling back to
"${INCDIR}/linux/utsrelease.h" and then to "${INCDIR}/linux/version.h".

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoAdd linux/init.h compatibility header.
Ian Abbott [Mon, 11 Feb 2013 17:35:18 +0000 (17:35 +0000)]
Add linux/init.h compatibility header.

Add linux/init.h compatibility header, defining the __devinit,
__devinitdata, __devinitconst, __devexit, __devexitdata, __devexitconst
and __devexit_p(x) macros if they are not already defined.

This is needed for compatibility with Linux kernel 3.8 which removed the
macros.

We could just remove all uses of the macros from the code, but for now
do it this way.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agocomedi_fops: check s->async for read(), write() and poll() handlers
Ian Abbott [Mon, 4 Feb 2013 13:33:06 +0000 (13:33 +0000)]
comedi_fops: check s->async for read(), write() and poll() handlers

Some comedi drivers set dev->read_subdev or dev->write_subdev to a
subdevice that does not set asynchronous commands.  This can cause a
NULL pointer dereference in comedi_read(), comedi_write(), or
comedi_poll() when they try to dereference s->async.

Test to make sure s->async is non-NULL.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agocomedi_test: fix race when cancelling command
Ian Abbott [Fri, 1 Feb 2013 14:03:23 +0000 (14:03 +0000)]
comedi_test: fix race when cancelling command

In waveform_ai_cancel(), replace the call to del_timer() with
del_timer_sync() to avoid a race condition between the timer routine
which may already be running on another CPU and the caller of the cancel
routine which is about to free various bits used by the timer routine
(such as async->cmd.chanlist).

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoni_labpc: correct differential channel sequence for AI commands
Ian Abbott [Tue, 22 Jan 2013 11:59:21 +0000 (11:59 +0000)]
ni_labpc: correct differential channel sequence for AI commands

Tuomas <tvainikk _at_ gmail _dot_ com> reported problems getting
meaningful output from a Lab-PC+ in differential mode for AI cmds, but
AI insn reads gave correct readings.  He tracked it down to two
problems, one of which is addressed by this patch.

It seems the setting of the channel bits for particular scanning modes
was incorrect for differential mode.  (Only half the number of channels
are available in differential mode; comedi refers to them as channels
0, 1, 2 and 3, but the hardware documentation refers to them as channels
0, 2, 4 and 6.)  In differential mode, the setting of the channel enable
bits in the command1 register should depend on whether the scan enable
bit is set.  Effectively, we need to double the comedi channel number
when the scan enable bit is not set in differential mode.  The scan
enable bit gets set when the AI scan mode is MODE_MULT_CHAN_UP or
MODE_MULT_CHAN_DOWN, and gets cleared when the AI scan mode is
MODE_SINGLE_CHAN or MODE_SINGLE_CHAN_INTERVAL.  The existing test for
whether the comedi channel number needs to be doubled in differential
mode is incorrect in labpc_ai_cmd().  This patch corrects the test.

Thanks to Tuomas for suggesting the fix.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoni_labpc: set up command4 register *after* command3 register
Ian Abbott [Tue, 22 Jan 2013 11:33:37 +0000 (11:33 +0000)]
ni_labpc: set up command4 register *after* command3 register

Tuomas <tvainikk _at_ gmail _dot_ com> reported problems getting
meaningful output from a Lab-PC+ in differential mode for AI cmds,
but AI insn reads gave correct readings.  He tracked it down to two
problems, one of which is addressed by this patch.

It seems that writing to the command3 register after writing to the
command4 register in labpc_ai_cmd() messes up the differential reference
bit setting in the command4 register.  Set up the command4 register
after the command3 register (as in labpc_ai_rinsn()) to avoid the
problem.

Thanks to Tuomas for suggesting the fix.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agom4/as-linux.m4: Add extra quoting in AS_CHECK_REDHAT_PRE_FC2 macro
Ian Abbott [Mon, 21 Jan 2013 16:47:04 +0000 (16:47 +0000)]
m4/as-linux.m4: Add extra quoting in AS_CHECK_REDHAT_PRE_FC2 macro

Avoid the following warning:

$ ./autogen.sh
configure.ac:42: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call
detected in body
../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from...
../../lib/autoconf/general.m4:2590: _AC_COMPILE_IFELSE is expanded
from...
../../lib/autoconf/general.m4:2606: AC_COMPILE_IFELSE is expanded
from...
m4/as-linux.m4:435: AS_CHECK_REDHAT_PRE_FC2 is expanded from...
m4/as-linux.m4:69: AS_LINUX is expanded from...
configure.ac:42: the top level

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agodt9812: replace err() calls
Ian Abbott [Tue, 15 Jan 2013 12:51:58 +0000 (12:51 +0000)]
dt9812: replace err() calls

Replace the err() calls with dev_err() or printk() as appropriate, as
the err() macro in <linux/usb.h> went away in linux kernel 3.5.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoni_tiocmd: Add missing 'break' in ni_tio_input_cmd().
Ian Abbott [Mon, 14 Jan 2013 10:18:03 +0000 (10:18 +0000)]
ni_tiocmd: Add missing 'break' in ni_tio_input_cmd().

In ni_tio_input_cmd() there is a missing 'break' for 'case TRIG_EXT'
which resulted in mite_arm_dma() being called twice.  Probably mostly
harmless.

Thanks to Dan Carpenter <dan dot carpenter at oracle dot com> for
spotting it in the "staging" sources.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoni_pcimio: fix minimum AO period for NI 625x and NI 628x
Ian Abbott [Wed, 2 Jan 2013 14:56:36 +0000 (14:56 +0000)]
ni_pcimio: fix minimum AO period for NI 625x and NI 628x

Follow patch submitted to the "staging" sources by Éric Piel, who writes:

The minimum period was set to 357 ns, while the divider for these boards
is 50 ns. This prevented to output at maximum speed as ni_ao_cmdtest()
would return 357 but would not accept it.

Not sure why it was set to 357 ns (this was done before the git history,
which starts 5 years ago). My guess is that it comes from reading the
specification stating a 2.8 MHz rate (~ 357 ns). The latest
specification states a 2.86 MHz rate (~ 350 ns), which makes a lot more
sense.

Tested on a pci-6251.

Thanks for the fix, Éric!

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_dio200: fix subdevice type for 'timer' subdevice
Ian Abbott [Thu, 4 Oct 2012 14:16:37 +0000 (15:16 +0100)]
amplc_dio200: fix subdevice type for 'timer' subdevice

The 'timer' subdevice on the PCIe boards should be of type
COMEDI_SUBD_TIMER, not COMEDI_SUBD_COUNTER.  Fix it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_dio200: fix typo in driver comment
Ian Abbott [Wed, 3 Oct 2012 16:54:42 +0000 (17:54 +0100)]
amplc_dio200: fix typo in driver comment

The table showing the interrupt sources for each card shows the wrong
source for interrupt source 3 of the PCIe296.  It should be PPI-Y1-C3,
not PPI-Y2-C3.  Correct it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoFix memory leak for saved channel list
Ian Abbott [Fri, 28 Sep 2012 12:06:54 +0000 (13:06 +0100)]
Fix memory leak for saved channel list

When `do_cmd_ioctl()` allocates memory for the kernel copy of a channel
list, it frees any previously allocated channel list in
`async->cmd.chanlist` and replaces it with the new one.  However, if the
device is ever removed (or "detached") the cleanup code in
`cleanup_device()` in "drivers.c" does not free this memory so it is
lost.

A sensible place to free the kernel copy of the channel list is in
`do_become_nonbusy()` as at that point the comedi asynchronous command
associated with the channel list is no longer valid.  Free the channel
list in `do_become_nonbusy()` instead of `do_cmd_ioctl()` and clear the
pointer to prevent it being freed more than once.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agos526: don't dereference insn->data
Ian Abbott [Fri, 28 Sep 2012 11:12:47 +0000 (12:12 +0100)]
s526: don't dereference insn->data

`s526_gpct_insn_config()` and `s526_gpct_winsn()` are incorrectly
dereferencing `insn->data` which is a pointer to user memory.  They
should be using the separate `data` pointer that points to a copy of the
data in kernel memory.  Fix them.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agos626: don't dereference insn->data
Ian Abbott [Fri, 28 Sep 2012 11:05:05 +0000 (12:05 +0100)]
s626: don't dereference insn->data

`s626_enc_insn_config()` is incorrectly dereferencing `insn->data` which
is a pointer to user memory.  It should be using the separate `data`
parameter that points to a copy of the data in kernel memory.

Note that this insn_config handler is being used incorrectly by this
driver anyway.  `data[0]` should be used to select the type of
configuration being performed, but this driver is treating it as a
counter preload value.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agojr3_pci: fix iomem dereference
Ian Abbott [Fri, 28 Sep 2012 10:59:53 +0000 (11:59 +0100)]
jr3_pci: fix iomem dereference

Correct a direct dereference of I/O memory when writing the 'reset'
register in jr3_pci_attach().  Use writel() to write the register.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agocomedi_fops: fix user-memory dereference for INSN_INTTRIG
Ian Abbott [Tue, 18 Sep 2012 19:00:08 +0000 (20:00 +0100)]
comedi_fops: fix user-memory dereference for INSN_INTTRIG

The parse_insn() function shouldn't dereference `insn->data` as that is
pointing to user-space memory.  It should deference the separate `data`
parameter instead, which points to a kernel copy of the data.  Only the
`INSN_INTTRIG` case needs fixing.  Fix it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agodas08: Correct AO output for das08jr-16-ao
Ian Abbott [Fri, 31 Aug 2012 16:44:16 +0000 (17:44 +0100)]
das08: Correct AO output for das08jr-16-ao

Don't zero out bits 15..12 of the data value in das08jr_ao_winsn() as
that knobbles the upper three quarters of the output range for the
"das08jr-16-ao" board.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agodas08: Fix wrong AI encoding for das08jr-16-ao.
Ian Abbott [Fri, 31 Aug 2012 13:28:39 +0000 (14:28 +0100)]
das08: Fix wrong AI encoding for das08jr-16-ao.

For das08jr-16-ao, the ai_encoding member of the board structure should
be set to das08_encoding16, not das08_encoding12.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoserial2002: Set range for digital inputs and outputs...
Anders Blomdell [Fri, 24 Aug 2012 15:07:14 +0000 (16:07 +0100)]
serial2002: Set range for digital inputs and outputs...

9 years agos626: DIO subdevice 2 should have 16 channels.
Ian Abbott [Tue, 3 Jul 2012 10:27:51 +0000 (11:27 +0100)]
s626: DIO subdevice 2 should have 16 channels.

Subdevice 2 (which is a DIO subdevice) has the wrong number of channels,
48 defined by the S626_DIO_CHANNELS macro.  That is the total number of
DIO channels to be split over 3 subdevices (subdevices 2, 3, 4 with 16
channels each).  Fix the number of channels for subdevice 2.

Spotted by H Hartley Sweeten in the "staging" sources.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoni_670x: Fix possible invalid pointer dereference in ni_670x_detach()
Ian Abbott [Mon, 2 Jul 2012 09:03:40 +0000 (10:03 +0100)]
ni_670x: Fix possible invalid pointer dereference in ni_670x_detach()

In ni_670x_detach(), dev->subdevices will be NULL if the call to
alloc_subdevices() failed in ni_670x_attach(), so don't dereference it
until the pointer has been checked.

Spotted by H Hartley Sweeten in the "staging" sources, but used a
different check due to difference in behavior of alloc_subdevices() on
error between the two versions.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agodkms.conf: Fixed bug in last commit ${kernel_src_dir}
Ian Abbott [Tue, 26 Jun 2012 18:58:00 +0000 (19:58 +0100)]
dkms.conf: Fixed bug in last commit ${kernel_src_dir}

${kernel_src_dir} should be ${kernel_source_dir}.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agodkms.conf: Try harder when looking for ds.h
Ian Abbott [Tue, 26 Jun 2012 17:46:33 +0000 (18:46 +0100)]
dkms.conf: Try harder when looking for ds.h

Some distros don't create /lib/modules/${kernelver}/source directory or
symlink, so the use of the
/lib/modules/${kernelver}/source/include/pcmcia/ds.h fails.  In this
case, use ${kernel_source_dir}/include/pcmcia/ds.h and hope for the
best.

This is useful for some versions of Ubuntu at least.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agodkms.conf: ${kernel_version} should be ${kernelver}
Ian Abbott [Tue, 26 Jun 2012 17:15:17 +0000 (18:15 +0100)]
dkms.conf: ${kernel_version} should be ${kernelver}

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoAdd usbduxsigma to dkms.conf
Ian Abbott [Tue, 26 Jun 2012 16:57:48 +0000 (17:57 +0100)]
Add usbduxsigma to dkms.conf

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_pci230: Fix dangling spin-lock
Ian Abbott [Fri, 8 Jun 2012 09:26:06 +0000 (10:26 +0100)]
amplc_pci230: Fix dangling spin-lock

pci230_ao_inttrig_scan_begin() could return without releasing a
spin-lock.  Fix it.

Spotted by Dan Carpenter in the "staging" sources.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoni_mio_common: ni_release_gpct_mite_channel only used for PCI.
Ian Abbott [Wed, 6 Jun 2012 10:02:27 +0000 (11:02 +0100)]
ni_mio_common: ni_release_gpct_mite_channel only used for PCI.

The ni_release_gpct_mite_channel() function is static, but only called
from code within '#ifdef PCIDMA'.  Wrap the whole function within a
'#ifdef PCIDMA'/'#endif' pair to avoid compiler warning about unused
function for the ni_atmio driver.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoni_mio_common: Made a couple of functions static.
Ian Abbott [Wed, 6 Jun 2012 09:53:30 +0000 (10:53 +0100)]
ni_mio_common: Made a couple of functions static.

Made ni_release_gpct_mite_channel() and ni_prime_channelgain_list()
static.

Spotted by H Hartley Sweeten in the "staging" sources.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoni_labpc: Release spin-lock in labpc_ai_cmd returns an error.
Ian Abbott [Wed, 6 Jun 2012 09:48:09 +0000 (10:48 +0100)]
ni_labpc: Release spin-lock in labpc_ai_cmd returns an error.

There are a couple of places in labpc_ai_cmd() that return without
releasing the spin-lock.  These places should not be reachable, but
release the spin-lock anyway.

Spotted by H Hartley Sweeten in the "staging" sources.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoinclude/linux/firmware.h: Check for FW_ACTION_HOTPLUG.
Ian Abbott [Thu, 31 May 2012 10:08:55 +0000 (11:08 +0100)]
include/linux/firmware.h: Check for FW_ACTION_HOTPLUG.

The FW_ACTION_HOTPLUG and FW_ACTION_NOHOTPLUG macros, and the 'hotplug'
(later renamed 'uevent') parameter of request_firmware_nowait() were
added in vanilla kernel 2.6.14.  Update the include/linux/firmware.h
compatibility code to work with kernels prior to 2.6.14.  If
FW_ACTION_HOTPLUG is not defined, omit the uevent parameter and define
FW_ACTION_HOTPLUG and FW_ACTION_NOHOTPLUG.  The uevent parameter will be
ignored for these older kernels so FW_ACTION_NOHOTPLUG will behave just
like FW_ACTION_HOTPLUG for these older kernels.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoDeal with Red Hat backporting request_firmware_nowait change.
Ian Abbott [Thu, 31 May 2012 09:47:10 +0000 (10:47 +0100)]
Deal with Red Hat backporting request_firmware_nowait change.

An extra 'gfp' parameter was added to request_firmware_nowait() in the
vanilla 2.6.33 kernel and the current <linux/firmware.h> compatibility
header checks for this kernel version.  Unfortunately, Red Hat
backported the change to their 2.6.32 kernel so the code in our
compatibility header breaks on those kernels.

Add a simple configure test to see if the gfp parameter is required and
use this to define CONFIG_COMEDI_REQUEST_FIRMWARE_NOWAIT_HAS_GFP if it
is required.  Change out <linux/firmware.h> compatibility header to
check this macro instead of checking the kernel version directly.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoinclude/linux/firmware.h: Define COMEDI_RELEASE_FIRMWARE_NOWAIT(fw)
Ian Abbott [Thu, 31 May 2012 08:55:02 +0000 (09:55 +0100)]
include/linux/firmware.h: Define COMEDI_RELEASE_FIRMWARE_NOWAIT(fw)

The version of request_firmware_nowait() that takes a gfp_t parameter
also expects its callback function to call release_firmware() to free
the firmware, otherwise there is a memory leak.  The older version of
request_firmware_nowait() doesn't want the callback function to free the
firmware.  Define the macro COMEDI_RELEASE_FIRMWARE_NOWAIT(fw) to be
used in the callback function instead of calling release_firmware(fw)
directly.  This does nothing for the older request_firmware_nowait()
API, but calls release_firmware(fw) for the newer
request_firmware_nowait() API.

Change the request_firmware_nowait callback function in the usbdux,
usbduxfast and usbduxsigma drivers to use
COMEDI_RELEASE_FIRMWARE_NOWAIT().

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_pc263: Change DIO subdevice to DO.
Ian Abbott [Tue, 29 May 2012 15:08:03 +0000 (16:08 +0100)]
amplc_pc263: Change DIO subdevice to DO.

This is a relay output card with no inputs.  Its subdevice is currently
configured as a DIO subdevice.  Change it to a DO subdevice and remove
the insn_config hook.

Also removed the deprecated SDF_RT flag.  Leave the SDF_READABLE flag.
Some drivers set this for DO subdevices and some don't.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_pc263: Correct initial state
Ian Abbott [Tue, 29 May 2012 14:51:41 +0000 (15:51 +0100)]
amplc_pc263: Correct initial state

The initial state of the relays is being read incorrectly.  Fix it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agocomedi.h: Add clock sources for Amplicon timer subdevice.
Ian Abbott [Mon, 28 May 2012 09:40:42 +0000 (10:40 +0100)]
comedi.h: Add clock sources for Amplicon timer subdevice.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_dio200: Implement timer subdevice for new PCIe boards.
Ian Abbott [Mon, 28 May 2012 09:40:42 +0000 (10:40 +0100)]
amplc_dio200: Implement timer subdevice for new PCIe boards.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_dio200: Add 32-bit register access functions.
Ian Abbott [Mon, 28 May 2012 09:40:42 +0000 (10:40 +0100)]
amplc_dio200: Add 32-bit register access functions.

These will be used to support extra features of the PCIe boards.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_dio200: Change description of counter interrupt sources
Ian Abbott [Mon, 28 May 2012 09:40:42 +0000 (10:40 +0100)]
amplc_dio200: Change description of counter interrupt sources

In the device description comment, change the table of interrupt sources
for counter output interrupt sources to make it clearer that channel 1
is the interrupt source.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_dio200: Allow extra clock and gate sources for PCIe boards.
Ian Abbott [Mon, 28 May 2012 09:40:42 +0000 (10:40 +0100)]
amplc_dio200: Allow extra clock and gate sources for PCIe boards.

One of the enhancements of the new PCIe boards is the addition of extra
clock and gate sources.  Allow clock and gate sources up to 31 for these
boards (compared to 7 for the old boards) although most of those are
reserved for future use.

Add constants to comedi.h for the new clock and gate sources.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_dio200: Enable enhanced features of PCIe boards.
Ian Abbott [Mon, 28 May 2012 09:40:42 +0000 (10:40 +0100)]
amplc_dio200: Enable enhanced features of PCIe boards.

The new PCIe boards have some enhanced features compared to the old PCI
boards, although none of these features are supported by amplc_dio200
yet.

Enable the enhanced features in hardware, and use dio200_layouts[] to
indicate which boards support the enhanced features.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_dio200: Allow generation of PCIe interrupts.
Ian Abbott [Mon, 28 May 2012 09:40:41 +0000 (10:40 +0100)]
amplc_dio200: Allow generation of PCIe interrupts.

The new PCIe boards need a special register setting to allow generation
of interrupts.  Add function dio200_pcie_board_setup() to do this
special set-up for the new PCIe boards.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_dio200: Support PCIe215, PCIe236 and PCIe296.
Ian Abbott [Mon, 28 May 2012 09:40:41 +0000 (10:40 +0100)]
amplc_dio200: Support PCIe215, PCIe236 and PCIe296.

Added preliminary support for the above PCIe boards.  The interrupt
subdevice is not working yet as the boards need some additional
initialization to enable interrupts.  Left an unused subdevice that will
eventually become a timer subdevice.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_dio200: Use register size in board stucture.
Ian Abbott [Mon, 28 May 2012 09:40:41 +0000 (10:40 +0100)]
amplc_dio200: Use register size in board stucture.

Store the length of the main register region in new member 'mainsize' of
'struct dio200_board_struct' and initialize it in each element of
'dio200_boards[]'.

Check PCI resource holding the main registers is long enough.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_dio200: Add PCI BAR information to board structure.
Ian Abbott [Mon, 28 May 2012 09:40:41 +0000 (10:40 +0100)]
amplc_dio200: Add PCI BAR information to board structure.

Add 'mainbar' member to 'struct dio200_board_struct', holding the PCI
BAR number for the main registers.  This is 2 for the PCI boards
currently supported (PCI215 and PCI272).

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_dio200: Support memory-mapped I/O for PCI devices
Ian Abbott [Mon, 28 May 2012 09:40:41 +0000 (10:40 +0100)]
amplc_dio200: Support memory-mapped I/O for PCI devices

The cards currently supported by amplc_dio200  all use port I/O.
Support memory-mapped I/O as well for future PCI/PCIe cards.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_dio200: Use custom register access functions
Ian Abbott [Mon, 28 May 2012 09:40:41 +0000 (10:40 +0100)]
amplc_dio200: Use custom register access functions

Add custom functions to access hardware registers instead of calling
inb() and outb() directly.  When we add more card types, these functions
will be changed to use I/O methods appropriate to the card type.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_dio200: Add inline functions to access 8254 counter
Ian Abbott [Mon, 28 May 2012 09:40:41 +0000 (10:40 +0100)]
amplc_dio200: Add inline functions to access 8254 counter

Use our own inline functions to access the 8254 counter registers
instead of the ones in 8253.h.  This will make the code less messy when
we support newer cards.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_dio200: Internalize 8255 DIO subdevice implementation
Ian Abbott [Mon, 28 May 2012 09:40:41 +0000 (10:40 +0100)]
amplc_dio200: Internalize 8255 DIO subdevice implementation

Implement the 8255 DIO subdevice internally to this module instead of
using the external '8255' kernel module.  This will allow the subdevice
to be enhanced with extra features at a later date (for new cards).

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_dio200: Use offsets from base address in subdevice
Ian Abbott [Mon, 28 May 2012 09:40:41 +0000 (10:40 +0100)]
amplc_dio200: Use offsets from base address in subdevice

Replace modified I/O base addresses in the subdevice private structures
for '8254' counter subdevices and the 'INTERRUPT' subdevice with offsets
from the main I/O base address.

This will be useful when I add new supported cards later.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_dio200: Eliminate 'has_int_sce' from 'dio200_subdev_intr'.
Ian Abbott [Mon, 28 May 2012 09:40:40 +0000 (10:40 +0100)]
amplc_dio200: Eliminate 'has_int_sce' from 'dio200_subdev_intr'.

Remove 'has_int_sce' flag from 'struct dio200_subdev_intr'.  Just use
the corresponding flag from the card layout structure instead.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_dio200: Eliminate 'has_clk_gat_sce' from 'dio200_subdev_8254'.
Ian Abbott [Mon, 28 May 2012 09:40:40 +0000 (10:40 +0100)]
amplc_dio200: Eliminate 'has_clk_gat_sce' from 'dio200_subdev_8254'.

Remove 'has_clk_gat_sce' flag from 'struct dio200_subdev_8254'.  Just
use the corresponding flag from the card layout structure instead.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
9 years agoamplc_dio200: Pass device and subdevice to clock/gate config functions
Ian Abbott [Mon, 28 May 2012 09:40:40 +0000 (10:40 +0100)]
amplc_dio200: Pass device and subdevice to clock/gate config functions

Rename the clock and gate configuration functions for the 8254
subdevices and pass in the comedi device and subdevice pointers.

This doesn't achieve anything by itself; it's just preparing for later
changes.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agousbduxfast: Changed model name on Devices line for consistency.
Ian Abbott [Mon, 14 May 2012 13:06:47 +0000 (14:06 +0100)]
usbduxfast: Changed model name on Devices line for consistency.

Changed model name on Devices line from USB-DUX to USB-DUX-FAST for
consistency with the Description line and to avoid confusion.

10 years agoA colon in the description confused one of the scripts down the line in comedilib.
Bernd Porr [Sun, 13 May 2012 14:04:52 +0000 (15:04 +0100)]
A colon in the description confused one of the scripts down the line in comedilib.

10 years agoChanged the headers of usbdux, usbduxfast and usbduxsigma
Bernd Porr [Sun, 13 May 2012 10:06:37 +0000 (11:06 +0100)]
Changed the headers of usbdux, usbduxfast and usbduxsigma
so that there are proper comments and actually useful information.
Thanks Ian for pointing this out.

10 years agousbdux, usbduxfast, usbduxsigma: Drop the '.o' in module name
Ian Abbott [Fri, 11 May 2012 10:50:31 +0000 (11:50 +0100)]
usbdux, usbduxfast, usbduxsigma: Drop the '.o' in module name

In the description comment, drop the '.o' in the module name as we don't
do that any more.  (We dropped it when Comedi supported both 2.4 and 2.6
kernels that used different file extensions for modules.)

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agoHardware_Driver.HOWTO: Change submission instructions.
Ian Abbott [Thu, 26 Apr 2012 08:59:51 +0000 (09:59 +0100)]
Hardware_Driver.HOWTO: Change submission instructions.

The "Adding new drivers" section said new drivers should be sent to
David Schleef for review and integration.  I changed it to say they
should be sent to the mailing list.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agousbduxsigma: Change 'status:' to 'Status:' in driver comment block.
Ian Abbott [Mon, 23 Apr 2012 17:05:34 +0000 (18:05 +0100)]
usbduxsigma: Change 'status:' to 'Status:' in driver comment block.

10 years agocomedi.h: COMEDI_CB_EOA is also used to report end-of-output.
W. Trevor King [Mon, 16 Apr 2012 13:21:40 +0000 (09:21 -0400)]
comedi.h: COMEDI_CB_EOA is also used to report end-of-output.

Signed-off-by: W. Trevor King <wking@drexel.edu>
10 years agoReplace <asm/system.h> with <asm/barrier.h>
Ian Abbott [Mon, 2 Apr 2012 16:13:35 +0000 (17:13 +0100)]
Replace <asm/system.h> with <asm/barrier.h>

Added a compatibility header for <asm/barrier.h> which is being added in
kernel version 3.4, along with the removal of <asm/system.h>.

Changed C files that previously included <asm/system.h> to include
<asm/barrier.h> instead.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agopcl818: Fix write instruction for AO subdevice
Ian Abbott [Tue, 20 Mar 2012 14:40:57 +0000 (14:40 +0000)]
pcl818: Fix write instruction for AO subdevice

Max Korovkin reported that analog output was not working on Advantech
PCI818L and found the cause to be an operator precedence error in
pcl818_ao_insn_write().  The effect of the bug was that the function
wrote to absolute I/O port addresses 6 and 7 (part of the ISA DMA
controller) instead of the port addresses assigned to the board.

The same bug was reported by Kudlaty on 2010-11-25, but was not
investigated further at the time.

The same bug was already fixed by Roel Kluin in the "staging" version of
this driver in the 2.6.31 kernel back in May 2009 (commit
f764df88f86c8db669bd7bfac230b9d2689ae322 in Linus's linux-2.6 git
repository).

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agoUpdate symbolic links to sources during make.
Ian Abbott [Thu, 8 Mar 2012 15:11:02 +0000 (15:11 +0000)]
Update symbolic links to sources during make.

When building outside the source directory, recreate any symbolic links
to the sources if they are broken or pointing to the wrong files.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agoUse 'bool' type for 'bool' module parameters, if supported.
Ian Abbott [Mon, 20 Feb 2012 17:41:50 +0000 (17:41 +0000)]
Use 'bool' type for 'bool' module parameters, if supported.

In the compatibility header for linux/moduleparam.h, define a
type COMEDI_MODULE_PARAM_BOOL_T to be used for 'bool' module parameters.

For kernel versions before 2.6.31, make it an 'int'.

For kernel versions 2.6.31 onwards, make it a 'bool'.  Support for bool
module parameters of type 'int' or 'unsigned int' is going away in
kernel version 3.4.  In kernel version 3.3 it produces a warning.

The only bool module parameter we currently have is 'comedi_autoconfig'.

Moved the #include "comedi_fops.h" after the #include
<linux/moduleparam.h> to get it to compile.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agoTag user memory pointers with __user.
Ian Abbott [Thu, 19 Jan 2012 14:36:08 +0000 (14:36 +0000)]
Tag user memory pointers with __user.

Tag user memory pointers with __user.  Also replace some 'void *'
pointers in ioctl handler functions with more specific pointer types.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agolinux/compiler.h: Define __user and __iomem if missing.
Ian Abbott [Thu, 19 Jan 2012 13:11:15 +0000 (13:11 +0000)]
linux/compiler.h: Define __user and __iomem if missing.

In the linux/compiler.h compatibility header, define the __user and
__iomem macros with empty expansion if they are undefined.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agoamplc_dio200: Fix harmless typo in 8254 subdevice cleanup
Ian Abbott [Tue, 17 Jan 2012 11:03:23 +0000 (11:03 +0000)]
amplc_dio200: Fix harmless typo in 8254 subdevice cleanup

Correct type of 'subpriv' variable in dio200_subdev_8254_cleanup().

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agodt9812: Fix logical || vs bitwise |.
Ian Abbott [Tue, 17 Jan 2012 10:13:59 +0000 (10:13 +0000)]
dt9812: Fix logical || vs bitwise |.

Fix bug discovered by Dan Carpenter in the "staging" sources.

In dt9212_configure_gain(), some bitmask constants were OR'ed together
logically (giving the value 1) when they should have been OR'ed together
bitwise.  The effect of this bug is that the analog gain would be set
incorrectly on the AI subdevice for certain ranges.

As it happens, the driver is incomplete regarding range settings anyway,
so the bug fix currently has no effect.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agoRevert "Check integer overflow in do_cmd_ioctl() and do_cmdtest_ioctl()."
Ian Abbott [Fri, 13 Jan 2012 10:29:58 +0000 (10:29 +0000)]
Revert "Check integer overflow in do_cmd_ioctl() and do_cmdtest_ioctl()."

This reverts commit 824ffcaf3a1bd55a111ed67cf5b0cb3cd18b405f.

The check is unnecessary because user_cmd.chanlist_len has already been
checked against the maximum supported by the subdevice.

Thanks to Dan Carpenter for pointing this out.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agome4000: Correct previous change to INSN_CONFIG.
Ian Abbott [Mon, 9 Jan 2012 15:30:25 +0000 (15:30 +0000)]
me4000: Correct previous change to INSN_CONFIG.

I messed up the previous change to me4000.c on 2011-12-15 which meant
that INSN_CONFIG_DIO_INPUT behaved like INSN_CONFIG_DIO_OUTPUT and vice
versa!  Fix it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agome_daq: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 21:10:21 +0000 (21:10 +0000)]
me_daq: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Also for INSN_WRITE on the AO subdevice, write the nth data value in the
loop instead of the 0th data value.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agoadv_pci_dio: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 21:07:43 +0000 (21:07 +0000)]
adv_pci_dio: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agoni_at_ao: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 21:04:50 +0000 (21:04 +0000)]
ni_at_ao: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agousbdux: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 21:01:48 +0000 (21:01 +0000)]
usbdux: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agodas1800: don't access *data when insn->bits == 0
Ian Abbott [Thu, 15 Dec 2011 20:57:29 +0000 (20:57 +0000)]
das1800: don't access *data when insn->bits == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agoamplc_dio200: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 20:56:11 +0000 (20:56 +0000)]
amplc_dio200: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agocb_pcidas64: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 20:51:45 +0000 (20:51 +0000)]
cb_pcidas64: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agoquatech_daqp_cs: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 20:47:07 +0000 (20:47 +0000)]
quatech_daqp_cs: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agoadl_pci8164: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 20:42:01 +0000 (20:42 +0000)]
adl_pci8164: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Also fixed instructions that printed the value of data[1] and returned 2
even though they only used data[0].

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agoni_mio_common: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 20:32:32 +0000 (20:32 +0000)]
ni_mio_common: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agoaddi_common: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 20:24:17 +0000 (20:24 +0000)]
addi_common: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

The INSN_READ handler for the EEPROM was ignoring insn->n.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agome4000: check for unsupported INSN_CONFIG
Ian Abbott [Thu, 15 Dec 2011 20:21:09 +0000 (20:21 +0000)]
me4000: check for unsupported INSN_CONFIG

The INSN_CONFIG handler for the DIO subdevice should error out for
unsupported configuration instruction codes.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agodt2801: do INSN_CONFIG properly for DIO subdevice
Ian Abbott [Thu, 15 Dec 2011 20:08:16 +0000 (20:08 +0000)]
dt2801: do INSN_CONFIG properly for DIO subdevice

Handle INSN_CONFIG_DIO_INPUT, INSN_CONFIG_DIO_OUTPUT and
INSN_CONFIG_DIO_QUERY in data[0].

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agodt2801: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 20:01:53 +0000 (20:01 +0000)]
dt2801: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agoni_labpc: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 19:55:53 +0000 (19:55 +0000)]
ni_labpc: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agodt282x: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 19:52:32 +0000 (19:52 +0000)]
dt282x: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agocb_pcidda: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 19:44:40 +0000 (19:44 +0000)]
cb_pcidda: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
10 years agodas08: don't access *data when insn->n == 0
Ian Abbott [Thu, 15 Dec 2011 19:38:52 +0000 (19:38 +0000)]
das08: don't access *data when insn->n == 0

Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Also handle INSN_WRITE properly for AO subdevices.  Should use the nth
data value in the loop, not the 0th.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>