<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/staging/comedi, branch v3.2.39</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/drivers/staging/comedi?h=v3.2.39</id>
<link rel='self' href='https://git.amat.us/linux/atom/drivers/staging/comedi?h=v3.2.39'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2013-02-06T04:33:55Z</updated>
<entry>
<title>staging: comedi: don't hijack hardware device private data</title>
<updated>2013-02-06T04:33:55Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2012-03-30T16:14:58Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=ccfabf967ddeff4dad95fe1b97ab3bc2f2da3683'/>
<id>urn:sha1:ccfabf967ddeff4dad95fe1b97ab3bc2f2da3683</id>
<content type='text'>
commit c43435d7722134ed1fda58ce1025f41029bd58ad upstream.

comedi_auto_config() associates a Comedi minor device number with an
auto-configured hardware device and comedi_auto_unconfig() disassociates
it.  Currently, these use the hardware device's private data pointer to
point to some allocated storage holding the minor device number.  This
is a bit of a waste of the hardware device's private data pointer,
preventing it from being used for something more useful by the low-level
comedi device drivers.  For example, it would make more sense if
comedi_usb_auto_config() was passed a pointer to the struct
usb_interface instead of the struct usb_device, but this cannot be done
currently because the low-level comedi drivers already use the private
data pointer in the struct usb_interface for something more useful.

This patch stops the comedi core hijacking the hardware device's private
data pointer.  Instead, comedi_auto_config() stores a pointer to the
hardware device's struct device in the struct comedi_device_file_info
associated with the minor device number, and comedi_auto_unconfig()
calls new function comedi_find_board_minor() to recover the minor device
number associated with the hardware device.

Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>staging: comedi: Kconfig: COMEDI_NI_AT_A2150 should select COMEDI_FC</title>
<updated>2013-02-06T04:33:54Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2013-01-15T14:45:20Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=d36179913a4c811f1e1b508011f1f6b9f48c3729'/>
<id>urn:sha1:d36179913a4c811f1e1b508011f1f6b9f48c3729</id>
<content type='text'>
commit 34ffb33e09132401872fe79e95c30824ce194d23 upstream.

The 'ni_at_a2150' module links to `cfc_write_to_buffer` in the
'comedi_fc' module, so selecting 'COMEDI_NI_AT_A2150' in the kernel
config needs to also select 'COMEDI_FC'.

Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>staging: comedi: comedi_test: fix race when cancelling command</title>
<updated>2013-02-06T04:33:25Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2013-01-04T11:33:21Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=41e52c46717b0120d247d04d330f16d1501d357d'/>
<id>urn:sha1:41e52c46717b0120d247d04d330f16d1501d357d</id>
<content type='text'>
commit c0729eeefdcd76db338f635162bf0739fd2c5f6f upstream.

Éric Piel reported a kernel oops in the "comedi_test" module.  It was a
NULL pointer dereference within `waveform_ai_interrupt()` (actually a
timer function) that sometimes occurred when a running asynchronous
command is cancelled (either by the `COMEDI_CANCEL` ioctl or by closing
the device file).

This seems to be a race between the caller of `waveform_ai_cancel()`
which on return from that function goes and tears down the running
command, and the timer function which uses the command.  In particular,
`async-&gt;cmd.chanlist` gets freed (and the pointer set to NULL) by
`do_become_nonbusy()` in "comedi_fops.c" but a previously scheduled
`waveform_ai_interrupt()` timer function will dereference that pointer
regardless, leading to the oops.

Fix it by replacing the `del_timer()` call in `waveform_ai_cancel()`
with `del_timer_sync()`.

Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Reported-by: Éric Piel &lt;piel@delmic.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>staging: comedi: fix minimum AO period for NI 625x and NI 628x</title>
<updated>2013-02-06T04:33:25Z</updated>
<author>
<name>Éric Piel</name>
<email>piel@delmic.com</email>
</author>
<published>2012-12-19T12:03:13Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=3288bff62342281c6c6cdd2df6e6fc19afe98498'/>
<id>urn:sha1:3288bff62342281c6c6cdd2df6e6fc19afe98498</id>
<content type='text'>
commit 34b55d8c48f4f76044d8f4d6ec3dc786cf210312 upstream.

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.

