Skip to content

RFC iio: introduce iio_device_{claim|release}_direct_mode()

Alison Schofield linux-iio lkml outreachy 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest2 patches 4 repliesIn review
  2. v1 RFC2 patches 4 repliesSuperseded

Changes in v2 from the cover letter

o use iio_device prefix for new functions
o replace EINVAL with EBUSY on failure to claim direct mode
o update commit msg & changelog to reflect new prefix

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2iio: core: implement iio_device_{claim|release}_direct_mode()drivers/iio/industrialio-core.c include/linux/iio/iio.h+41 -01 reply
2/2staging: iio: ad7192: use iio_device_{claim|release}_direct_mode()drivers/staging/iio/adc/ad7192.c+9 -152 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [RFC PATCH v2 0/2] iio: introduce iio_device_{claim|release}_direct_mode()

This patchset introduces two helper functions to simplify driver code requiring the device to be locked in direct mode during execution of a code path. The staging driver ad7192 is updated to demonstrate usage.

This could be applied to approximately 18 known cases where the driver is holding the lock in direct mode. Unknown cases might be those that should, but don't, hold the lock.

Alternate implementation: Generalize to support a claim on any mode. Do iio_claim_mode(device,mode) where if the device is in *mode*, it is guaranteed to stay that way until release is called. I considered and rejected this option because a) not sure other modes would ever need to be locked, and b) the semantic improvement is less when it is generalized.

This patchset was inspired by a discussion on linux-iio:
http://www.spinics.net/lists/linux-iio/msg18540.html

Changes in v2:
o use iio_device prefix for new functions
o replace EINVAL with EBUSY on failure to claim direct mode
o update commit msg & changelog to reflect new prefix

Alison Schofield (2):
iio: core: implement iio_device_{claim|release}_direct_mode()
staging: iio: ad7192: use iio_device_{claim|release}_direct_mode()

 drivers/iio/industrialio-core.c  | 39 +++++++++++++++++++++++++++++++++++++++
 drivers/staging/iio/adc/ad7192.c | 24 +++++++++---------------
 include/linux/iio/iio.h          |  2 ++
 3 files changed, 50 insertions(+), 15 deletions(-)
Signature · 1 line
2.1.4