From: Lars-Peter Clausen Date: Wed, 2 Nov 2011 08:40:00 +0000 (+0100) Subject: staging:iio: Make write_event_value callback optional X-Git-Tag: firefly_0821_release~3680^2~3804^2~101^2~324 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=43c0364551d3ca0042f6f6a3da701edf1143d62f;p=firefly-linux-kernel-4.4.55.git 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 --- 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;