[PATCH 0/2] iio: accel: small cleanups and error-handling improvements

Sanjay Chitroda posted 2 patches 1 month, 4 weeks ago
drivers/iio/accel/adxl313_core.c | 10 +++++-----
drivers/iio/accel/adxl313_i2c.c  | 10 ++++------
drivers/iio/accel/adxl313_spi.c  | 10 ++++------
drivers/iio/accel/adxl355_core.c | 28 +++++++++++-----------------
drivers/iio/accel/adxl355_i2c.c  | 11 ++++-------
drivers/iio/accel/adxl355_spi.c  | 11 ++++-------
drivers/iio/accel/adxl367.c      |  4 +++-
drivers/iio/accel/adxl372.c      | 10 +++++-----
drivers/iio/accel/adxl380.c      |  4 +++-
9 files changed, 43 insertions(+), 55 deletions(-)
[PATCH 0/2] iio: accel: small cleanups and error-handling improvements
Posted by Sanjay Chitroda 1 month, 4 weeks ago
From: Sanjay Chitroda <sanjayembeddedse@gmail.com>

Hi all,

This series contains a few small cleanups and robustness improvements to
adxl313, adxl380, adxl355, adxl367 and adxl372 IIO accelerometer drivers.

The changes modernize mutex handling using devm-managed helpers.
In addition, error handling during probe is cleaned up by switching to
dev_err_probe() to better handle deferred probing.

Changes in v2:
- Drop guard() changes as it's already available in iio/testing.
- Rebase changes on top of iio/testing with guidance from Andy.
- Added new change for additional iio accel drivers.

No functional changes are intended.

Testing:
  - Compiled with W=1
  - Build-tested on QEMU x86_64

Thanks,
Sanjay Chitroda

Sanjay Chitroda (8):
  iio: accel: adxl313_core: Use devm-managed mutex initialization
  iio: accel: adxl313: Use dev_err_probe
  iio: accel: adxl380: Use devm-managed mutex initialization
  iio: accel: adxl355_core: Use devm-managed mutex initialization
  iio: accel: adxl355: Use dev_err_probe
  iio: accel: adxl367: Use devm-managed mutex initialization
  iio: accel: adxl372: Use devm-managed mutex initialization
  iio: accel: adxl372: Use dev_err_probe

 drivers/iio/accel/adxl313_core.c | 10 +++++-----
 drivers/iio/accel/adxl313_i2c.c  | 10 ++++------
 drivers/iio/accel/adxl313_spi.c  | 10 ++++------
 drivers/iio/accel/adxl355_core.c | 28 +++++++++++-----------------
 drivers/iio/accel/adxl355_i2c.c  | 11 ++++-------
 drivers/iio/accel/adxl355_spi.c  | 11 ++++-------
 drivers/iio/accel/adxl367.c      |  4 +++-
 drivers/iio/accel/adxl372.c      | 10 +++++-----
 drivers/iio/accel/adxl380.c      |  4 +++-
 9 files changed, 43 insertions(+), 55 deletions(-)


base-commit: 0ccdcdc698b7ba52f2c9bc09bfdf9f020ca0e6e6
-- 
2.34.1
Re: [PATCH 0/2] iio: accel: small cleanups and error-handling improvements
Posted by Jonathan Cameron 1 month, 3 weeks ago
On Fri, 17 Apr 2026 18:19:16 +0530
Sanjay Chitroda <sanjayembeddedse@gmail.com> wrote:

> From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
> 
> Hi all,
> 
> This series contains a few small cleanups and robustness improvements to
> adxl313, adxl380, adxl355, adxl367 and adxl372 IIO accelerometer drivers.

0/2  in patch title? It's fine for that bit to change from version to version.

Anyhow, I tweaked as Andy suggested whilst applying and picked up the lot.

Note however, that the advantage of devm_mutex_init() is minor at best,
which is why we didn't bother with mutex_destroy() most of the time
before this convenient way of calling it existed.  Combined with
dev_err_probe() being nice but minor cleanup, I'd generally reserved these
sorts of changes for when someone is otherwise working on a driver or
doing a more thorough modernisation.

I don't mind people doing this sort of thing for one of their first
few patches, so what you have here is fine, but it's not suitable material
for a mass cleanup of the whole subsystem!

Thanks,

Jonathan

