Skip to content

Commit

Permalink
staging: comedi: das_08: remove the cached 8254 'mode'
Browse files Browse the repository at this point in the history
The driver initially sets all the cached 'mode' values for the
8254 timers to (I8254_MODE0 | I8254_BINARY). It then sets the
timers to that 'mode'. Configuring the counters with the comedi
INSN_CONFIG_SET_COUNTER_MODE updates the 'mode' and then sets
the timers to the 'mode'. The cached value is never read or
used other than for storage.

Just remove the 'mode' usage as it serves no purpose.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jul 6, 2012
1 parent afdd107 commit cba9d4a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/staging/comedi/drivers/das08.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,11 @@ das08ao_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s,

static void i8254_initialize(struct i8254_struct *st)
{
unsigned int mode = I8254_MODE0 | I8254_BINARY;
int i;

for (i = 0; i < 3; ++i)
i8254_set_mode(st->iobase, 0, i, st->mode[i]);
i8254_set_mode(st->iobase, 0, i, mode);
}

static int das08_counter_read(struct comedi_device *dev,
Expand Down Expand Up @@ -478,7 +479,6 @@ static int das08_counter_config(struct comedi_device *dev,

switch (data[0]) {
case INSN_CONFIG_SET_COUNTER_MODE:
st->mode[chan] = data[1];
i8254_set_mode(st->iobase, 0, chan, data[1]);
break;
case INSN_CONFIG_8254_READ_STATUS:
Expand Down Expand Up @@ -852,9 +852,6 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase)
devpriv->i8254.logic2phys[1] = 1;
devpriv->i8254.logic2phys[2] = 2;
devpriv->i8254.iobase = iobase + thisboard->i8254_offset;
devpriv->i8254.mode[0] =
devpriv->i8254.mode[1] =
devpriv->i8254.mode[2] = I8254_MODE0 | I8254_BINARY;
i8254_initialize(&devpriv->i8254);
} else {
s->type = COMEDI_SUBD_UNUSED;
Expand Down

0 comments on commit cba9d4a

Please sign in to comment.