Since dgnc_poll_trick is a global variable. Signed-off-by: Salah Triki <salah.triki@xxxxxxx> --- drivers/staging/dgnc/dgnc_sysfs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_sysfs.c b/drivers/staging/dgnc/dgnc_sysfs.c index 44db870..fe14b7a 100644 --- a/drivers/staging/dgnc/dgnc_sysfs.c +++ b/drivers/staging/dgnc/dgnc_sysfs.c @@ -26,6 +26,7 @@ #include "dgnc_driver.h" #include "dgnc_mgmt.h" +#DEFINE_MUTEX(mut); static ssize_t dgnc_driver_version_show(struct device_driver *ddp, char *buf) { @@ -58,10 +59,20 @@ static ssize_t dgnc_driver_pollrate_store(struct device_driver *ddp, { int ret; + ret = mutex_lock_interruptible(&mut); + + if (ret) + return -ERESTARTSYS; + ret = sscanf(buf, "%d\n", &dgnc_poll_tick); if (ret != 1) - return -EINVAL; - return count; + ret = -EINVAL; + else + ret = count; + + mutex_unlock(&mut); + + return ret; } static DRIVER_ATTR(pollrate, (S_IRUSR | S_IWUSR), dgnc_driver_pollrate_show, dgnc_driver_pollrate_store); -- 1.9.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel