From 440b2168ae23d4e5fe34183dfcd94f59f6c9fa2f Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Thu, 23 May 2013 13:02:45 -0700 Subject: [PATCH] staging: comedi: usbduxsigma: tidy up usbdux_pwm_period() Rename the function so it has namespace associated with the driver. Rename the local variable used for the private data pointer. Modify the fx2delay calculation to remove the floating point values. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbduxsigma.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index d955e85bdde0..493898068bd6 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -1230,21 +1230,22 @@ static int usbduxsigma_submit_pwm_urb(struct comedi_device *dev) return usb_submit_urb(urb, GFP_ATOMIC); } -static int usbdux_pwm_period(struct comedi_device *dev, - struct comedi_subdevice *s, unsigned int period) +static int usbduxsigma_pwm_period(struct comedi_device *dev, + struct comedi_subdevice *s, + unsigned int period) { - struct usbduxsigma_private *this_usbduxsub = dev->private; + struct usbduxsigma_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->pwmDelay = fx2delay; - this_usbduxsub->pwmPeriod = period; + devpriv->pwmDelay = fx2delay; + devpriv->pwmPeriod = period; return 0; } @@ -1344,7 +1345,7 @@ static int usbduxsigma_pwm_config(struct comedi_device *dev, data[1] = devpriv->pwm_cmd_running; return 0; case INSN_CONFIG_PWM_SET_PERIOD: - return usbdux_pwm_period(dev, s, data[1]); + return usbduxsigma_pwm_period(dev, s, data[1]); case INSN_CONFIG_PWM_GET_PERIOD: data[1] = devpriv->pwmPeriod; return 0; @@ -1482,7 +1483,7 @@ static int usbduxsigma_attach_common(struct comedi_device *dev) s->insn_write = usbduxsigma_pwm_write; s->insn_config = usbduxsigma_pwm_config; - usbdux_pwm_period(dev, s, PWM_DEFAULT_PERIOD); + usbduxsigma_pwm_period(dev, s, PWM_DEFAULT_PERIOD); } up(&devpriv->sem); -- 2.20.1