mirror of https://gitee.com/openkylin/linux.git
677a315656
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 >= 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 <abbotti@mev.co.uk> Cc: <stable@vger.kernel.org> # 3.10.y 3.11.y 3.12.y Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
||
---|---|---|
.. | ||
android | ||
bcm | ||
btmtk_usb | ||
ced1401 | ||
comedi | ||
cptm1217 | ||
crystalhd | ||
cxt1e1 | ||
dgap | ||
dgnc | ||
dgrp | ||
dwc2 | ||
echo | ||
et131x | ||
frontier | ||
ft1000 | ||
fwserial | ||
gdm72xx | ||
gdm724x | ||
goldfish | ||
iio | ||
imx-drm | ||
keucr | ||
line6 | ||
lustre | ||
media | ||
netlogic | ||
nvec | ||
octeon | ||
octeon-usb | ||
olpc_dcon | ||
ozwpan | ||
panel | ||
phison | ||
quickstart | ||
rtl8187se | ||
rtl8188eu | ||
rtl8192e | ||
rtl8192u | ||
rtl8712 | ||
rts5139 | ||
sb105x | ||
sbe-2t3e3 | ||
sep | ||
serqt_usb2 | ||
silicom | ||
slicoss | ||
sm7xxfb | ||
speakup | ||
ste_rmi4 | ||
tidspbridge | ||
usbip | ||
vme | ||
vt6655 | ||
vt6656 | ||
winbond | ||
wlags49_h2 | ||
wlags49_h25 | ||
wlan-ng | ||
xgifb | ||
xillybus | ||
zram | ||
zsmalloc | ||
Kconfig | ||
Makefile | ||
staging.c |