Thanks to Jérôme Carretero (cJ-comedi at zougloub dot eu) for spotting the
bug.
return -EINVAL;
base_bitfield_channel = CR_CHAN(insn->chanspec);
for (j = 0; j < max_ports_per_bitfield; ++j) {
- const unsigned port =
+ unsigned port =
sprivate(s)->base_port +
ni_65xx_port_by_channel(base_bitfield_channel) + j;
unsigned base_port_channel;
int bitshift;
if (port >= ni_65xx_total_num_ports(board(dev)))
break;
- base_port_channel = port * ni_65xx_channels_per_port;
+ base_port_channel = (port - sprivate(s)->base_port) *
+ ni_65xx_channels_per_port;
port_mask = data[0];
port_data = data[1];
bitshift = base_port_channel - base_bitfield_channel;