From 43c0364551d3ca0042f6f6a3da701edf1143d62f Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 2 Nov 2011 09:40:00 +0100 Subject: [PATCH] staging:iio: Make write_event_value callback optional Some devices have fixed thresholds which can not be modified so make the write_event_value callback optional, so the drivers for these devices do not have to implement a boilerplate no-op callback. Signed-off-by: Lars-Peter Clausen Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/industrialio-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c index dc2339ae63d0..0b671663b55d 100644 --- a/drivers/staging/iio/industrialio-core.c +++ b/drivers/staging/iio/industrialio-core.c @@ -790,6 +790,9 @@ static ssize_t iio_ev_value_store(struct device *dev, unsigned long val; int ret; + if (!indio_dev->info->write_event_value) + return -EINVAL; + ret = strict_strtoul(buf, 10, &val); if (ret) return ret; -- 2.20.1