[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1445965165-32146-4-git-send-email-abbotti@mev.co.uk>
Date: Tue, 27 Oct 2015 16:59:12 +0000
From: Ian Abbott <abbotti@....co.uk>
To: driverdev-devel@...uxdriverproject.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Ian Abbott <abbotti@....co.uk>,
H Hartley Sweeten <hsweeten@...ionengravers.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH 03/16] staging: comedi: comedi_test: remove nano_per_micro
The `static const int nano_per_micro` variable is set to 1000, the
number of nanoseconds in a microsecond. Remove it and use the
`NSEC_PER_USEC` macro from <linux/time.h> instead.
Signed-off-by: Ian Abbott <abbotti@....co.uk>
---
drivers/staging/comedi/drivers/comedi_test.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c
index 53c9a5c..d9810ca 100644
--- a/drivers/staging/comedi/drivers/comedi_test.c
+++ b/drivers/staging/comedi/drivers/comedi_test.c
@@ -73,9 +73,6 @@ struct waveform_private {
unsigned int ao_loopbacks[N_CHANS];
};
-/* 1000 nanosec in a microsec */
-static const int nano_per_micro = 1000;
-
/* fake analog input ranges */
static const struct comedi_lrange waveform_ai_ranges = {
2, {
@@ -270,7 +267,7 @@ static int waveform_ai_cmdtest(struct comedi_device *dev,
if (cmd->scan_begin_src == TRIG_TIMER) {
err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg,
- nano_per_micro);
+ NSEC_PER_USEC);
if (cmd->convert_src == TRIG_TIMER) {
err |= comedi_check_trigger_arg_min(&cmd->
scan_begin_arg,
@@ -296,15 +293,15 @@ static int waveform_ai_cmdtest(struct comedi_device *dev,
if (cmd->scan_begin_src == TRIG_TIMER) {
arg = cmd->scan_begin_arg;
/* round to nearest microsec */
- arg = nano_per_micro *
- ((arg + (nano_per_micro / 2)) / nano_per_micro);
+ arg = NSEC_PER_USEC *
+ ((arg + (NSEC_PER_USEC / 2)) / NSEC_PER_USEC);
err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
}
if (cmd->convert_src == TRIG_TIMER) {
arg = cmd->convert_arg;
/* round to nearest microsec */
- arg = nano_per_micro *
- ((arg + (nano_per_micro / 2)) / nano_per_micro);
+ arg = NSEC_PER_USEC *
+ ((arg + (NSEC_PER_USEC / 2)) / NSEC_PER_USEC);
err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg);
}
@@ -326,12 +323,12 @@ static int waveform_ai_cmd(struct comedi_device *dev,
return -1;
}
- devpriv->scan_period = cmd->scan_begin_arg / nano_per_micro;
+ devpriv->scan_period = cmd->scan_begin_arg / NSEC_PER_USEC;
if (cmd->convert_src == TRIG_NOW)
devpriv->convert_period = 0;
else /* TRIG_TIMER */
- devpriv->convert_period = cmd->convert_arg / nano_per_micro;
+ devpriv->convert_period = cmd->convert_arg / NSEC_PER_USEC;
devpriv->last = ktime_get();
devpriv->usec_current =
--
2.6.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists