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@xxxxxxxxx> --- 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 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel