<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/staging/comedi, branch v3.4.90</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/drivers/staging/comedi?h=v3.4.90</id>
<link rel='self' href='https://git.amat.us/linux/atom/drivers/staging/comedi?h=v3.4.90'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2014-01-29T13:10:42Z</updated>
<entry>
<title>staging: comedi: 8255_pci: fix for newer PCI-DIO48H</title>
<updated>2014-01-29T13:10:42Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2013-12-13T12:00:30Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=6013932c9416e0d452e9fbdfeb5a85ec308831dc'/>
<id>urn:sha1:6013932c9416e0d452e9fbdfeb5a85ec308831dc</id>
<content type='text'>
commit 0283f7a100882684ad32b768f9f1ad81658a0b92 upstream.

At some point, Measurement Computing / ComputerBoards redesigned the
PCI-DIO48H to use a PLX PCI interface chip instead of an AMCC chip.
This meant they had to put their hardware registers in the PCI BAR 2
region instead of PCI BAR 1.  Unfortunately, they kept the same PCI
device ID for the new design.  This means the driver recognizes the
newer cards, but doesn't work (and is likely to screw up the local
configuration registers of the PLX chip) because it's using the wrong
region.

Since  the PCI subvendor and subdevice IDs were both zero on the old
design, but are the same as the vendor and device on the new design, we
can tell the old design and new design apart easily enough.  Split the
existing entry for the PCI-DIO48H in `pci_8255_boards[]` into two new
entries, referenced by different entries in the PCI device ID table
`pci_8255_pci_table[]`.  Use the same board name for both entries.

Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Acked-by: H Hartley Sweeten &lt;hsweeten@visionengravers.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>staging: comedi: ssv_dnp: use comedi_dio_update_state()</title>
<updated>2013-12-20T15:34:21Z</updated>
<author>
<name>H Hartley Sweeten</name>
<email>hsweeten@visionengravers.com</email>
</author>
<published>2013-08-30T18:08:50Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=03a0d30fc0a2463df68ac212e1983d5ab3f9f77d'/>
<id>urn:sha1:03a0d30fc0a2463df68ac212e1983d5ab3f9f77d</id>
<content type='text'>
commit f6b316bcd8c421acd6fa5a6e18b4c846ecb9d965 upstream.

Use comedi_dio_update_state() to handle the boilerplate code to update
the subdevice s-&gt;state.

Also, fix a bug where the state of the channels is returned in data[0].
The comedi core expects it to be returned in data[1].

Signed-off-by: H Hartley Sweeten &lt;hsweeten@visionengravers.com&gt;
Reviewed-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>staging: comedi: pcmuio: fix possible NULL deref on detach</title>
<updated>2013-12-20T15:34:21Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2013-08-20T10:50:19Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=70a9deaa57ee1572c95dce7ec1991bf018728f3a'/>
<id>urn:sha1:70a9deaa57ee1572c95dce7ec1991bf018728f3a</id>
<content type='text'>
commit 2fd2bdfccae61efe18f6b92b6a45fbf936d75b48 upstream.

pcmuio_detach() is called by the comedi core even if pcmuio_attach()
returned an error, so `dev-&gt;private` might be `NULL`.  Check for that
before dereferencing it.

Also, as pointed out by Dan Carpenter, there is no need to check the
pointer passed to `kfree()` is non-NULL, so remove that check.

Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Cc: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>staging: comedi: ni_65xx: (bug fix) confine insn_bits to one subdevice</title>
<updated>2013-10-13T22:42:49Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2013-10-10T09:53:46Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=9712612a91e92824349ce9fece31dba6d2fbde70'/>
<id>urn:sha1:9712612a91e92824349ce9fece31dba6d2fbde70</id>
<content type='text'>
commit 677a31565692d596ef42ea589b53ba289abf4713 upstream.

The `insn_bits` handler `ni_65xx_dio_insn_bits()` has a `for` loop that
currently writes (optionally) and reads back up to 5 "ports" consisting
of 8 channels each.  It reads up to 32 1-bit channels but can only read
and write a whole port at once - it needs to handle up to 5 ports as the
first channel it reads might not be aligned on a port boundary.  It
breaks out of the loop early if the next port it handles is beyond the
final port on the card.  It also breaks out early on the 5th port in the
loop if the first channel was aligned.  Unfortunately, it doesn't check
that the current port it is dealing with belongs to the comedi subdevice
the `insn_bits` handler is acting on.  That's a bug.

Redo the `for` loop to terminate after the final port belonging to the
subdevice, changing the loop variable in the process to simplify things
a bit.  The `for` loop could now try and handle more than 5 ports if the
subdevice has more than 40 channels, but the test `if (bitshift &gt;= 32)`
ensures it will break out early after 4 or 5 ports (depending on whether
the first channel is aligned on a port boundary).  (`bitshift` will be
between -7 and 7 inclusive on the first iteration, increasing by 8 for
each subsequent operation.)

Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>staging: comedi: dt282x: dt282x_ai_insn_read() always fails</title>
<updated>2013-09-27T00:15:31Z</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2013-08-20T08:57:35Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=b9ba2a57551649a3386acf0fb54255e5b042bd43'/>
<id>urn:sha1:b9ba2a57551649a3386acf0fb54255e5b042bd43</id>
<content type='text'>
commit 2c4283ca7cdcc6605859c836fc536fcd83a4525f upstream.

