Commit 518d3842 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: ni_660x: tidy up ni_660x_select_pfi_output()

Tidy up this function to fix the checkpatch.pl issues:

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

For aesthetics, remove the static const local variables.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent dc285820
...@@ -817,46 +817,40 @@ static int ni_660x_dio_insn_bits(struct comedi_device *dev, ...@@ -817,46 +817,40 @@ static int ni_660x_dio_insn_bits(struct comedi_device *dev,
} }
static void ni_660x_select_pfi_output(struct comedi_device *dev, static void ni_660x_select_pfi_output(struct comedi_device *dev,
unsigned pfi_channel, unsigned int chan, unsigned int out_sel)
unsigned output_select)
{ {
const struct ni_660x_board *board = dev->board_ptr; const struct ni_660x_board *board = dev->board_ptr;
static const unsigned counter_4_7_first_pfi = 8; unsigned int active_chip = 0;
static const unsigned counter_4_7_last_pfi = 23; unsigned int idle_chip = 0;
unsigned active_chipset = 0; unsigned int bits;
unsigned idle_chipset = 0;
unsigned active_bits;
unsigned idle_bits;
if (board->n_chips > 1) { if (board->n_chips > 1) {
if (output_select == NI660X_IO_CFG_OUT_SEL_COUNTER && if (out_sel == NI660X_IO_CFG_OUT_SEL_COUNTER &&
pfi_channel >= counter_4_7_first_pfi && chan >= 8 && chan <= 23) {
pfi_channel <= counter_4_7_last_pfi) { /* counters 4-7 pfi channels */
active_chipset = 1; active_chip = 1;
idle_chipset = 0; idle_chip = 0;
} else { } else {
active_chipset = 0; /* counters 0-3 pfi channels */
idle_chipset = 1; active_chip = 0;
idle_chip = 1;
} }
} }
if (idle_chipset != active_chipset) { if (idle_chip != active_chip) {
idle_bits = ni_660x_read(dev, idle_chipset, /* set the pfi channel to high-z on the inactive chip */
NI660X_IO_CFG(pfi_channel)); bits = ni_660x_read(dev, idle_chip, NI660X_IO_CFG(chan));
idle_bits &= ~NI660X_IO_CFG_OUT_SEL_MASK(pfi_channel); bits &= ~NI660X_IO_CFG_OUT_SEL_MASK(chan);
idle_bits |= bits |= NI660X_IO_CFG_OUT_SEL(chan,
NI660X_IO_CFG_OUT_SEL(pfi_channel,
NI660X_IO_CFG_OUT_SEL_HIGH_Z); NI660X_IO_CFG_OUT_SEL_HIGH_Z);
ni_660x_write(dev, idle_chipset, idle_bits, ni_660x_write(dev, idle_chip, bits, NI660X_IO_CFG(chan));
NI660X_IO_CFG(pfi_channel));
} }
active_bits = ni_660x_read(dev, active_chipset, /* set the pfi channel output on the active chip */
NI660X_IO_CFG(pfi_channel)); bits = ni_660x_read(dev, active_chip, NI660X_IO_CFG(chan));
active_bits &= ~NI660X_IO_CFG_OUT_SEL_MASK(pfi_channel); bits &= ~NI660X_IO_CFG_OUT_SEL_MASK(chan);
active_bits |= NI660X_IO_CFG_OUT_SEL(pfi_channel, output_select); bits |= NI660X_IO_CFG_OUT_SEL(chan, out_sel);
ni_660x_write(dev, active_chipset, active_bits, ni_660x_write(dev, active_chip, bits, NI660X_IO_CFG(chan));
NI660X_IO_CFG(pfi_channel));
} }
static int ni_660x_set_pfi_routing(struct comedi_device *dev, unsigned chan, static int ni_660x_set_pfi_routing(struct comedi_device *dev, unsigned chan,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment