staging: comedi: mpc624: tidy up subdevice init
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 6 Oct 2015 00:33:29 +0000 (17:33 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Oct 2015 04:24:11 +0000 (21:24 -0700)
For aesthetics, add some whitespace to the subdevice init. Remove the
unnecessary switch() code used to set the maxdata and range_table.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/mpc624.c

index 41b0e85e55b7321952900b7d3ca702ac2f9e6c5b..7df81cf84d12e80982341514aff66b1914a5f926 100644 (file)
@@ -299,24 +299,15 @@ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        if (ret)
                return ret;
 
+       /* Analog Input subdevice */
        s = &dev->subdevices[0];
-       s->type = COMEDI_SUBD_AI;
-       s->subdev_flags = SDF_READABLE | SDF_DIFF;
-       s->n_chan = 8;
-       switch (it->options[1]) {
-       default:
-               s->maxdata = 0x3FFFFFFF;
-       }
-
-       switch (it->options[1]) {
-       case 0:
-               s->range_table = &range_mpc624_bipolar1;
-               break;
-       default:
-               s->range_table = &range_mpc624_bipolar10;
-       }
-       s->len_chanlist = 1;
-       s->insn_read = mpc624_ai_rinsn;
+       s->type         = COMEDI_SUBD_AI;
+       s->subdev_flags = SDF_READABLE | SDF_DIFF;
+       s->n_chan       = 8;
+       s->maxdata      = 0x3fffffff;
+       s->range_table  = (it->options[1] == 0) ? &range_mpc624_bipolar1
+                                               : &range_mpc624_bipolar10;
+       s->insn_read    = mpc624_ai_rinsn;
 
        return 0;
 }