In dt282x_ai_insn_read() we call this macro like:
wait_for(!mux_busy(), comedi_error(dev, "timeout\n"); return -ETIME;);
Because the if statement doesn't have curly braces it means we always
return -ETIME and the function never succeeds.

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Acked-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>staging: comedi: COMEDI_CANCEL ioctl should wake up read/write</title>
<updated>2013-08-04T08:25:54Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2013-07-08T12:36:19Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=cf63fbd49c23ad07983e629febfc3cbcc9382d05'/>
<id>urn:sha1:cf63fbd49c23ad07983e629febfc3cbcc9382d05</id>
<content type='text'>
commit 69acbaac303e8cb948801a9ddd0ac24e86cc4a1b upstream.

Comedi devices can do blocking read() or write() (or poll()) if an
asynchronous command has been set up, blocking for data (for read()) or
buffer space (for write()).  Various events associated with the
asynchronous command will wake up the blocked reader or writer (or
poller).  It is also possible to force the asynchronous command to
terminate by issuing a `COMEDI_CANCEL` ioctl.  That shuts down the
asynchronous command, but does not currently wake up the blocked reader
or writer (or poller).  If the blocked task could be woken up, it would
see that the command is no longer active and return.  The caller of the
`COMEDI_CANCEL` ioctl could attempt to wake up the blocked task by
sending a signal, but that's a nasty workaround.

Change `do_cancel_ioctl()` to wake up the wait queue after it returns
from `do_cancel()`.  `do_cancel()` can propagate an error return value
from the low-level comedi driver's cancel routine, but it always shuts
the command down regardless, so `do_cancel_ioctl()` can wake up he wait
queue regardless of the return value from `do_cancel()`.

Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>staging: comedi: s626: fix continuous acquisition</title>
<updated>2013-04-05T17:04:15Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2013-03-22T15:16:29Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=d8022cb2b0ea2e5d926c9e2a041e411d71fd3d9e'/>
<id>urn:sha1:d8022cb2b0ea2e5d926c9e2a041e411d71fd3d9e</id>
<content type='text'>
commit e4317ce877a31dbb9d96375391c1c4ad2210d637 upstream.

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.

The command set-up function `s626_ai_cmd()` contains this code:

	switch (cmd-&gt;stop_src) {
	case TRIG_COUNT:
		/*  data arrives as one packet */
		devpriv-&gt;ai_sample_count = cmd-&gt;stop_arg;
		devpriv-&gt;ai_continous = 0;
		break;
	case TRIG_NONE:
		/*  continous acquisition */
		devpriv-&gt;ai_continous = 1;
		devpriv-&gt;ai_sample_count = 0;
		break;
	}

The interrupt handler `s626_irq_handler()` contains this code:

		if (!(devpriv-&gt;ai_continous))
			devpriv-&gt;ai_sample_count--;
		if (devpriv-&gt;ai_sample_count &lt;= 0) {
			devpriv-&gt;ai_cmd_running = 0;
			/* ... */
		}

So `devpriv-&gt;ai_sample_count` is only decremented for the `TRIG_COUNT`
case, but `devpriv-&gt;ai_cmd_running` is set to 0 (and the command
stopped) regardless.

Fix this in `s626_ai_cmd()` by setting `devpriv-&gt;ai_sample_count = 1`
for the `TRIG_NONE` case.  The interrupt handler will not decrement it
so it will remain greater than 0 and the check for stopping the
acquisition will fail.

Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>staging: comedi: check s-&gt;async for poll(), read() and write()</title>
<updated>2013-03-03T22:06:45Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2013-02-27T10:56:19Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=0685b5924819447dad0413312b508e68168a1ee2'/>
<id>urn:sha1:0685b5924819447dad0413312b508e68168a1ee2</id>
<content type='text'>
commit cc400e185c07c15a42d2635995f422de5b94b696 upstream.

Some low-level comedi drivers (incorrectly) point `dev-&gt;read_subdev` or
`dev-&gt;write_subdev` to a subdevice that does not support asynchronous
commands.  Comedi's poll(), read() and write() file operation handlers
assume these subdevices do support asynchronous commands.  In
particular, they assume `s-&gt;async` is valid (where `s` points to the
read or write subdevice), which it won't be if it has been set
incorrectly.  This can lead to a NULL pointer dereference.

Check `s-&gt;async` is non-NULL in `comedi_poll()`, `comedi_read()` and
`comedi_write()` to avoid the bug.

Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>staging: comedi: ni_labpc: set up command4 register *after* command3</title>
<updated>2013-03-03T22:06:45Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2013-02-27T12:52:46Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=e4cd1e4dba29c756272c2ee9d06b094b4319b90a'/>
<id>urn:sha1:e4cd1e4dba29c756272c2ee9d06b094b4319b90a</id>
<content type='text'>
Commit 22056e2b46246d97ff0f7c6e21a77b8daa07f02c upstream.

Tuomas &lt;tvainikk _at_ gmail _dot_ com&gt; 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 &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>staging: comedi: ni_labpc: correct differential channel sequence for AI commands</title>
<updated>2013-03-03T22:06:44Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2013-02-27T12:52:45Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=1e05b9964644382e9994e62dc5c8eb815e5225fa'/>
<id>urn:sha1:1e05b9964644382e9994e62dc5c8eb815e5225fa</id>
<content type='text'>
Commit 4c4bc25d0fa6beaf054c0b4c3b324487f266c820 upstream.

Tuomas &lt;tvainikk _at_ gmail _dot_ com&gt; 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 &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
</feed>
