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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Anders Blomdell [Fri, 24 Aug 2012 15:07:14 +0000 (16:07 +0100)]
serial2002: Set range for digital inputs and outputs...
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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.
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.
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>
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>
Ian Abbott [Mon, 23 Apr 2012 17:05:34 +0000 (18:05 +0100)]
usbduxsigma: Change 'status:' to 'Status:' in driver comment block.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Ian Abbott [Thu, 15 Dec 2011 19:32:31 +0000 (19:32 +0000)]
ke_counter: 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>
Ian Abbott [Thu, 15 Dec 2011 19:29:52 +0000 (19:29 +0000)]
cb_pcidas: don't access *data when insn-en == 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>
Ian Abbott [Thu, 15 Dec 2011 19:16:04 +0000 (19:16 +0000)]
adv_pci1710: 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, the INSN_WRITE handlers for AO subdevices were incorrectly storing
the data value past the end of the data array for read-back, instead of
the last data value (when insn->n > 0).
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Ian Abbott [Thu, 15 Dec 2011 19:06:37 +0000 (19:06 +0000)]
s526: 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 the INSN_WRITE code for pulse-train generation should only access
data[1] if insn->n >= 2.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Ian Abbott [Thu, 15 Dec 2011 18:46:31 +0000 (18:46 +0000)]
ii_pci20kc: 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>
Ian Abbott [Thu, 15 Dec 2011 18:37:34 +0000 (18:37 +0000)]
poc: 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>
Ian Abbott [Thu, 15 Dec 2011 18:31:00 +0000 (18:31 +0000)]
unioxx5: 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>
Ian Abbott [Thu, 15 Dec 2011 18:01:39 +0000 (18:01 +0000)]
comedi/drivers.c: handle insn->n == 0 in insn_rw_emulate_bits
A recent change to do_insnlist_ioctl() and do_insn_ioctl() to handle
arbitrary limits on means that the 'data' pointer will now be NULL when
insn->n == 0. Need to check insn->n is non-zero before accessing *data.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Ian Abbott [Wed, 30 Nov 2011 14:59:33 +0000 (14:59 +0000)]
usbdux: unlock on error in usbdux_ao_inttrig()
Follow patch by Dan Carpenter to the "staging" sources.
When trignum is invalid it returned without unlocking the mutex.
Fix it.
Ian Abbott [Wed, 30 Nov 2011 14:55:06 +0000 (14:55 +0000)]
usbduxsigma: unlock on error in usbdux_ao_inttrig()
Follow patch by Dan Carpenter to the "staging" sources.
When trignum is invalid it returned without unlocking the mutex.
Fix it.
Ian Abbott [Wed, 23 Nov 2011 15:50:45 +0000 (15:50 +0000)]
Remove arbitrary limit in do_insnlist_ioctl() and do_insn_ioctl().
Remove the arbitrary limit on number of samples per instruction. It
will still be limited by the maximum size of a kmalloc() buffer.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Ian Abbott [Wed, 23 Nov 2011 15:28:57 +0000 (15:28 +0000)]
Check integer overflow in do_cmd_ioctl() and do_cmdtest_ioctl().
Check for integer overflow when allocating buffer for channel list.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>