diff options
author | Ian Abbott <abbotti@mev.co.uk> | 2009-09-21 16:01:56 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-10-09 16:47:25 -0400 |
commit | 2b49d7c40ec0806d93ced89ac6039ddcf223dea7 (patch) | |
tree | 16c2532bafa35108f4b442fbd37ea3c376515097 /drivers/staging | |
parent | 5044a2c0e0e951afeb4dce87e18e10036635410a (diff) |
Staging: comedi: ni_65xx.c: fix insn_bits shift calculation.
Fix insn_bits bitshift calculation for subdevice with non-zero
base_port.
Thanks to cJ-comedi at zougloub dot eu for spotting the bug.
Signed-off-by: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/comedi/drivers/ni_65xx.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index 6b118c15b49..b664ce083fc 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c | |||
@@ -418,15 +418,15 @@ static int ni_65xx_dio_insn_bits(struct comedi_device *dev, | |||
418 | return -EINVAL; | 418 | return -EINVAL; |
419 | base_bitfield_channel = CR_CHAN(insn->chanspec); | 419 | base_bitfield_channel = CR_CHAN(insn->chanspec); |
420 | for (j = 0; j < max_ports_per_bitfield; ++j) { | 420 | for (j = 0; j < max_ports_per_bitfield; ++j) { |
421 | const unsigned port_offset = ni_65xx_port_by_channel(base_bitfield_channel) + j; | ||
421 | const unsigned port = | 422 | const unsigned port = |
422 | sprivate(s)->base_port + | 423 | sprivate(s)->base_port + port_offset; |
423 | ni_65xx_port_by_channel(base_bitfield_channel) + j; | ||
424 | unsigned base_port_channel; | 424 | unsigned base_port_channel; |
425 | unsigned port_mask, port_data, port_read_bits; | 425 | unsigned port_mask, port_data, port_read_bits; |
426 | int bitshift; | 426 | int bitshift; |
427 | if (port >= ni_65xx_total_num_ports(board(dev))) | 427 | if (port >= ni_65xx_total_num_ports(board(dev))) |
428 | break; | 428 | break; |
429 | base_port_channel = port * ni_65xx_channels_per_port; | 429 | base_port_channel = port_offset * ni_65xx_channels_per_port; |
430 | port_mask = data[0]; | 430 | port_mask = data[0]; |
431 | port_data = data[1]; | 431 | port_data = data[1]; |
432 | bitshift = base_port_channel - base_bitfield_channel; | 432 | bitshift = base_port_channel - base_bitfield_channel; |