[PATCH v2 0/4] iio: introduce devm_ API for hid sensro setup and cleanup

Sanjay Chitroda posted 4 patches 1 month, 2 weeks ago
There is a newer version of this series
drivers/iio/accel/hid-sensor-accel-3d.c       |  4 +--
.../common/hid-sensors/hid-sensor-trigger.c   | 27 +++++++++++++++++--
.../common/hid-sensors/hid-sensor-trigger.h   |  5 ++--
drivers/iio/gyro/hid-sensor-gyro-3d.c         | 10 +++----
drivers/iio/humidity/hid-sensor-humidity.c    | 10 +++----
drivers/iio/light/hid-sensor-als.c            |  4 +--
drivers/iio/light/hid-sensor-prox.c           |  4 +--
drivers/iio/magnetometer/hid-sensor-magn-3d.c |  4 +--
drivers/iio/orientation/hid-sensor-incl-3d.c  |  4 +--
drivers/iio/orientation/hid-sensor-rotation.c |  4 +--
.../position/hid-sensor-custom-intel-hinge.c  |  4 +--
drivers/iio/pressure/hid-sensor-press.c       |  4 +--
.../iio/temperature/hid-sensor-temperature.c  |  4 +--
13 files changed, 52 insertions(+), 36 deletions(-)
[PATCH v2 0/4] iio: introduce devm_ API for hid sensro setup and cleanup
Posted by Sanjay Chitroda 1 month, 2 weeks ago
From: Sanjay Chitroda <sanjayembeddedse@gmail.com>

Key highlights:
- Prepare change as pre-requisite for devm conversion for HID IIO
  drivers by removing redundant argument
- Add devm API to setup trigger and clenaup resource using
  devm_add_action_or_reset()
- few sample driver update using devm conversion to auto release resource

changes in v2:
- Following input from Jonathan and Andy, squash initial patch v1
  series in single change as individual change should not break anything
- Add devm API support and two driver using the same
- v1 series -> https://lore.kernel.org/all/20260428071613.1134053-1-sanjayembedded@gmail.com/

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

Based on further feedback and reviews, I would extend this series to convert all HID IIO driver to use devm_* API.

Thanks,
Sanjay Chitroda

Sanjay Chitroda (4):
  iio: hid-sensors: drop redundant iio_dev argument
  iio: hid-sensors: introduce device managed API
  iio: gyro: drop hid_sensor_remove_trigger() using devm API
  iio: humidity: drop hid_sensor_remove_trigger() using devm API

 drivers/iio/accel/hid-sensor-accel-3d.c       |  4 +--
 .../common/hid-sensors/hid-sensor-trigger.c   | 27 +++++++++++++++++--
 .../common/hid-sensors/hid-sensor-trigger.h   |  5 ++--
 drivers/iio/gyro/hid-sensor-gyro-3d.c         | 10 +++----
 drivers/iio/humidity/hid-sensor-humidity.c    | 10 +++----
 drivers/iio/light/hid-sensor-als.c            |  4 +--
 drivers/iio/light/hid-sensor-prox.c           |  4 +--
 drivers/iio/magnetometer/hid-sensor-magn-3d.c |  4 +--
 drivers/iio/orientation/hid-sensor-incl-3d.c  |  4 +--
 drivers/iio/orientation/hid-sensor-rotation.c |  4 +--
 .../position/hid-sensor-custom-intel-hinge.c  |  4 +--
 drivers/iio/pressure/hid-sensor-press.c       |  4 +--
 .../iio/temperature/hid-sensor-temperature.c  |  4 +--
 13 files changed, 52 insertions(+), 36 deletions(-)


base-commit: eade2b843d9b1f668fc1775f15611bb0a1999cd9
-- 
2.34.1
Re: [PATCH v2 0/4] iio: introduce devm_ API for hid sensro setup and cleanup
Posted by srinivas pandruvada 1 month, 2 weeks ago
+ Lixu

On Wed, 2026-04-29 at 23:29 +0530, Sanjay Chitroda wrote:
> From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
> 
> Key highlights:
> - Prepare change as pre-requisite for devm conversion for HID IIO
>   drivers by removing redundant argument
> - Add devm API to setup trigger and clenaup resource using
>   devm_add_action_or_reset()
> - few sample driver update using devm conversion to auto release
> resource
> 