Signed-off-by: Éric Piel &lt;piel@delmic.com&gt;
Acked-By: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
[bwh: Backported to 3.2: drop hunk for a board that's not listed]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>staging: comedi: amplc_pc236: fix invalid register access during detach</title>
<updated>2012-10-30T23:26:35Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2012-10-03T15:25:17Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=414f1c99192dafc1d09e0188c1481ef722fe05d6'/>
<id>urn:sha1:414f1c99192dafc1d09e0188c1481ef722fe05d6</id>
<content type='text'>
commit aaeb61a97b7159ebe30b18a422d04eeabfa8790b upstream.

`pc236_detach()` is called by the comedi core if it attempted to attach
a device and failed.  `pc236_detach()` calls `pc236_intr_disable()` if
the comedi device private data pointer (`devpriv`) is non-null.  This
test is insufficient as `pc236_intr_disable()` accesses hardware
registers and the attach routine may have failed before it has saved
their I/O base addresses.

Fix it by checking `dev-&gt;iobase` is non-zero before calling
`pc236_intr_disable()` as that means the I/O base addresses have been
saved and the hardware registers can be accessed.  It also implies the
comedi device private data pointer is valid, so there is no need to
check it.

Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
[Ian Abbott: This patch is for the stable 3.0 kernel.]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>staging: comedi: jr3_pci: fix iomem dereference</title>
<updated>2012-10-17T02:49:10Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2012-09-27T16:45:27Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=aeb048baa36390d8550282a305aabc057a5718cc'/>
<id>urn:sha1:aeb048baa36390d8550282a305aabc057a5718cc</id>
<content type='text'>
commit e1878957b4676a17cf398f7f5723b365e9a2ca48 upstream.

Correct a direct dereference of I/O memory to use an appropriate I/O
memory access function.  Note that the pointer being dereferenced is not
currently tagged with `__iomem` but I plan to correct that for 3.7.

Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>staging: comedi: s626: don't dereference insn-&gt;data</title>
<updated>2012-10-17T02:49:00Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2012-09-24T16:20:52Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=5a31f0678b0f3d8e826685567d246711f185cb14'/>
<id>urn:sha1:5a31f0678b0f3d8e826685567d246711f185cb14</id>
<content type='text'>
commit b655c2c4782ed3e2e71d2608154e295a3e860311 upstream.

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

Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Reviewed-by: H Hartley Sweeten &lt;hsweeten@visionengravers.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>staging: comedi: fix memory leak for saved channel list</title>
<updated>2012-10-17T02:48:39Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2012-09-19T18:37:39Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=2a522045b7ede8773e4966b427391184a2b81d0c'/>
<id>urn:sha1:2a522045b7ede8773e4966b427391184a2b81d0c</id>
<content type='text'>
commit c8cad4c89ee3b15935c532210ae6ebb5c0a2734d upstream.

When `do_cmd_ioctl()` allocates memory for the kernel copy of a channel
list, it frees any previously allocated channel list in
`async-&gt;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.

Note that `cleanup_device()` could be called at an inappropriate time
while the comedi device is open, but that's a separate bug not related
to this this patch.

Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>staging: comedi: don't dereference user memory for INSN_INTTRIG</title>
<updated>2012-10-17T02:48:36Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2012-09-18T18:46:58Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=20a94a21d7cc392568e70c945983ecf5a79851ff'/>
<id>urn:sha1:20a94a21d7cc392568e70c945983ecf5a79851ff</id>
<content type='text'>
commit 5d06e3df280bd230e2eadc16372e62818c63e894 upstream.

`parse_insn()` is dereferencing the user-space pointer `insn-&gt;data`
directly when handling the `INSN_INTTRIG` comedi instruction.  It
shouldn't be using `insn-&gt;data` at all; it should be using the separate
`data` pointer passed to the function.  Fix it.

Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>staging: comedi: das08: Correct AO output for das08jr-16-ao</title>
<updated>2012-09-19T14:05:07Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2012-08-31T19:41:30Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=f707d86130d5d292c0f2b19d1bd8f2cad128c929'/>
<id>urn:sha1:f707d86130d5d292c0f2b19d1bd8f2cad128c929</id>
<content type='text'>
commit 61ed59ed09e6ad2b8395178ea5ad5f653bba08e3 upstream.

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 &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
</feed>
