1. 16 Dec, 2021 2 commits
    • Zach DeCook's avatar
      iio: event_monitor: Flush output on event · c054fe99
      Zach DeCook authored
      By flushing the output, iio_event_monitor can be more useful to programs
      chained along with it.
      
        iio_event_monitor stk3310 | awk '/rising/{system("my_unlockscreen.sh")} /falling/{system("my_lockscreen.sh")}'
      
      Without this flush, the above example would buffer a number of events,
      then after a while run the lock/unlock scripts several times.
      Signed-off-by: default avatarZach DeCook <zachdecook@librem.one>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      c054fe99
    • Lars-Peter Clausen's avatar
      iio: iio_device_alloc(): Remove unnecessary self drvdata · 8b7651f2
      Lars-Peter Clausen authored
      Drvdata is typically used by drivers to attach driver specific data to a
      device. It is used to retrieve driver specific information when only the
      device to which the data is attached is available.
      
      In the IIO core in the `iio_device_alloc()` function we call
      `iio_device_set_drvdata(indio_dev, indio_dev)`. This sets the drvdata of
      the IIO device to itself.
      
      This is rather unnecessary since if we have a pointer to the IIO device to
      call `iio_device_get_drvdata()` on it we don't need to call the function
      since we already have the pointer. If we only have a pointer to the `struct
      device` we can use `dev_to_iio_dev()` to get the IIO device from it.
      
      Furthermore the drvdata is supposed to be reserved for drivers, so it
      should not be used by the IIO core in the first place.
      
      The `set_drvdata()` has been around from the very beginning of the IIO
      framework and back then it was used in the IIO device sysfs attribute
      handling code. But that was subsequently replaced with a `dev_to_iio_dev()`
      in commit e53f5ac5 ("iio: Use dev_to_iio_dev()") and other cleanups.
      
      The self `set_drvdata()` is now no longer needed and can be removed.
      
      Verified that there no longer any users by checking for potential users
      using the following two coccinelle scripts and reviewing that none of the
      matches are problematic code.
      
      <smpl>
      @@
      struct iio_dev *iio_dev;
      expression dev;
      identifier fn !~ "(remove|resume|suspend)";
      @@
      fn(...)
      {
      ...
      *iio_dev = dev_get_drvdata(dev)
      ...
      }
      </smpl>
      
      <smpl>
      @r1@
      position p;
      struct iio_dev *indio_dev;
      identifier dev_fn =~ "^dev_";
      identifier devm_fn =~ "^devm_";
      @@
      (
       dev_fn
      |
       devm_fn
      )
       (&indio_dev@p->dev, ...)
      
      @@
      struct iio_dev *indio_dev;
      position p != r1.p;
      @@
      *&indio_dev@p->dev</smpl>
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      8b7651f2
  2. 12 Dec, 2021 19 commits
  3. 04 Dec, 2021 7 commits
  4. 27 Nov, 2021 5 commits
  5. 20 Nov, 2021 1 commit
  6. 17 Nov, 2021 6 commits