Skip to content

iio: light: cm3232: fix remove ordering, locking and calibscale validation

Vineet Thakran linux-iio stable 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3iio: light: cm3232: unregister the device before powering it downdrivers/iio/light/cm3232.c+2 -20 replies
2/3iio: light: cm3232: serialize access to the cached command registerdrivers/iio/light/cm3232.c+16 -00 replies
3/3iio: light: cm3232: reject invalid calibscale valuesdrivers/iio/light/cm3232.c+2 -00 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/3] iio: light: cm3232: fix remove ordering, locking and calibscale validation

This series fixes three bugs in the cm3232 ambient light sensor driver, all present since the driver was added:

1. cm3232_remove() shuts the sensor down before unregistering the IIO device, so sysfs accesses in between can read a shut-down sensor or turn it back on.
2. Nothing serializes the read-modify-write of the cached command register (and calibscale) between read_raw(), write_raw(), suspend and resume.
3. in_illuminance_calibscale accepts zero, negative and fractional values, which give meaningless lux readings.

Patch 2 uses guard() and devm_mutex_init(), so older stable trees will need a manual backport of it.

The series is compile-tested only (W=1, sparse, checkpatch --strict); I don't have CM3232 hardware to test on.

Vineet Thakran (3):
iio: light: cm3232: unregister the device before powering it down
iio: light: cm3232: serialize access to the cached command register
iio: light: cm3232: reject invalid calibscale values

 drivers/iio/light/cm3232.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

base-commit: e5aad2bdbbee783611d32599f89cea3f12f9593d

Signature · 1 line
2.43.0