OSDN Git Service

staging: comedi: ni_tio: fix ni_tio_arm() params/vars
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 23 Mar 2016 22:36:40 +0000 (15:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Mar 2016 14:30:36 +0000 (07:30 -0700)
As suggested by checkpatch.pl:
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

The 'arm' parameter is really a true/false flag. For aesthetics,
change it to a bool.

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>
drivers/staging/comedi/drivers/ni_tio.c
drivers/staging/comedi/drivers/ni_tio_internal.h
drivers/staging/comedi/drivers/ni_tiocmd.c

index abbc8b7..35596b1 100644 (file)
@@ -484,11 +484,11 @@ static int ni_tio_set_counter_mode(struct ni_gpct *counter, unsigned mode)
        return 0;
 }
 
-int ni_tio_arm(struct ni_gpct *counter, int arm, unsigned start_trigger)
+int ni_tio_arm(struct ni_gpct *counter, bool arm, unsigned int start_trigger)
 {
        struct ni_gpct_device *counter_dev = counter->counter_dev;
-       unsigned cidx = counter->counter_index;
-       unsigned command_transient_bits = 0;
+       unsigned int cidx = counter->counter_index;
+       unsigned int command_transient_bits = 0;
 
        if (arm) {
                switch (start_trigger) {
@@ -502,8 +502,8 @@ int ni_tio_arm(struct ni_gpct *counter, int arm, unsigned start_trigger)
                        break;
                }
                if (ni_tio_counting_mode_registers_present(counter_dev)) {
-                       unsigned bits = 0;
-                       unsigned sel_mask;
+                       unsigned int bits = 0;
+                       unsigned int sel_mask;
 
                        sel_mask = GI_HW_ARM_SEL_MASK(counter_dev->variant);
 
@@ -1180,9 +1180,9 @@ int ni_tio_insn_config(struct comedi_device *dev,
        case INSN_CONFIG_SET_COUNTER_MODE:
                return ni_tio_set_counter_mode(counter, data[1]);
        case INSN_CONFIG_ARM:
-               return ni_tio_arm(counter, 1, data[1]);
+               return ni_tio_arm(counter, true, data[1]);
        case INSN_CONFIG_DISARM:
-               ni_tio_arm(counter, 0, 0);
+               ni_tio_arm(counter, false, 0);
                return 0;
        case INSN_CONFIG_GET_COUNTER_STATUS:
                data[1] = 0;
index ee02b36..1e91633 100644 (file)
@@ -244,7 +244,7 @@ static inline unsigned ni_tio_get_soft_copy(const struct ni_gpct *counter,
        return value;
 }
 
-int ni_tio_arm(struct ni_gpct *counter, int arm, unsigned start_trigger);
+int ni_tio_arm(struct ni_gpct *, bool arm, unsigned int start_trigger);
 int ni_tio_set_gate_src(struct ni_gpct *, unsigned int gate, unsigned int src);
 
 #endif /* _COMEDI_NI_TIO_INTERNAL_H */
index 823e479..0546a55 100644 (file)
@@ -103,7 +103,7 @@ static int ni_tio_input_inttrig(struct comedi_device *dev,
        spin_unlock_irqrestore(&counter->lock, flags);
        if (ret < 0)
                return ret;
-       ret = ni_tio_arm(counter, 1, NI_GPCT_ARM_IMMEDIATE);
+       ret = ni_tio_arm(counter, true, NI_GPCT_ARM_IMMEDIATE);
        s->async->inttrig = NULL;
 
        return ret;
@@ -143,9 +143,9 @@ static int ni_tio_input_cmd(struct comedi_subdevice *s)
                mite_dma_arm(counter->mite_chan);
 
                if (cmd->start_src == TRIG_NOW)
-                       ret = ni_tio_arm(counter, 1, NI_GPCT_ARM_IMMEDIATE);
+                       ret = ni_tio_arm(counter, true, NI_GPCT_ARM_IMMEDIATE);
                else if (cmd->start_src == TRIG_EXT)
-                       ret = ni_tio_arm(counter, 1, cmd->start_arg);
+                       ret = ni_tio_arm(counter, true, cmd->start_arg);
        }
        return ret;
 }
@@ -292,7 +292,7 @@ int ni_tio_cancel(struct ni_gpct *counter)
        unsigned cidx = counter->counter_index;
        unsigned long flags;
 
-       ni_tio_arm(counter, 0, 0);
+       ni_tio_arm(counter, false, 0);
        spin_lock_irqsave(&counter->lock, flags);
        if (counter->mite_chan)
                mite_dma_disarm(counter->mite_chan);