devm_* calls are fine but needs tests particularly when forces ISH PCI
drivers unbind, while iio-sensor-proxy has open sessions.

Lixu, Please check.

Thanks,
Srinivas



> changes in v2:
> - Following input from Jonathan and Andy, squash initial patch v1
>   series in single change as individual change should not break
> anything
> - Add devm API support and two driver using the same
> - v1 series ->
> https://lore.kernel.org/all/20260428071613.1134053-1-sanjayembedded@gmail.com/
> 
> Testing:
>   - Compiled with W=1
>   - Build-tested on QEMU x86_64
> 
> Based on further feedback and reviews, I would extend this series to
> convert all HID IIO driver to use devm_* API.
> 
> Thanks,
> Sanjay Chitroda
> 
> Sanjay Chitroda (4):
>   iio: hid-sensors: drop redundant iio_dev argument
>   iio: hid-sensors: introduce device managed API
>   iio: gyro: drop hid_sensor_remove_trigger() using devm API
>   iio: humidity: drop hid_sensor_remove_trigger() using devm API
> 
>  drivers/iio/accel/hid-sensor-accel-3d.c       |  4 +--
>  .../common/hid-sensors/hid-sensor-trigger.c   | 27
> +++++++++++++++++--
>  .../common/hid-sensors/hid-sensor-trigger.h   |  5 ++--
>  drivers/iio/gyro/hid-sensor-gyro-3d.c         | 10 +++----
>  drivers/iio/humidity/hid-sensor-humidity.c    | 10 +++----
>  drivers/iio/light/hid-sensor-als.c            |  4 +--
>  drivers/iio/light/hid-sensor-prox.c           |  4 +--
>  drivers/iio/magnetometer/hid-sensor-magn-3d.c |  4 +--
>  drivers/iio/orientation/hid-sensor-incl-3d.c  |  4 +--
>  drivers/iio/orientation/hid-sensor-rotation.c |  4 +--
>  .../position/hid-sensor-custom-intel-hinge.c  |  4 +--
>  drivers/iio/pressure/hid-sensor-press.c       |  4 +--
>  .../iio/temperature/hid-sensor-temperature.c  |  4 +--
>  13 files changed, 52 insertions(+), 36 deletions(-)
> 
> 
> base-commit: eade2b843d9b1f668fc1775f15611bb0a1999cd9
Re: [PATCH v2 0/4] iio: introduce devm_ API for hid sensro setup and cleanup
Posted by Jonathan Cameron 1 month, 1 week ago
On Fri, 01 May 2026 04:53:38 -0700
srinivas pandruvada <srinivas.pandruvada@linux.intel.com> wrote:

> + Lixu
> 
> On Wed, 2026-04-29 at 23:29 +0530, Sanjay Chitroda wrote:
> > From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
> > 
> > Key highlights:
> > - Prepare change as pre-requisite for devm conversion for HID IIO
> >   drivers by removing redundant argument
> > - Add devm API to setup trigger and clenaup resource using
> >   devm_add_action_or_reset()
> > - few sample driver update using devm conversion to auto release
> > resource
> >   
> 
> devm_* calls are fine but needs tests particularly when forces ISH PCI
> drivers unbind, while iio-sensor-proxy has open sessions.
> 
> Lixu, Please check.
Hold off perhaps until we have a v3 with fixes for the existing devm
calls against wrong struct device.

Thanks,

Jonathan