> 
> The changes modernize mutex handling using devm-managed helpers.
> In addition, error handling during probe is cleaned up by switching to
> dev_err_probe() to better handle deferred probing.
> 
> Changes in v2:
> - Drop guard() changes as it's already available in iio/testing.
> - Rebase changes on top of iio/testing with guidance from Andy.
> - Added new change for additional iio accel drivers.
> 
> No functional changes are intended.
> 
> Testing:
>   - Compiled with W=1
>   - Build-tested on QEMU x86_64
> 
> Thanks,
> Sanjay Chitroda
> 
> Sanjay Chitroda (8):
>   iio: accel: adxl313_core: Use devm-managed mutex initialization
>   iio: accel: adxl313: Use dev_err_probe
>   iio: accel: adxl380: Use devm-managed mutex initialization
>   iio: accel: adxl355_core: Use devm-managed mutex initialization
>   iio: accel: adxl355: Use dev_err_probe
>   iio: accel: adxl367: Use devm-managed mutex initialization
>   iio: accel: adxl372: Use devm-managed mutex initialization
>   iio: accel: adxl372: Use dev_err_probe
> 
>  drivers/iio/accel/adxl313_core.c | 10 +++++-----
>  drivers/iio/accel/adxl313_i2c.c  | 10 ++++------
>  drivers/iio/accel/adxl313_spi.c  | 10 ++++------
>  drivers/iio/accel/adxl355_core.c | 28 +++++++++++-----------------
>  drivers/iio/accel/adxl355_i2c.c  | 11 ++++-------
>  drivers/iio/accel/adxl355_spi.c  | 11 ++++-------
>  drivers/iio/accel/adxl367.c      |  4 +++-
>  drivers/iio/accel/adxl372.c      | 10 +++++-----
>  drivers/iio/accel/adxl380.c      |  4 +++-
>  9 files changed, 43 insertions(+), 55 deletions(-)
> 
> 
> base-commit: 0ccdcdc698b7ba52f2c9bc09bfdf9f020ca0e6e6
Re: [PATCH 0/2] iio: accel: small cleanups and error-handling improvements
Posted by Sanjay Chitroda 1 month, 3 weeks ago

On 19 April 2026 10:04:08 pm IST, Jonathan Cameron <jic23@kernel.org> wrote:
>On Fri, 17 Apr 2026 18:19:16 +0530
>Sanjay Chitroda <sanjayembeddedse@gmail.com> wrote:
>
>> From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
>> 
>> Hi all,
>> 
>> This series contains a few small cleanups and robustness improvements to
>> adxl313, adxl380, adxl355, adxl367 and adxl372 IIO accelerometer drivers.
>
>0/2  in patch title? It's fine for that bit to change from version to version.
>
>Anyhow, I tweaked as Andy suggested whilst applying and picked up the lot.
>
>Note however, that the advantage of devm_mutex_init() is minor at best,
>which is why we didn't bother with mutex_destroy() most of the time
>before this convenient way of calling it existed.  Combined with
>dev_err_probe() being nice but minor cleanup, I'd generally reserved these
>sorts of changes for when someone is otherwise working on a driver or
>doing a more thorough modernisation.
>
>I don't mind people doing this sort of thing for one of their first
>few patches, so what you have here is fine, but it's not suitable material
>for a mass cleanup of the whole subsystem!
>
>Thanks,
>
>Jonathan

Hi Jonathan,

Thank you for your input, assistance and considering the changes.

I understand and agree, will take care this part.
>
>> 
>> The changes modernize mutex handling using devm-managed helpers.
>> In addition, error handling during probe is cleaned up by switching to
>> dev_err_probe() to better handle deferred probing.
>> 
>> Changes in v2:
>> - Drop guard() changes as it's already available in iio/testing.
>> - Rebase changes on top of iio/testing with guidance from Andy.
>> - Added new change for additional iio accel drivers.
>> 
>> No functional changes are intended.
>> 
>> Testing:
>>   - Compiled with W=1
>>   - Build-tested on QEMU x86_64
>> 
>> Thanks,
>> Sanjay Chitroda
>> 
>> Sanjay Chitroda (8):
>>   iio: accel: adxl313_core: Use devm-managed mutex initialization
>>   iio: accel: adxl313: Use dev_err_probe
>>   iio: accel: adxl380: Use devm-managed mutex initialization
>>   iio: accel: adxl355_core: Use devm-managed mutex initialization
>>   iio: accel: adxl355: Use dev_err_probe
>>   iio: accel: adxl367: Use devm-managed mutex initialization
>>   iio: accel: adxl372: Use devm-managed mutex initialization
>>   iio: accel: adxl372: Use dev_err_probe
>> 
>>  drivers/iio/accel/adxl313_core.c | 10 +++++-----
>>  drivers/iio/accel/adxl313_i2c.c  | 10 ++++------
>>  drivers/iio/accel/adxl313_spi.c  | 10 ++++------
>>  drivers/iio/accel/adxl355_core.c | 28 +++++++++++-----------------
>>  drivers/iio/accel/adxl355_i2c.c  | 11 ++++-------
>>  drivers/iio/accel/adxl355_spi.c  | 11 ++++-------
>>  drivers/iio/accel/adxl367.c      |  4 +++-
>>  drivers/iio/accel/adxl372.c      | 10 +++++-----
>>  drivers/iio/accel/adxl380.c      |  4 +++-
>>  9 files changed, 43 insertions(+), 55 deletions(-)
>> 
>> 
>> base-commit: 0ccdcdc698b7ba52f2c9bc09bfdf9f020ca0e6e6
>