From: H Hartley Sweeten <hsweeten@visionengravers.com>
Date: Mon, 10 Mar 2014 21:07:36 +0000 (-0700)
Subject: staging: comedi: c6xdigio: tidy up subdevice 0 init
X-Git-Tag: firefly_0821_release~176^2~4193^2~256
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6c8df38a953391ac22b3931fcef9c22faf888c8b;p=firefly-linux-kernel-4.4.55.git

staging: comedi: c6xdigio: tidy up subdevice 0 init

This subdevice is a PWM output not and analog output, fix the 'type'.

Fix the subdevice 'range', range_bipolar does not make sense for a PWM
output. The range_unknown is a better choice.

Remove the commented out init of the 'trig'.

For aesthetics, add some whitespace to the init and rename the 'insn_write'
function.

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>
---

diff --git a/drivers/staging/comedi/drivers/c6xdigio.c b/drivers/staging/comedi/drivers/c6xdigio.c
index f15b39c4f708..6207bc1086f6 100644
--- a/drivers/staging/comedi/drivers/c6xdigio.c
+++ b/drivers/staging/comedi/drivers/c6xdigio.c
@@ -172,10 +172,10 @@ static void c6xdigio_encoder_reset(struct comedi_device *dev)
 	c6xdigio_write_data(dev, 0x00, 0x80);
 }
 
-static int c6xdigio_pwmo_insn_write(struct comedi_device *dev,
-				    struct comedi_subdevice *s,
-				    struct comedi_insn *insn,
-				    unsigned int *data)
+static int c6xdigio_pwm_insn_write(struct comedi_device *dev,
+				   struct comedi_subdevice *s,
+				   struct comedi_insn *insn,
+				   unsigned int *data)
 {
 	unsigned int chan = CR_CHAN(insn->chanspec);
 	int i;
@@ -238,13 +238,12 @@ static int c6xdigio_attach(struct comedi_device *dev,
 
 	s = &dev->subdevices[0];
 	/* pwm output subdevice */
-	s->type = COMEDI_SUBD_AO;	/*  Not sure what to put here */
-	s->subdev_flags = SDF_WRITEABLE;
-	s->n_chan = 2;
-	/*      s->trig[0] = c6xdigio_pwmo; */
-	s->insn_write = c6xdigio_pwmo_insn_write;
-	s->maxdata = 500;
-	s->range_table = &range_bipolar10;	/*  A suitable lie */
+	s->type		= COMEDI_SUBD_PWM;
+	s->subdev_flags	= SDF_WRITEABLE;
+	s->n_chan	= 2;
+	s->maxdata	= 500;
+	s->range_table	= &range_unknown;
+	s->insn_write	= c6xdigio_pwm_insn_write;
 
 	s = &dev->subdevices[1];
 	/* encoder (counter) subdevice */