From: Cheah Kok Cheong <thrust73@gmail.com>
To: abbotti@mev.co.uk, hsweeten@visionengravers.com,
gregkh@linuxfoundation.org
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
Cheah Kok Cheong <thrust73@gmail.com>
Subject: [PATCH] Staging: comedi: drivers: comedi_test: Set max input value for auto config
Date: Fri, 27 Jan 2017 23:55:54 +0800 [thread overview]
Message-ID: <1485532554-2520-1-git-send-email-thrust73@gmail.com> (raw)
In-Reply-To: <1485365489-3577-1-git-send-email-thrust73@gmail.com>
Currently user can input any value for amplitude and period.
This patch set a sane max value for auto-configuration mode.
For manual configuration mode, it is assumed this is taken care of
by the COMEDI userspace tool since there's no limit set here from
day one in the staging tree. If otherwise then maybe this can be
looked at separately.
Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com>
---
Note: This patch is dependent upon an earlier pending patch.
[Staging: comedi: drivers: comedi_test: Add auto-configuration
capability]
drivers/staging/comedi/drivers/comedi_test.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c
index 92b3a4f1..4e18e2c 100644
--- a/drivers/staging/comedi/drivers/comedi_test.c
+++ b/drivers/staging/comedi/drivers/comedi_test.c
@@ -715,6 +715,14 @@ static int waveform_attach(struct comedi_device *dev,
static int waveform_auto_attach(struct comedi_device *dev,
unsigned long context_unused)
{
+ /* limit max input voltage to 300V [typical oscilloscope max value] */
+ if (set_amplitude > 300000000)
+ set_amplitude = 300000000;
+
+ /* limit max input period [= 1 hertz] to avoid too low freq */
+ if (set_period > 1000000)
+ set_period = 1000000;
+
int amplitude = set_amplitude;
int period = set_period;
--
2.7.4
next prev parent reply other threads:[~2017-01-27 17:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-25 17:31 [PATCH] Staging: comedi: drivers: comedi_test: Add auto-configuration capability Cheah Kok Cheong
2017-01-27 15:55 ` Cheah Kok Cheong [this message]
2017-02-09 12:28 ` [PATCH] Staging: comedi: drivers: comedi_test: Set max input value for auto config Ian Abbott
2017-02-11 1:29 ` Cheah Kok Cheong
2017-02-08 7:42 ` [PATCH] Staging: comedi: drivers: comedi_test: Add auto-configuration capability Cheah Kok Cheong
2017-02-09 12:25 ` Ian Abbott
2017-02-11 0:53 ` Cheah Kok Cheong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1485532554-2520-1-git-send-email-thrust73@gmail.com \
--to=thrust73@gmail.com \
--cc=abbotti@mev.co.uk \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=hsweeten@visionengravers.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox