]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: comedi: drivers: cleanup cmd->flags use
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Sat, 19 Jul 2014 00:01:16 +0000 (17:01 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Jul 2014 21:43:01 +0000 (14:43 -0700)
Most of the comedi drivers that support async commands have some sort
of timer to control the acquisition timing. For these drivers, Step 4
of the (*do_cmdtest) operations calls a ns_to_timer() function that
converts the desired ns time of the command into a value used to set
the timer. These ns_to_timer() functions also typically pass the
cmd->flags in order to determine the desired rounding mode.

Some of the drivers mask the cmd->flags with TRIG_ROUND_MASK when
calling the ns_to_timer() functions. Move all the masking into the
ns_to_timer() functions and just pass the cmd->flags directly.

The cmd->flags member is an unsigned int, change the parameter type
in the the ns_to_timer() functions to match.

For aesthetics, rename the parameter in all the ns_to_timer()
functions to 'flags'.

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>
14 files changed:
drivers/staging/comedi/drivers/8253.h
drivers/staging/comedi/drivers/addi_apci_3xxx.c
drivers/staging/comedi/drivers/amplc_pci230.c
drivers/staging/comedi/drivers/das16.c
drivers/staging/comedi/drivers/dmm32at.c
drivers/staging/comedi/drivers/dt2814.c
drivers/staging/comedi/drivers/dt3000.c
drivers/staging/comedi/drivers/ni_at_a2150.c
drivers/staging/comedi/drivers/ni_mio_common.c
drivers/staging/comedi/drivers/ni_pcidio.c
drivers/staging/comedi/drivers/quatech_daqp_cs.c
drivers/staging/comedi/drivers/rtd520.c
drivers/staging/comedi/drivers/s626.c
drivers/staging/comedi/drivers/skel.c

index 035b3e30efc1a9d11f3651eee7ea4eb567997ac7..f8e1ebad304d9ba5598d48c2423052bf93162208 100644 (file)
@@ -34,7 +34,7 @@ static inline void i8253_cascade_ns_to_timer(int i8253_osc_base,
                                             unsigned int *d1,
                                             unsigned int *d2,
                                             unsigned int *nanosec,
-                                            int round_mode)
+                                            unsigned int flags)
 {
        unsigned int divider;
        unsigned int div1, div2;
@@ -90,8 +90,7 @@ static inline void i8253_cascade_ns_to_timer(int i8253_osc_base,
                }
        }
 
