[PATCH 04/18] staging: comedi: usbdux: tidy up usbdux_pwm_period()

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

 



Rename the local variable used for the private data pointer to 'devpriv'.

Fix the fx2delay calculation so it does not use floating point values.

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

diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c
index bf6c9ff..0683c8e 100644
--- a/drivers/staging/comedi/drivers/usbdux.c
+++ b/drivers/staging/comedi/drivers/usbdux.c
@@ -1347,20 +1347,21 @@ static int usbduxsub_submit_pwm_urbs(struct comedi_device *dev)
 }
 
 static int usbdux_pwm_period(struct comedi_device *dev,
-			     struct comedi_subdevice *s, unsigned int period)
+			     struct comedi_subdevice *s,
+			     unsigned int period)
 {
-	struct usbdux_private *this_usbduxsub = dev->private;
+	struct usbdux_private *devpriv = dev->private;
 	int fx2delay = 255;
 
 	if (period < MIN_PWM_PERIOD) {
 		return -EAGAIN;
 	} else {
-		fx2delay = period / ((int)(6 * 512 * (1.0 / 0.033))) - 6;
+		fx2delay = (period / (6 * 512 * 1000 / 33)) - 6;
 		if (fx2delay > 255)
 			return -EAGAIN;
 	}
-	this_usbduxsub->pwm_delay = fx2delay;
-	this_usbduxsub->pwm_period = period;
+	devpriv->pwm_delay = fx2delay;
+	devpriv->pwm_period = period;
 
 	return 0;
 }
-- 
1.8.3.2

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-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