]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/iio/industrialio-event.c
Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6
[karo-tx-linux.git] / drivers / iio / industrialio-event.c
index 0ebfc923a9975a39326b38049f93cd3dfd1c0601..90fac8ec63c9662e2b1603f7ece427a606a704ae 100644 (file)
@@ -57,6 +57,11 @@ bool iio_event_enabled(const struct iio_event_interface *ev_int)
  *
  * Note: The caller must make sure that this function is not running
  * concurrently for the same indio_dev more than once.
+ *
+ * This function may be safely used as soon as a valid reference to iio_dev has
+ * been obtained via iio_device_alloc(), but any events that are submitted
+ * before iio_device_register() has successfully completed will be silently
+ * discarded.
  **/
 int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp)
 {
@@ -64,6 +69,9 @@ int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp)
        struct iio_event_data ev;
        int copied;
 
+       if (!ev_int)
+               return 0;
+
        /* Does anyone care? */
        if (iio_event_enabled(ev_int)) {