-       round_mode &= TRIG_ROUND_MASK;
-       switch (round_mode) {
+       switch (flags & TRIG_ROUND_MASK) {
        case TRIG_ROUND_NEAREST:
        default:
                ns_high = div1_lub * div2_lub * i8253_osc_base;
index 12096ee584ec4f643e8eb886cc396a5318c2c285..1b7cbf400c100b5bc8494b6c4642cec25d95a158 100644 (file)
@@ -477,7 +477,7 @@ static int apci3xxx_ai_insn_read(struct comedi_device *dev,
 }
 
 static int apci3xxx_ai_ns_to_timer(struct comedi_device *dev,
-                                  unsigned int *ns, int round_mode)
+                                  unsigned int *ns, unsigned int flags)
 {
        const struct apci3xxx_boardinfo *board = comedi_board(dev);
        struct apci3xxx_private *devpriv = dev->private;
@@ -503,7 +503,7 @@ static int apci3xxx_ai_ns_to_timer(struct comedi_device *dev,
                        break;
                }
 
-               switch (round_mode) {
+               switch (flags & TRIG_ROUND_MASK) {
                case TRIG_ROUND_NEAREST:
                default:
                        timer = (*ns + base / 2) / base;
@@ -573,7 +573,7 @@ static int apci3xxx_ai_cmdtest(struct comedi_device *dev,
        /* step 4: fix up any arguments */
 
        arg = cmd->convert_arg;
-       err |= apci3xxx_ai_ns_to_timer(dev, &arg, cmd->flags & TRIG_ROUND_MASK);
+       err |= apci3xxx_ai_ns_to_timer(dev, &arg, cmd->flags);
        err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
 
        if (err)
index 2c318fc721e998debe05992dbe7a1b955c912723..eca16a6b09d757883b55e5919852eb0a982d3530 100644 (file)
@@ -712,15 +712,14 @@ static inline void put_all_resources(struct comedi_device *dev,
 }
 
 static unsigned int divide_ns(uint64_t ns, unsigned int timebase,
-                             unsigned int round_mode)
+                             unsigned int flags)
 {
        uint64_t div;
        unsigned int rem;
 
        div = ns;
        rem = do_div(div, timebase);
-       round_mode &= TRIG_ROUND_MASK;
-       switch (round_mode) {
+       switch (flags & TRIG_ROUND_MASK) {
        default:
        case TRIG_ROUND_NEAREST:
                div += (rem + (timebase / 2)) / timebase;
@@ -737,12 +736,12 @@ static unsigned int divide_ns(uint64_t ns, unsigned int timebase,
 /* Given desired period in ns, returns the required internal clock source
  * and gets the initial count. */
 static unsigned int pci230_choose_clk_count(uint64_t ns, unsigned int *count,
-                                           unsigned int round_mode)
+                                           unsigned int flags)
 {
        unsigned int clk_src, cnt;
 
        for (clk_src = CLK_10MHZ;; clk_src++) {
-               cnt = divide_ns(ns, pci230_timebase[clk_src], round_mode);
+               cnt = divide_ns(ns, pci230_timebase[clk_src], flags);
                if ((cnt <= 65536) || (clk_src == CLK_1KHZ))
                        break;
 
@@ -751,18 +750,18 @@ static unsigned int pci230_choose_clk_count(uint64_t ns, unsigned int *count,
        return clk_src;
 }
 
-static void pci230_ns_to_single_timer(unsigned int *ns, unsigned int round)
+static void pci230_ns_to_single_timer(unsigned int *ns, unsigned int flags)
 {
        unsigned int count;
        unsigned int clk_src;
 
-       clk_src = pci230_choose_clk_count(*ns, &count, round);
+       clk_src = pci230_choose_clk_count(*ns, &count, flags);
        *ns = count * pci230_timebase[clk_src];
 }
 
 static void pci230_ct_setup_ns_mode(struct comedi_device *dev, unsigned int ct,
                                    unsigned int mode, uint64_t ns,
-                                   unsigned int round)
+                                   unsigned int flags)
 {
        struct pci230_private *devpriv = dev->private;
        unsigned int clk_src;
@@ -771,7 +770,7 @@ static void pci230_ct_setup_ns_mode(struct comedi_device *dev, unsigned int ct,
        /* Set mode. */
        i8254_set_mode(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, ct, mode);
        /* Determine clock source and count. */
-       clk_src = pci230_choose_clk_count(ns, &count, round);
+       clk_src = pci230_choose_clk_count(ns, &count, flags);
        /* Program clock source. */
        outb(CLK_CONFIG(ct, clk_src), devpriv->iobase1 + PCI230_ZCLK_SCE);
        /* Set initial count. */
@@ -1079,8 +1078,7 @@ static int pci230_ao_cmdtest(struct comedi_device *dev,
 
        if (cmd->scan_begin_src == TRIG_TIMER) {
                tmp = cmd->scan_begin_arg;
-               pci230_ns_to_single_timer(&cmd->scan_begin_arg,
-                                         cmd->flags & TRIG_ROUND_MASK);
+               pci230_ns_to_single_timer(&cmd->scan_begin_arg, cmd->flags);
                if (tmp != cmd->scan_begin_arg)
                        err++;
        }
@@ -1492,7 +1490,7 @@ static int pci230_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
                     devpriv->iobase1 + PCI230_ZGAT_SCE);
                pci230_ct_setup_ns_mode(dev, 1, I8254_MODE3,
                                        cmd->scan_begin_arg,
-                                       cmd->flags & TRIG_ROUND_MASK);
+                                       cmd->flags);
        }
 
        /* N.B. cmd->start_src == TRIG_INT */
@@ -1799,8 +1797,7 @@ static int pci230_ai_cmdtest(struct comedi_device *dev,
 
        if (cmd->convert_src == TRIG_TIMER) {
                tmp = cmd->convert_arg;
-               pci230_ns_to_single_timer(&cmd->convert_arg,
-                                         cmd->flags & TRIG_ROUND_MASK);
+               pci230_ns_to_single_timer(&cmd->convert_arg, cmd->flags);
                if (tmp != cmd->convert_arg)
                        err++;
        }
@@ -1808,8 +1805,7 @@ static int pci230_ai_cmdtest(struct comedi_device *dev,
        if (cmd->scan_begin_src == TRIG_TIMER) {
                /* N.B. cmd->convert_arg is also TRIG_TIMER */
                tmp = cmd->scan_begin_arg;
-               pci230_ns_to_single_timer(&cmd->scan_begin_arg,
-                                         cmd->flags & TRIG_ROUND_MASK);
+               pci230_ns_to_single_timer(&cmd->scan_begin_arg, cmd->flags);
                if (!pci230_ai_check_scan_period(cmd)) {
                        /* Was below minimum required.  Round up. */
                        pci230_ns_to_single_timer(&cmd->scan_begin_arg,
@@ -2380,7 +2376,7 @@ static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
                outb(zgat, devpriv->iobase1 + PCI230_ZGAT_SCE);
                /* Set counter/timer 2 to the specified conversion period. */
                pci230_ct_setup_ns_mode(dev, 2, I8254_MODE3, cmd->convert_arg,
-                                       cmd->flags & TRIG_ROUND_MASK);
+                                       cmd->flags);
                if (cmd->scan_begin_src != TRIG_FOLLOW) {
                        /*
                         * Set up monostable on CT0 output for scan timing.  A
@@ -2411,9 +2407,7 @@ static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
                                outb(zgat, devpriv->iobase1 + PCI230_ZGAT_SCE);
                                pci230_ct_setup_ns_mode(dev, 1, I8254_MODE3,
                                                        cmd->scan_begin_arg,
-                                                       cmd->
-                                                       flags &
-                                                       TRIG_ROUND_MASK);
+                                                       cmd->flags);
                        }
                }
        }
index d92cc181112dc239ff35cbe6c02461280a8a2762..057bc16f8ddca9dcd4a40571a42be892c626622d 100644 (file)
@@ -729,14 +729,14 @@ static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s,
 }
 
 static unsigned int das16_set_pacer(struct comedi_device *dev, unsigned int ns,
-                                   int rounding_flags)
+                                   unsigned int flags)
 {
        struct das16_private_struct *devpriv = dev->private;
        unsigned long timer_base = dev->iobase + DAS16_TIMER_BASE_REG;
 
        i8253_cascade_ns_to_timer(devpriv->clockbase,
                                  &devpriv->divisor1, &devpriv->divisor2,
-                                 &ns, rounding_flags);
+                                 &ns, flags);
 
        i8254_set_mode(timer_base, 0, 1, I8254_MODE2 | I8254_BINARY);
        i8254_set_mode(timer_base, 0, 2, I8254_MODE2 | I8254_BINARY);
@@ -782,9 +782,7 @@ static int das16_cmd_exec(struct comedi_device *dev, struct comedi_subdevice *s)
        }
 
        /* set counter mode and counts */
-       cmd->convert_arg =
-           das16_set_pacer(dev, cmd->convert_arg,
-                           cmd->flags & TRIG_ROUND_MASK);
+       cmd->convert_arg = das16_set_pacer(dev, cmd->convert_arg, cmd->flags);
 
        /* enable counters */
        byte = 0;
index 181c34462a4d749c794be2577129b3f895497691..35a8f84867aaecde38afdb398b064c6f446fb209 100644 (file)
@@ -237,7 +237,7 @@ static int dmm32at_ai_rinsn(struct comedi_device *dev,
        return n;
 }
 
-static int dmm32at_ns_to_timer(unsigned int *ns, int round)
+static int dmm32at_ns_to_timer(unsigned int *ns, unsigned int flags)
 {
        /* trivial timer */
        return *ns;
@@ -352,12 +352,12 @@ static int dmm32at_ai_cmdtest(struct comedi_device *dev,
 
        if (cmd->scan_begin_src == TRIG_TIMER) {
                arg = cmd->scan_begin_arg;
-               dmm32at_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+               dmm32at_ns_to_timer(&arg, cmd->flags);
                err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
        }
        if (cmd->convert_src == TRIG_TIMER) {
                arg = cmd->convert_arg;
-               dmm32at_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+               dmm32at_ns_to_timer(&arg, cmd->flags);
                err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
 
                if (cmd->scan_begin_src == TRIG_TIMER) {
index 4d53253453028c5ddaf055d2d37fda15c43922b1..4c4b1f9c86a6a450aca37051d191832113f559fd 100644 (file)
@@ -171,7 +171,7 @@ static int dt2814_ai_cmdtest(struct comedi_device *dev,
        /* step 4: fix up any arguments */
 
        arg = cmd->scan_begin_arg;
-       dt2814_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+       dt2814_ns_to_timer(&arg, cmd->flags);
        err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
 
        if (err)
@@ -187,9 +187,7 @@ static int dt2814_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
        int chan;
        int trigvar;
 
-       trigvar =
-           dt2814_ns_to_timer(&cmd->scan_begin_arg,
-                              cmd->flags & TRIG_ROUND_MASK);
+       trigvar = dt2814_ns_to_timer(&cmd->scan_begin_arg, cmd->flags);
 
        chan = CR_CHAN(cmd->chanlist[0]);
 
index 4ab4de00592486b3c624fab4758a56bd8b72dc0e..bf5a05c64fe28ddd6e21ded40ccf163bc888b3fa 100644 (file)
@@ -377,7 +377,7 @@ static irqreturn_t dt3k_interrupt(int irq, void *d)
 }
 
 static int dt3k_ns_to_timer(unsigned int timer_base, unsigned int *nanosec,
-                           unsigned int round_mode)
+                           unsigned int flags)
 {
        int divider, base, prescale;
 
@@ -386,7 +386,7 @@ static int dt3k_ns_to_timer(unsigned int timer_base, unsigned int *nanosec,
 
        for (prescale = 0; prescale < 16; prescale++) {
                base = timer_base * (prescale + 1);
-               switch (round_mode) {
+               switch (flags & TRIG_ROUND_MASK) {
                case TRIG_ROUND_NEAREST:
                default:
                        divider = (*nanosec + base / 2) / base;
@@ -467,13 +467,13 @@ static int dt3k_ai_cmdtest(struct comedi_device *dev,
 
        if (cmd->scan_begin_src == TRIG_TIMER) {
                arg = cmd->scan_begin_arg;
-               dt3k_ns_to_timer(100, &arg, cmd->flags & TRIG_ROUND_MASK);
+               dt3k_ns_to_timer(100, &arg, cmd->flags);
                err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
        }
 
        if (cmd->convert_src == TRIG_TIMER) {
                arg = cmd->convert_arg;
-               dt3k_ns_to_timer(50, &arg, cmd->flags & TRIG_ROUND_MASK);
+               dt3k_ns_to_timer(50, &arg, cmd->flags);
                err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
 
                if (cmd->scan_begin_src == TRIG_TIMER) {
@@ -511,15 +511,14 @@ static int dt3k_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
        writew(cmd->scan_end_arg, devpriv->io_addr + DPR_Params(0));
 
        if (cmd->convert_src == TRIG_TIMER) {
-               divider = dt3k_ns_to_timer(50, &cmd->convert_arg,
-                                          cmd->flags & TRIG_ROUND_MASK);
+               divider = dt3k_ns_to_timer(50, &cmd->convert_arg, cmd->flags);
                writew((divider >> 16), devpriv->io_addr + DPR_Params(1));
                writew((divider & 0xffff), devpriv->io_addr + DPR_Params(2));
        }
 
        if (cmd->scan_begin_src == TRIG_TIMER) {
                tscandiv = dt3k_ns_to_timer(100, &cmd->scan_begin_arg,
-                                           cmd->flags & TRIG_ROUND_MASK);
+                                           cmd->flags);
                writew((tscandiv >> 16), devpriv->io_addr + DPR_Params(3));
                writew((tscandiv & 0xffff), devpriv->io_addr + DPR_Params(4));
        }
index c0ac8fd6ecab5490cea057ab888134fba4ad8143..0638c1ac8cbf98675fe7981071ad18e40c0a2c32 100644 (file)
@@ -159,7 +159,7 @@ struct a2150_private {
 static int a2150_cancel(struct comedi_device *dev, struct comedi_subdevice *s);
 
 static int a2150_get_timing(struct comedi_device *dev, unsigned int *period,
-                           int flags);
+                           unsigned int flags);
 static int a2150_set_chanlist(struct comedi_device *dev,
                              unsigned int start_channel,
                              unsigned int num_channels);
@@ -580,7 +580,7 @@ static int a2150_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
  * period, adjusts requested period to actual timing.
  */
 static int a2150_get_timing(struct comedi_device *dev, unsigned int *period,
-                           int flags)
+                           unsigned int flags)
 {
        const struct a2150_board *thisboard = comedi_board(dev);
        struct a2150_private *devpriv = dev->private;
@@ -621,8 +621,7 @@ static int a2150_get_timing(struct comedi_device *dev, unsigned int *period,
                        }
                }
        }
-       flags &= TRIG_ROUND_MASK;
-       switch (flags) {
+       switch (flags & TRIG_ROUND_MASK) {
        case TRIG_ROUND_NEAREST:
        default:
                /*  if least upper bound is better approximation */
index 551a150685a9faf6ef0560fd3867cf01b8791b75..4285f071801251eb97fc55a7088d52cae1bf81cc 100644 (file)
@@ -2213,12 +2213,12 @@ static int ni_ai_insn_read(struct comedi_device *dev,
 }
 
 static int ni_ns_to_timer(const struct comedi_device *dev, unsigned nanosec,
-                         int round_mode)
+                         unsigned int flags)
 {
        struct ni_private *devpriv = dev->private;
        int divider;
 
-       switch (round_mode) {
+       switch (flags & TRIG_ROUND_MASK) {
        case TRIG_ROUND_NEAREST:
        default:
                divider = (nanosec + devpriv->clock_ns / 2) / devpriv->clock_ns;
@@ -2375,9 +2375,7 @@ static int ni_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
                cmd->scan_begin_arg =
                    ni_timer_to_ns(dev, ni_ns_to_timer(dev,
                                                       cmd->scan_begin_arg,
-                                                      cmd->
-                                                      flags &
-                                                      TRIG_ROUND_MASK));
+                                                      cmd->flags));
                if (tmp != cmd->scan_begin_arg)
                        err++;
        }
@@ -2387,9 +2385,7 @@ static int ni_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
                        cmd->convert_arg =
                            ni_timer_to_ns(dev, ni_ns_to_timer(dev,
                                                               cmd->convert_arg,
-                                                              cmd->
-                                                              flags &
-                                                              TRIG_ROUND_MASK));
+                                                              cmd->flags));
                        if (tmp != cmd->convert_arg)
                                err++;
                        if (cmd->scan_begin_src == TRIG_TIMER &&
@@ -3386,9 +3382,7 @@ static int ni_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
                cmd->scan_begin_arg =
                    ni_timer_to_ns(dev, ni_ns_to_timer(dev,
                                                       cmd->scan_begin_arg,
-                                                      cmd->
-                                                      flags &
-                                                      TRIG_ROUND_MASK));
+                                                      cmd->flags));
                if (tmp != cmd->scan_begin_arg)
                        err++;
        }
index 7bc4b9f127f30944431db1d103f3c1ace24c1a62..cb161d8154443ae3d983c24c3d4f3a5fc33510f5 100644 (file)
@@ -303,7 +303,7 @@ static int ni_pcidio_cmdtest(struct comedi_device *dev,
 static int ni_pcidio_cmd(struct comedi_device *dev, struct comedi_subdevice *s);
 static int ni_pcidio_inttrig(struct comedi_device *dev,
                             struct comedi_subdevice *s, unsigned int trignum);
-static int ni_pcidio_ns_to_timer(int *nanosec, int round_mode);
+static int ni_pcidio_ns_to_timer(int *nanosec, unsigned int flags);
 static int setup_mite_dma(struct comedi_device *dev,
                          struct comedi_subdevice *s);
 
@@ -596,7 +596,7 @@ static int ni_pcidio_cmdtest(struct comedi_device *dev,
 
        if (cmd->scan_begin_src == TRIG_TIMER) {
                arg = cmd->scan_begin_arg;
-               ni_pcidio_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+               ni_pcidio_ns_to_timer(&arg, cmd->flags);
                err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
        }
 
@@ -606,13 +606,13 @@ static int ni_pcidio_cmdtest(struct comedi_device *dev,
        return 0;
 }
 
-static int ni_pcidio_ns_to_timer(int *nanosec, int round_mode)
+static int ni_pcidio_ns_to_timer(int *nanosec, unsigned int flags)
 {
        int divider, base;
 
        base = TIMER_BASE;
 
-       switch (round_mode) {
+       switch (flags & TRIG_ROUND_MASK) {
        case TRIG_ROUND_NEAREST:
        default:
                divider = (*nanosec + base / 2) / base;
index b3bbec0a0d23e67498ddb60eeb07e76426522cff..b1db61d9d834983401b2fef6bd378c24abe5cf2e 100644 (file)
@@ -351,7 +351,7 @@ static int daqp_ai_insn_read(struct comedi_device *dev,
  * time that the device will use.
  */
 
-static int daqp_ns_to_timer(unsigned int *ns, int round)
+static int daqp_ns_to_timer(unsigned int *ns, unsigned int flags)
 {
        int timer;
 
@@ -436,13 +436,13 @@ static int daqp_ai_cmdtest(struct comedi_device *dev,
 
        if (cmd->scan_begin_src == TRIG_TIMER) {
                arg = cmd->scan_begin_arg;
-               daqp_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+               daqp_ns_to_timer(&arg, cmd->flags);
                err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
        }
 
        if (cmd->convert_src == TRIG_TIMER) {
                arg = cmd->convert_arg;
-               daqp_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+               daqp_ns_to_timer(&arg, cmd->flags);
                err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
        }
 
@@ -488,15 +488,13 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
         */
 
        if (cmd->convert_src == TRIG_TIMER) {
-               counter = daqp_ns_to_timer(&cmd->convert_arg,
-                                              cmd->flags & TRIG_ROUND_MASK);
+               counter = daqp_ns_to_timer(&cmd->convert_arg, cmd->flags);
                outb(counter & 0xff, dev->iobase + DAQP_PACER_LOW);
                outb((counter >> 8) & 0xff, dev->iobase + DAQP_PACER_MID);
                outb((counter >> 16) & 0xff, dev->iobase + DAQP_PACER_HIGH);
                scanlist_start_on_every_entry = 1;
        } else {
-               counter = daqp_ns_to_timer(&cmd->scan_begin_arg,
-                                              cmd->flags & TRIG_ROUND_MASK);
+               counter = daqp_ns_to_timer(&cmd->scan_begin_arg, cmd->flags);
                outb(counter & 0xff, dev->iobase + DAQP_PACER_LOW);
                outb((counter >> 8) & 0xff, dev->iobase + DAQP_PACER_MID);
                outb((counter >> 16) & 0xff, dev->iobase + DAQP_PACER_HIGH);
index d55c5893203ba3a6be29a9d63ef5012e13b7d5e2..69dc73705513fb0926b3b0ac81a06d23be2bfb0f 100644 (file)
@@ -397,11 +397,11 @@ struct rtd_private {
   Note: you have to check if the value is larger than the counter range!
 */
 static int rtd_ns_to_timer_base(unsigned int *nanosec,
-                               int round_mode, int base)
+                               unsigned int flags, int base)
 {
        int divider;
 
-       switch (round_mode) {
+       switch (flags & TRIG_ROUND_MASK) {
        case TRIG_ROUND_NEAREST:
        default:
                divider = (*nanosec + base / 2) / base;
@@ -428,9 +428,9 @@ static int rtd_ns_to_timer_base(unsigned int *nanosec,
   return the proper counter value (divider-1) for the internal clock.
   Sets the original period to be the true value.
 */
-static int rtd_ns_to_timer(unsigned int *ns, int round_mode)
+static int rtd_ns_to_timer(unsigned int *ns, unsigned int flags)
 {
-       return rtd_ns_to_timer_base(ns, round_mode, RTD_CLOCK_BASE);
+       return rtd_ns_to_timer_base(ns, flags, RTD_CLOCK_BASE);
 }
 
 /*
@@ -895,13 +895,13 @@ static int rtd_ai_cmdtest(struct comedi_device *dev,
 
        if (cmd->scan_begin_src == TRIG_TIMER) {
                arg = cmd->scan_begin_arg;
-               rtd_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+               rtd_ns_to_timer(&arg, cmd->flags);
                err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
        }
 
        if (cmd->convert_src == TRIG_TIMER) {
                arg = cmd->convert_arg;
-               rtd_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+               rtd_ns_to_timer(&arg, cmd->flags);
                err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
 
                if (cmd->scan_begin_src == TRIG_TIMER) {
index b7c5d8168e98905b2d2cc84a777892a73e125941..0b18d24ddb6911fb3f191080bacb3bc43e49e384 100644 (file)
@@ -1981,13 +1981,13 @@ static int s626_ai_inttrig(struct comedi_device *dev,
  * Also, it should adjust ns so that it cooresponds to the actual time
  * that the device will use.
  */
-static int s626_ns_to_timer(unsigned int *nanosec, int round_mode)
+static int s626_ns_to_timer(unsigned int *nanosec, unsigned int flags)
 {
        int divider, base;
 
        base = 500;             /* 2MHz internal clock */
 
-       switch (round_mode) {
+       switch (flags & TRIG_ROUND_MASK) {
        case TRIG_ROUND_NEAREST:
        default:
                divider = (*nanosec + base / 2) / base;
@@ -2087,8 +2087,7 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
                 * set a counter to generate adc trigger at scan_begin_arg
                 * interval
                 */
-               tick = s626_ns_to_timer(&cmd->scan_begin_arg,
-                                       cmd->flags & TRIG_ROUND_MASK);
+               tick = s626_ns_to_timer(&cmd->scan_begin_arg, cmd->flags);
 
                /* load timer value and enable interrupt */
                s626_timer_load(dev, 5, tick);
@@ -2109,8 +2108,7 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
                 * set a counter to generate adc trigger at convert_arg
                 * interval
                 */
-               tick = s626_ns_to_timer(&cmd->convert_arg,
-                                       cmd->flags & TRIG_ROUND_MASK);
+               tick = s626_ns_to_timer(&cmd->convert_arg, cmd->flags);
 
                /* load timer value and enable interrupt */
                s626_timer_load(dev, 4, tick);
@@ -2252,13 +2250,13 @@ static int s626_ai_cmdtest(struct comedi_device *dev,
 
        if (cmd->scan_begin_src == TRIG_TIMER) {
                arg = cmd->scan_begin_arg;
-               s626_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+               s626_ns_to_timer(&arg, cmd->flags);
                err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
        }
 
        if (cmd->convert_src == TRIG_TIMER) {
                arg = cmd->convert_arg;
-               s626_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+               s626_ns_to_timer(&arg, cmd->flags);
                err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
 
                if (cmd->scan_begin_src == TRIG_TIMER) {
index 3bfa221faf4d450e6544b1468eebf9885f5d81c8..7661f2b0a183cc5cfe5c041a323d50405a5c66c3 100644 (file)
@@ -129,7 +129,7 @@ struct skel_private {
  * convert ns nanoseconds to a counter value suitable for programming
  * the device.  Also, it should adjust ns so that it cooresponds to
  * the actual time that the device will use. */
-static int skel_ns_to_timer(unsigned int *ns, int round)
+static int skel_ns_to_timer(unsigned int *ns, unsigned int flags)
 {
        /* trivial timer */
        /* if your timing is done through two cascaded timers, the
@@ -287,12 +287,12 @@ static int skel_ai_cmdtest(struct comedi_device *dev,
 
        if (cmd->scan_begin_src == TRIG_TIMER) {
                arg = cmd->scan_begin_arg;
-               skel_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+               skel_ns_to_timer(&arg, cmd->flags);
                err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
        }
        if (cmd->convert_src == TRIG_TIMER) {
                arg = cmd->convert_arg;
-               skel_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+               skel_ns_to_timer(&arg, cmd->flags);
                err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
 
                if (cmd->scan_begin_src == TRIG_TIMER) {