summaryrefslogtreecommitdiff
path: root/drivers/iio
AgeCommit message (Collapse)Author
2025-03-04iio: adc: stm32-dfsdm: Factor out core of reading INFO_RAWJonathan Cameron
This allows the claim on direct mode to be release in one place rather than a lot of error paths, simplifying code. Reviewed-by: Olivier Moysan <olivier.moysan@foss.st.com> Link: https://patch.msgid.link/20250217141630.897334-8-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: light: Add support for AL3000a illuminance sensorSvyatoslav Ryhel
AL3000a is a simple I2C-based ambient light sensor, which is closely related to AL3010 and AL3320a, but has significantly different way of processing data generated by the sensor. Tested-by: Robert Eckelmann <longnoserob@gmail.com> Tested-by: Antoni Aloy Torrens <aaloytorrens@gmail.com> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: David Heidelberg <david@ixit.cz> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://patch.msgid.link/20250217140336.107476-3-clamor95@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: accel: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
Single patch for the simple cases in accelerometer drivers. These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Cc: Antoniu Miclaus <antoniu.miclaus@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250217140135.896574-9-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: accel: msa311: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250217140135.896574-8-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: accel: msa311: Fix failure to release runtime pm if direct mode claim ↵Jonathan Cameron
fails. Reorder the claiming of direct mode and runtime pm calls to simplify handling a little. For correct error handling, after the reorder iio_device_release_direct_mode() must be claimed in an error occurs in pm_runtime_resume_and_get() Fixes: 1ca2cfbc0c33 ("iio: add MEMSensing MSA311 3-axis accelerometer driver") Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250217140135.896574-7-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: accel: kx022a: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Cc: Matti Vaittinen <mazziesaccount@gmail.com> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250217140135.896574-6-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: accel: kx022a: Factor out guts of write_raw() to allow direct returnsJonathan Cameron
Create a new utility function for the actions taken when direct mode is held. This allows for direct returns, simplifying the code flow. Cc: Matti Vaittinen <mazziesaccount@gmail.com> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250217140135.896574-5-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: accel: mma8452: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250217140135.896574-4-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: accel: mma8452: Factor out guts of write_raw() to simplify lockingJonathan Cameron
Factoring out those parts of write_raw() in which direct mode is held allows for direct returns on errors, simplifying the code. Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250217140135.896574-3-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: accel: mma8452: Ensure error return on failure to matching oversampling ↵Jonathan Cameron
ratio If a match was not found, then the write_raw() callback would return the odr index, not an error. Return -EINVAL if this occurs. To avoid similar issues in future, introduce j, a new indexing variable rather than using ret for this purpose. Fixes: 79de2ee469aa ("iio: accel: mma8452: claim direct mode during write raw") Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250217140135.896574-2-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: imu: adis16550: add adis16550 supportRobert Budai
The ADIS16550 is a complete inertial system that includes a triaxis gyroscope and a triaxis accelerometer. Each inertial sensor in the ADIS16550 combines industry leading MEMS only technology with signal conditioning that optimizes dynamic performance. The factory calibration characterizes each sensor for sensitivity, bias, and alignment. As a result, each sensor has its own dynamic compensation formulas that provide accurate sensor measurements. Co-developed-by: Ramona Gradinariu <ramona.gradinariu@analog.com> Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com> Co-developed-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Co-developed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Robert Budai <robert.budai@analog.com> Link: https://patch.msgid.link/20250217105753.605465-6-robert.budai@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-24iio: imu: st_lsm9ds0: Replace device.h with what is neededAndy Shevchenko
Instead of including a huge device.h with tons of dependencies include only what driver actually uses. Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2025-02-24iio: adc: xilinx-xadc-core: use devm_kmemdup_array()Raag Jadav
Convert to use devm_kmemdup_array() and while at it, use source size instead of destination. Signed-off-by: Raag Jadav <raag.jadav@intel.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2025-02-22iio: imu: adis: Add DIAG_STAT registerRobert Budai
Some devices may have more than 16 bits of status. This patch allows the user to specify the size of the DIAG_STAT register. It defaults to 2 if not specified. This is mainly for backward compatibility. Co-developed-by: Ramona Gradinariu <ramona.gradinariu@analog.com> Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com> Co-developed-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Co-developed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Robert Budai <robert.budai@analog.com> Link: https://patch.msgid.link/20250217105753.605465-4-robert.budai@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-22iio: imu: adis: Add reset to custom opsRobert Budai
This patch allows the custom definition of reset functionality for adis object. It is useful in cases where the driver does not need to sleep after the reset since it is handled by the library. Co-developed-by: Ramona Gradinariu <ramona.gradinariu@analog.com> Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com> Co-developed-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Co-developed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Robert Budai <robert.budai@analog.com> Link: https://patch.msgid.link/20250217105753.605465-3-robert.budai@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-22iio: imu: adis: Add custom ops structRobert Budai
This patch introduces a custom ops struct letting users define custom read and write functions. Some adis devices might define a completely different spi protocol from the one used in the default implementation. Co-developed-by: Ramona Gradinariu <ramona.gradinariu@analog.com> Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com> Co-developed-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Co-developed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Robert Budai <robert.budai@analog.com> Link: https://patch.msgid.link/20250217105753.605465-2-robert.budai@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-22iio: resolver: ad2s1210: use bitmap_writeDavid Lechner
Replace bitmap array access with bitmap_write. Accessing the bitmap array directly is not recommended and now there is a helper function that can be used. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250210-gpio-set-array-helper-v3-10-d6a673674da8@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-18iio: Switch to use hrtimer_setup()Nam Cao
hrtimer_setup() takes the callback function pointer as argument and initializes the timer completely. Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism. Patch was created by using Coccinelle. Signed-off-by: Nam Cao <namcao@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Zack Rusin <zack.rusin@broadcom.com> Link: https://lore.kernel.org/all/570792e31b28a94a511c19c6789f2171a6745685.1738746904.git.namcao@linutronix.de
2025-02-17iio: resolver: ad2s1210: use gpiod_multi_set_value_cansleepDavid Lechner
Reduce verbosity by using gpiod_multi_set_value_cansleep() instead of gpiod_set_array_value(). These are not called in an atomic context, so changing to the cansleep variant is fine. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250210-gpio-set-array-helper-v3-9-d6a673674da8@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: amplifiers: hmc425a: use gpiod_multi_set_value_cansleepDavid Lechner
Reduce verbosity by using gpiod_multi_set_value_cansleep() instead of gpiod_set_array_value_cansleep(). Passing NULL as the 3rd argument to gpiod_set_array_value_cansleep() only needs to be done if the array was constructed manually, which is not the case here. This change effectively replaces that argument with st->gpios->array_info. The possible side effect of this change is that it could make setting the GPIOs more efficient. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250210-gpio-set-array-helper-v3-8-d6a673674da8@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: adc: ad7606: use gpiod_multi_set_value_cansleepDavid Lechner
Reduce verbosity by using gpiod_multi_set_value_cansleep() instead of gpiod_set_array_value(). These are not called in an atomic context, so changing to the cansleep variant is fine. Also drop unnecessary braces while we are at it. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250210-gpio-set-array-helper-v3-7-d6a673674da8@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: light: bh1745: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context. Reviewed-by: Mudit Sharma <muditsharma.info@gmail.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250209180624.701140-27-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: imu: bmi323: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context. Cc: Julien Stephan <jstephan@baylibre.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250209180624.701140-26-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: dummy: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context. Introduce two new utility functions to allow for direct returns with claim and release of direct mode in the caller. Reviewed-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20250209180624.701140-25-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: dac: ad8460: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context. Cc: Mariel Tinaco <Mariel.Tinaco@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20250209180624.701140-24-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: dac: ad3552r-hs: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context. Cc: Angelo Dureghello <adureghello@baylibre.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20250209180624.701140-23-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: chemical: ens160: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context. Reviewed-by: Gustavo Silva <gustavograzs@gmail.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250209180624.701140-22-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: addac: ad74413r: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context. Includes moving a mutex lock into a function rather than around it to simplify the error handling. Reviewed-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20250209180624.701140-21-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: adc: ti-ads1119: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context. Cc: João Paulo Gonçalves <joao.goncalves@toradex.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250209180624.701140-20-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: adc: ti-adc161s626: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250209180624.701140-19-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: adc: rtq6056: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context Reviewed-by: ChiYuan Huang <cy_huang@richtek.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250209180624.701140-18-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: adc: max1363: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context. Reviewed-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20250209180624.701140-17-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: adc: ad9467: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context. Also use guard() to simplify mutex unlock paths. Reviewed-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20250209180624.701140-16-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: adc: ad7779: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context. Cc: Ramona Alexandra Nechita <ramona.nechita@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20250209180624.701140-15-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: adc: ad7625: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context. Reviewed-by: Trevor Gamblin <tgamblin@baylibre.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20250209180624.701140-14-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: adc: ad7606: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context. Cc: Guillaume Stols <gstols@baylibre.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20250209180624.701140-13-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: adc: ad4695: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context. In some cases code is factored out to utility functions that can do a direct return with the claim and release around the call. Reviewed-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20250209180624.701140-12-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: adc: ad4130: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context. Cc: Cosmin Tanislav <demonsingur@gmail.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20250209180624.701140-11-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: adc: ad4000: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context. Reviewed-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Tested-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20250209180624.701140-10-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: accel: adxl367: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context In some cases there is a convenient wrapper function to which the handling can be moved. Do that instead of introducing another layer of wrappers. In others an outer wrapper is added which claims direct mode, runs the original function with the scoped claim logic removed, releases direct mode and then checks for errors. Cc: Cosmin Tanislav <demonsingur@gmail.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20250209180624.701140-9-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: proximity: sx9360: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250209180624.701140-8-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: proximity: sx9324: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250209180624.701140-7-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: proximity: sx9310: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context. Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250209180624.701140-6-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: temperature: tmp006: Stop using iio_device_claim_direct_scoped()Jonathan Cameron
This complex cleanup.h use case of conditional guards has proved to be more trouble that it is worth in terms of false positive compiler warnings and hard to read code. Move directly to the new claim/release_direct() that allow sparse to check for unbalanced context. Cc: Antoni Pokusinski <apokusinski01@gmail.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250209180624.701140-5-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: chemical: scd30: Switch to sparse friendly claim/release_direct()Jonathan Cameron
This driver caused a false positive with __cond_lock() style solution but is fine with the simple boolean return approach now used. Cc: Tomasz Duszynski <tomasz.duszynski@octakon.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250209180624.701140-4-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-17iio: chemical: scd30: Use guard(mutex) to allow early returnsJonathan Cameron
Auto cleanup based release of the lock allows for simpler code flow in a few functions with large multiplexing style switch statements and no common operations following the switch. Suggested-by: David Lechner <dlechner@baylibre.com> Cc: Tomasz Duszynski <tomasz.duszynski@octakon.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250209180624.701140-3-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-16iio: accel: kx022a: convert to use maple tree register cacheBo Liu
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: Bo Liu <liubo03@inspur.com> Acked-by: Matti Vaittinen <mazziesaccount@gmail.com> Link: https://patch.msgid.link/20250212075223.4164-5-liubo03@inspur.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-16iio: accel: bmi088: convert to use maple tree register cacheBo Liu
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: Bo Liu <liubo03@inspur.com> Link: https://patch.msgid.link/20250212075223.4164-4-liubo03@inspur.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-16iio: accel: bma400: convert to use maple tree register cacheBo Liu
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: Bo Liu <liubo03@inspur.com> Link: https://patch.msgid.link/20250212075223.4164-3-liubo03@inspur.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-16iio: accel: msa311: convert to use maple tree register cacheBo Liu
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: Bo Liu <liubo03@inspur.com> Link: https://patch.msgid.link/20250212075223.4164-2-liubo03@inspur.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>