> 
> Thanks,
> Srinivas
> 
> 
> 
> > changes in v2:
> > - Following input from Jonathan and Andy, squash initial patch v1
> >   series in single change as individual change should not break
> > anything
> > - Add devm API support and two driver using the same
> > - v1 series ->
> > https://lore.kernel.org/all/20260428071613.1134053-1-sanjayembedded@gmail.com/
> > 
> > Testing:
> >   - Compiled with W=1
> >   - Build-tested on QEMU x86_64
> > 
> > Based on further feedback and reviews, I would extend this series to
> > convert all HID IIO driver to use devm_* API.
> > 
> > Thanks,
> > Sanjay Chitroda
> > 
> > Sanjay Chitroda (4):
> >   iio: hid-sensors: drop redundant iio_dev argument
> >   iio: hid-sensors: introduce device managed API
> >   iio: gyro: drop hid_sensor_remove_trigger() using devm API
> >   iio: humidity: drop hid_sensor_remove_trigger() using devm API
> > 
> >  drivers/iio/accel/hid-sensor-accel-3d.c       |  4 +--
> >  .../common/hid-sensors/hid-sensor-trigger.c   | 27
> > +++++++++++++++++--
> >  .../common/hid-sensors/hid-sensor-trigger.h   |  5 ++--
> >  drivers/iio/gyro/hid-sensor-gyro-3d.c         | 10 +++----
> >  drivers/iio/humidity/hid-sensor-humidity.c    | 10 +++----
> >  drivers/iio/light/hid-sensor-als.c            |  4 +--
> >  drivers/iio/light/hid-sensor-prox.c           |  4 +--
> >  drivers/iio/magnetometer/hid-sensor-magn-3d.c |  4 +--
> >  drivers/iio/orientation/hid-sensor-incl-3d.c  |  4 +--
> >  drivers/iio/orientation/hid-sensor-rotation.c |  4 +--
> >  .../position/hid-sensor-custom-intel-hinge.c  |  4 +--
> >  drivers/iio/pressure/hid-sensor-press.c       |  4 +--
> >  .../iio/temperature/hid-sensor-temperature.c  |  4 +--
> >  13 files changed, 52 insertions(+), 36 deletions(-)
> > 
> > 
> > base-commit: eade2b843d9b1f668fc1775f15611bb0a1999cd9  
RE: [PATCH v2 0/4] iio: introduce devm_ API for hid sensro setup and cleanup
Posted by Zhang, Lixu 1 month, 1 week ago
>-----Original Message-----
>From: Jonathan Cameron <jic23@kernel.org>
>Sent: Wednesday, May 6, 2026 12:33 AM
>To: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
>Cc: Sanjay Chitroda <sanjayembeddedse@gmail.com>; jikos@kernel.org;
>Lechner, David <dlechner@baylibre.com>; nuno.sa@analog.com;
>andy@kernel.org; sakari.ailus@linux.intel.com; linux-input@vger.kernel.org;
>linux-iio@vger.kernel.org; linux-kernel@vger.kernel.org; Zhang, Lixu
><lixu.zhang@intel.com>
>Subject: Re: [PATCH v2 0/4] iio: introduce devm_ API for hid sensro setup and
>cleanup
>
>On Fri, 01 May 2026 04:53:38 -0700
>srinivas pandruvada <srinivas.pandruvada@linux.intel.com> wrote:
>
>> + Lixu
>>
>> On Wed, 2026-04-29 at 23:29 +0530, Sanjay Chitroda wrote:
>> > From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
>> >
>> > Key highlights:
>> > - Prepare change as pre-requisite for devm conversion for HID IIO
>> >   drivers by removing redundant argument
>> > - Add devm API to setup trigger and clenaup resource using
>> >   devm_add_action_or_reset()
>> > - few sample driver update using devm conversion to auto release
>> > resource
>> >
>>
>> devm_* calls are fine but needs tests particularly when forces ISH PCI
>> drivers unbind, while iio-sensor-proxy has open sessions.
>>
>> Lixu, Please check.
>Hold off perhaps until we have a v3 with fixes for the existing devm calls against
>wrong struct device.

Sure, I'll test the ISH unbind scenario once v3 is out.

Thanks,
Lixu

>
>Thanks,
>
>Jonathan
>
>>
>> Thanks,
>> Srinivas
>>

Re: [PATCH v2 0/4] iio: introduce devm_ API for hid sensro setup and cleanup
Posted by Andy Shevchenko 1 month, 2 weeks ago
On Wed, Apr 29, 2026 at 11:29:14PM +0530, Sanjay Chitroda wrote:

> Key highlights:
> - Prepare change as pre-requisite for devm conversion for HID IIO
>   drivers by removing redundant argument
> - Add devm API to setup trigger and clenaup resource using
>   devm_add_action_or_reset()
> - few sample driver update using devm conversion to auto release resource

> Based on further feedback and reviews, I would extend this series to convert
> all HID IIO driver to use devm_* API.

Not sure about this. But if people (and HID sensors maintainers in particular)
are fine with this, I have no objections. There are some nit-picks and one
serious problem to address, though.

-- 
With Best Regards,
Andy Shevchenko