diff options
Diffstat (limited to 'drivers/iio/industrialio-event.c')
-rw-r--r-- | drivers/iio/industrialio-event.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c index 0ebfc923a997..90fac8ec63c9 100644 --- a/drivers/iio/industrialio-event.c +++ b/drivers/iio/industrialio-event.c | |||
@@ -57,6 +57,11 @@ bool iio_event_enabled(const struct iio_event_interface *ev_int) | |||
57 | * | 57 | * |
58 | * Note: The caller must make sure that this function is not running | 58 | * Note: The caller must make sure that this function is not running |
59 | * concurrently for the same indio_dev more than once. | 59 | * concurrently for the same indio_dev more than once. |
60 | * | ||
61 | * This function may be safely used as soon as a valid reference to iio_dev has | ||
62 | * been obtained via iio_device_alloc(), but any events that are submitted | ||
63 | * before iio_device_register() has successfully completed will be silently | ||
64 | * discarded. | ||
60 | **/ | 65 | **/ |
61 | int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp) | 66 | int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp) |
62 | { | 67 | { |
@@ -64,6 +69,9 @@ int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp) | |||
64 | struct iio_event_data ev; | 69 | struct iio_event_data ev; |
65 | int copied; | 70 | int copied; |
66 | 71 | ||
72 | if (!ev_int) | ||
73 | return 0; | ||
74 | |||
67 | /* Does anyone care? */ | 75 | /* Does anyone care? */ |
68 | if (iio_event_enabled(ev_int)) { | 76 | if (iio_event_enabled(ev_int)) { |
69 | 77 | ||