]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: comedi: usbduxsigma: tidy up usbdux_pwm_start()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Thu, 23 May 2013 19:59:24 +0000 (12:59 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 May 2013 11:41:03 +0000 (20:41 +0900)
Rename the function so it has namespace associated with the driver.
Rename the local variable used for the private data pointer.

Remove the unnecessary cast of the pwm delay.

Use memset to initialize the buffer instead of the for loop.

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

index e0358daab2a07fff41ab625297a02288dfeea405..44043c5127b17aea71752179ab70548c4fa107a8 100644 (file)
@@ -1297,31 +1297,26 @@ static int usbdux_pwm_period(struct comedi_device *dev,
        return 0;
 }
 
-/* is called from insn so there's no need to do all the sanity checks */
-static int usbdux_pwm_start(struct comedi_device *dev,
-                           struct comedi_subdevice *s)
+static int usbduxsigma_pwm_start(struct comedi_device *dev,
+                                struct comedi_subdevice *s)
 {
-       struct usbduxsigma_private *this_usbduxsub = dev->private;
-       int ret, i;
+       struct usbduxsigma_private *devpriv = dev->private;
+       int ret;
 
-       if (this_usbduxsub->pwm_cmd_running) {
-               /* already running */
+       if (devpriv->pwm_cmd_running)
                return 0;
-       }
 
-       this_usbduxsub->dux_commands[1] = ((uint8_t) this_usbduxsub->pwmDelay);
+       devpriv->dux_commands[1] = devpriv->pwmDelay;
        ret = send_dux_commands(dev, SENDPWMON);
        if (ret < 0)
                return ret;
 
-       /* initialise the buffer */
-       for (i = 0; i < this_usbduxsub->sizePwmBuf; i++)
-               ((char *)(this_usbduxsub->urbPwm->transfer_buffer))[i] = 0;
+       memset(devpriv->urbPwm->transfer_buffer, 0, devpriv->sizePwmBuf);
 
        ret = usbduxsigma_submit_pwm_urb(dev);
        if (ret < 0)
                return ret;
-       this_usbduxsub->pwm_cmd_running = 1;
+       devpriv->pwm_cmd_running = 1;
 
        return 0;
 }
@@ -1391,7 +1386,7 @@ static int usbduxsigma_pwm_config(struct comedi_device *dev,
                 */
                if (data[1] != 0)
                        return -EINVAL;
-               return usbdux_pwm_start(dev, s);
+               return usbduxsigma_pwm_start(dev, s);
        case INSN_CONFIG_DISARM:
                return usbdux_pwm_cancel(dev, s);
        case INSN_CONFIG_GET_PWM_STATUS: