[PATCH 24/32] staging: comedi: vmk80xx: cleanup pwm subdevice init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Change the 'pwm_bits' in the boardinfo to 'pwm_maxdata' so that the
calculation of s->maxdata can be removed. Also, change the type to
match the comedi_subdevice type. For aesthetic reasons, rename the
'pwm_chans' boardinfo and change its type also.

Remove the '0' values in the boardinfo.

Rename the (*insn_read) and (*insn_write) functions for the pwm
subdevice to make grepping easier.

For aesthetic reasons, add some whitespace to the subdevice init.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/vmk80xx.c | 36 ++++++++++++++++----------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c
index 26a9a96..00f5784 100644
--- a/drivers/staging/comedi/drivers/vmk80xx.c
+++ b/drivers/staging/comedi/drivers/vmk80xx.c
@@ -164,8 +164,8 @@ struct vmk80xx_board {
 	int ao_nchans;
 	int di_nchans;
 	unsigned int cnt_maxdata;
-	__u8 pwm_chans;
-	__le16 pwm_bits;
+	int pwm_nchans;
+	unsigned int pwm_maxdata;
 };
 
 static const struct vmk80xx_board vmk80xx_boardinfo[] = {
@@ -178,8 +178,6 @@ static const struct vmk80xx_board vmk80xx_boardinfo[] = {
 		.ao_nchans	= 2,
 		.di_nchans	= 6,
 		.cnt_maxdata	= 0xffff,
-		.pwm_chans	= 0,
-		.pwm_bits	= 0,
 	},
 	[DEVICE_VMK8061] = {
 		.name		= "K8061 (VM140)",
@@ -190,8 +188,8 @@ static const struct vmk80xx_board vmk80xx_boardinfo[] = {
 		.ao_nchans	= 8,
 		.di_nchans	= 8,
 		.cnt_maxdata	= 0,	/* unknown, device is not writeable */
-		.pwm_chans	= 1,
-		.pwm_bits	= 10,
+		.pwm_nchans	= 1,
+		.pwm_maxdata	= 0x03ff,
 	},
 };
 
@@ -1043,9 +1041,10 @@ static int vmk80xx_cnt_insn_write(struct comedi_device *dev,
 	return n;
 }
 
-static int vmk80xx_pwm_rinsn(struct comedi_device *dev,
-			     struct comedi_subdevice *s,
-			     struct comedi_insn *insn, unsigned int *data)
+static int vmk80xx_pwm_insn_read(struct comedi_device *dev,
+				 struct comedi_subdevice *s,
+				 struct comedi_insn *insn,
+				 unsigned int *data)
 {
 	struct vmk80xx_private *devpriv = dev->private;
 	unsigned char *tx_buf;
@@ -1079,9 +1078,10 @@ static int vmk80xx_pwm_rinsn(struct comedi_device *dev,
 	return n;
 }
 
-static int vmk80xx_pwm_winsn(struct comedi_device *dev,
-			     struct comedi_subdevice *s,
-			     struct comedi_insn *insn, unsigned int *data)
+static int vmk80xx_pwm_insn_write(struct comedi_device *dev,
+				  struct comedi_subdevice *s,
+				  struct comedi_insn *insn,
+				  unsigned int *data)
 {
 	struct vmk80xx_private *devpriv = dev->private;
 	unsigned char *tx_buf;
@@ -1265,12 +1265,12 @@ static int vmk80xx_attach_common(struct comedi_device *dev)
 	/* PWM subdevice */
 	if (devpriv->model == VMK8061_MODEL) {
 		s = &dev->subdevices[5];
-		s->type = COMEDI_SUBD_PWM;
-		s->subdev_flags = SDF_READABLE | SDF_WRITEABLE;
-		s->n_chan = boardinfo->pwm_chans;
-		s->maxdata = (1 << boardinfo->pwm_bits) - 1;
-		s->insn_read = vmk80xx_pwm_rinsn;
-		s->insn_write = vmk80xx_pwm_winsn;
+		s->type		= COMEDI_SUBD_PWM;
+		s->subdev_flags	= SDF_READABLE | SDF_WRITEABLE;
+		s->n_chan	= boardinfo->pwm_nchans;
+		s->maxdata	= boardinfo->pwm_maxdata;
+		s->insn_read	= vmk80xx_pwm_insn_read;
+		s->insn_write	= vmk80xx_pwm_insn_write;
 	}
 
 	up(&devpriv->limit_sem);
-- 
1.8.1.1.293.gfe73786

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux