iio: drop redundant iio_dev argument from hid_sensor_remove_trigger()
Subsystems (3)
cover iio: drop redundant iio_dev argument from hid_sensor_remove_trigger()
From: Sanjay Chitroda <[email protected]>
The iio_dev argument has been unused since buffer cleanup moved out of hid_sensor_remove_trigger(). All required resources are tracked via hid_sensor_common, making the extra argument redundant and allowing future devm conversion.
This is a mechanical change with no functional impact.
Testing:
- Compiled with W=1
- Build-tested on QEMU x86_64
Feedback and reviews are very welcome.
Thanks,
Sanjay Chitroda
Sanjay Chitroda (10):
iio: hid-sensors: drop redundant iio_dev argument
iio: orientation: adapt to hid_sensor_remove_trigger() API change
iio: gyro: adapt to hid_sensor_remove_trigger() API change
iio: pressure: adapt to hid_sensor_remove_trigger() API change
iio: temperature: adapt to hid_sensor_remove_trigger() API change
iio: humidity: adapt to hid_sensor_remove_trigger() API change
iio: light: adapt to hid_sensor_remove_trigger() API change
iio: magnetometer: adapt to hid_sensor_remove_trigger() API change
iio: position: adapt to hid_sensor_remove_trigger() API change
iio: accel: adapt to hid_sensor_remove_trigger() API change
drivers/iio/accel/hid-sensor-accel-3d.c | 4 ++-- drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 3 +-- drivers/iio/common/hid-sensors/hid-sensor-trigger.h | 3 +-- drivers/iio/gyro/hid-sensor-gyro-3d.c | 4 ++-- drivers/iio/humidity/hid-sensor-humidity.c | 4 ++-- 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 ++-- drivers/iio/position/hid-sensor-custom-intel-hinge.c | 4 ++-- drivers/iio/pressure/hid-sensor-press.c | 4 ++-- drivers/iio/temperature/hid-sensor-temperature.c | 4 ++-- 13 files changed, 24 insertions(+), 26 deletions(-)
base-commit: eade2b843d9b1f668fc1775f15611bb0a1999cd9
Signature · 1 line
2.34.1
PATCH 1/10 iio: hid-sensors: drop redundant iio_dev argument
From: Sanjay Chitroda <[email protected]>
hid_sensor_remove_trigger() uses struct hid_sensor_common to release resources acquired during trigger setup.
Earlier implementations required struct iio_dev to clean up buffers, but with the current code this argument is no longer used and is redundant.
Removing it simplifies the API and is a preparatory step toward converting the trigger handling to a devm-based API.
--- drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 3 +-- drivers/iio/common/hid-sensors/hid-sensor-trigger.h | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/iio/common/hid-sensors/hid-sensor-trigger.c +1 -2
@@ -218,8 +218,7 @@ static const struct iio_buffer_setup_ops hid_sensor_buffer_ops = { .predisable = buffer_predisable, }; -void hid_sensor_remove_trigger (struct iio_dev *indio_dev, -struct hid_sensor_common *attrb) +void hid_sensor_remove_trigger (struct hid_sensor_common *attrb) {if (atomic_read (&attrb->runtime_pm_enable))pm_runtime_disable (&attrb->pdev->dev);
drivers/iio/common/hid-sensors/hid-sensor-trigger.h +1 -2
@@ -16,8 +16,7 @@ extern const struct dev_pm_ops hid_sensor_pm_ops;int hid_sensor_setup_trigger (struct iio_dev *indio_dev,const char *name,struct hid_sensor_common *attrb); -void hid_sensor_remove_trigger (struct iio_dev *indio_dev, -struct hid_sensor_common *attrb); +void hid_sensor_remove_trigger (struct hid_sensor_common *attrb);int hid_sensor_power_state (struct hid_sensor_common *st,bool state);#endif
Signature · 1 line
2.34.1
PATCH 2/10 iio: orientation: adapt to hid_sensor_remove_trigger() API change
In reply to Sanjay ChitrodaFrom: Sanjay Chitroda <[email protected]>
Update the driver to match the updated hid_sensor_remove_trigger() prototype, which no longer requires struct iio_dev.
--- drivers/iio/orientation/hid-sensor-incl-3d.c | 4 ++-- drivers/iio/orientation/hid-sensor-rotation.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/iio/orientation/hid-sensor-incl-3d.c +2 -2
@@ -378,7 +378,7 @@ static int hid_incl_3d_probe(struct platform_device *pdev) error_iio_unreg:iio_device_unregister (indio_dev); error_remove_trigger: -hid_sensor_remove_trigger (indio_dev, &incl_state->common_attributes); +hid_sensor_remove_trigger (&incl_state->common_attributes);return ret; }
@@ -391,7 +391,7 @@ static void hid_incl_3d_remove(struct platform_device *pdev)sensor_hub_remove_callback (hsdev,HID_USAGE_SENSOR_INCLINOMETER_3D );iio_device_unregister (indio_dev); -hid_sensor_remove_trigger (indio_dev, &incl_state->common_attributes); +hid_sensor_remove_trigger (&incl_state->common_attributes); }static const struct platform_device_id hid_incl_3d_ids[] = {
drivers/iio/orientation/hid-sensor-rotation.c +2 -2
@@ -353,7 +353,7 @@ static int hid_dev_rot_probe(struct platform_device *pdev) error_iio_unreg:iio_device_unregister (indio_dev); error_remove_trigger: -hid_sensor_remove_trigger (indio_dev, &rot_state->common_attributes); +hid_sensor_remove_trigger (&rot_state->common_attributes);return ret; }
@@ -366,7 +366,7 @@ static void hid_dev_rot_remove(struct platform_device *pdev)sensor_hub_remove_callback (hsdev, hsdev->usage);iio_device_unregister (indio_dev); -hid_sensor_remove_trigger (indio_dev, &rot_state->common_attributes); +hid_sensor_remove_trigger (&rot_state->common_attributes); }static const struct platform_device_id hid_dev_rot_ids[] = {
Signature · 1 line
2.34.1
PATCH 3/10 iio: gyro: adapt to hid_sensor_remove_trigger() API change
In reply to Sanjay ChitrodaFrom: Sanjay Chitroda <[email protected]>
Update the driver to match the updated hid_sensor_remove_trigger() prototype, which no longer requires struct iio_dev.
--- drivers/iio/gyro/hid-sensor-gyro-3d.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/gyro/hid-sensor-gyro-3d.c +2 -2
@@ -354,7 +354,7 @@ static int hid_gyro_3d_probe(struct platform_device *pdev) error_iio_unreg:iio_device_unregister (indio_dev); error_remove_trigger: -hid_sensor_remove_trigger (indio_dev, &gyro_state->common_attributes); +hid_sensor_remove_trigger (&gyro_state->common_attributes);return ret; }
@@ -367,7 +367,7 @@ static void hid_gyro_3d_remove(struct platform_device *pdev)sensor_hub_remove_callback (hsdev,HID_USAGE_SENSOR_GYRO_3D );iio_device_unregister (indio_dev); -hid_sensor_remove_trigger (indio_dev, &gyro_state->common_attributes); +hid_sensor_remove_trigger (&gyro_state->common_attributes); }static const struct platform_device_id hid_gyro_3d_ids[] = {
Signature · 1 line
2.34.1
PATCH 4/10 iio: pressure: adapt to hid_sensor_remove_trigger() API change
In reply to Sanjay ChitrodaFrom: Sanjay Chitroda <[email protected]>
Update the driver to match the updated hid_sensor_remove_trigger() prototype, which no longer requires struct iio_dev.
--- drivers/iio/pressure/hid-sensor-press.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/pressure/hid-sensor-press.c +2 -2
@@ -319,7 +319,7 @@ static int hid_press_probe(struct platform_device *pdev) error_iio_unreg:iio_device_unregister (indio_dev); error_remove_trigger: -hid_sensor_remove_trigger (indio_dev, &press_state->common_attributes); +hid_sensor_remove_trigger (&press_state->common_attributes);return ret; }
@@ -332,7 +332,7 @@ static void hid_press_remove(struct platform_device *pdev)sensor_hub_remove_callback (hsdev,HID_USAGE_SENSOR_PRESSURE );iio_device_unregister (indio_dev); -hid_sensor_remove_trigger (indio_dev, &press_state->common_attributes); +hid_sensor_remove_trigger (&press_state->common_attributes); }static const struct platform_device_id hid_press_ids[] = {
Signature · 1 line
2.34.1
PATCH 5/10 iio: temperature: adapt to hid_sensor_remove_trigger() API change
In reply to Sanjay ChitrodaFrom: Sanjay Chitroda <[email protected]>
Update the driver to match the updated hid_sensor_remove_trigger() prototype, which no longer requires struct iio_dev.
--- drivers/iio/temperature/hid-sensor-temperature.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/temperature/hid-sensor-temperature.c +2 -2
@@ -253,7 +253,7 @@ static int hid_temperature_probe(struct platform_device *pdev) error_remove_callback:sensor_hub_remove_callback (hsdev,HID_USAGE_SENSOR_TEMPERATURE ); error_remove_trigger: -hid_sensor_remove_trigger (indio_dev, &temp_st->common_attributes); +hid_sensor_remove_trigger (&temp_st->common_attributes);return ret; }
@@ -265,7 +265,7 @@ static void hid_temperature_remove(struct platform_device *pdev)struct temperature_state *temp_st =iio_priv (indio_dev);sensor_hub_remove_callback (hsdev,HID_USAGE_SENSOR_TEMPERATURE ); -hid_sensor_remove_trigger (indio_dev, &temp_st->common_attributes); +hid_sensor_remove_trigger (&temp_st->common_attributes); }static const struct platform_device_id hid_temperature_ids[] = {
Signature · 1 line
2.34.1
PATCH 6/10 iio: humidity: adapt to hid_sensor_remove_trigger() API change
In reply to Sanjay ChitrodaFrom: Sanjay Chitroda <[email protected]>
Update the driver to match the updated hid_sensor_remove_trigger() prototype, which no longer requires struct iio_dev.
--- drivers/iio/humidity/hid-sensor-humidity.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/humidity/hid-sensor-humidity.c +2 -2
@@ -255,7 +255,7 @@ static int hid_humidity_probe(struct platform_device *pdev) error_remove_callback:sensor_hub_remove_callback (hsdev,HID_USAGE_SENSOR_HUMIDITY ); error_remove_trigger: -hid_sensor_remove_trigger (indio_dev, &humid_st->common_attributes); +hid_sensor_remove_trigger (&humid_st->common_attributes);return ret; }
@@ -268,7 +268,7 @@ static void hid_humidity_remove(struct platform_device *pdev)iio_device_unregister (indio_dev);sensor_hub_remove_callback (hsdev,HID_USAGE_SENSOR_HUMIDITY ); -hid_sensor_remove_trigger (indio_dev, &humid_st->common_attributes); +hid_sensor_remove_trigger (&humid_st->common_attributes); }static const struct platform_device_id hid_humidity_ids[] = {
Signature · 1 line
2.34.1
PATCH 7/10 iio: light: adapt to hid_sensor_remove_trigger() API change
In reply to Sanjay ChitrodaFrom: Sanjay Chitroda <[email protected]>
Update the driver to match the updated hid_sensor_remove_trigger() prototype, which no longer requires struct iio_dev.
--- drivers/iio/light/hid-sensor-als.c | 4 ++-- drivers/iio/light/hid-sensor-prox.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/iio/light/hid-sensor-als.c +2 -2
@@ -432,7 +432,7 @@ static int hid_als_probe(struct platform_device *pdev) error_iio_unreg:iio_device_unregister (indio_dev); error_remove_trigger: -hid_sensor_remove_trigger (indio_dev, &als_state->common_attributes); +hid_sensor_remove_trigger (&als_state->common_attributes);return ret; }
@@ -445,7 +445,7 @@ static void hid_als_remove(struct platform_device *pdev)sensor_hub_remove_callback (hsdev, hsdev->usage);iio_device_unregister (indio_dev); -hid_sensor_remove_trigger (indio_dev, &als_state->common_attributes); +hid_sensor_remove_trigger (&als_state->common_attributes); }static const struct platform_device_id hid_als_ids[] = {
drivers/iio/light/hid-sensor-prox.c +2 -2
@@ -340,7 +340,7 @@ static int hid_prox_probe(struct platform_device *pdev) error_iio_unreg:iio_device_unregister (indio_dev); error_remove_trigger: -hid_sensor_remove_trigger (indio_dev, &prox_state->common_attributes); +hid_sensor_remove_trigger (&prox_state->common_attributes);return ret; }
@@ -353,7 +353,7 @@ static void hid_prox_remove(struct platform_device *pdev)sensor_hub_remove_callback (hsdev, hsdev->usage);iio_device_unregister (indio_dev); -hid_sensor_remove_trigger (indio_dev, &prox_state->common_attributes); +hid_sensor_remove_trigger (&prox_state->common_attributes); }static const struct platform_device_id hid_prox_ids[] = {
Signature · 1 line
2.34.1
PATCH 8/10 iio: magnetometer: adapt to hid_sensor_remove_trigger() API change
In reply to Sanjay ChitrodaFrom: Sanjay Chitroda <[email protected]>
Update the driver to match the updated hid_sensor_remove_trigger() prototype, which no longer requires struct iio_dev.
--- drivers/iio/magnetometer/hid-sensor-magn-3d.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/magnetometer/hid-sensor-magn-3d.c +2 -2
@@ -542,7 +542,7 @@ static int hid_magn_3d_probe(struct platform_device *pdev) error_iio_unreg:iio_device_unregister (indio_dev); error_remove_trigger: -hid_sensor_remove_trigger (indio_dev, &magn_state->magn_flux_attributes); +hid_sensor_remove_trigger (&magn_state->magn_flux_attributes);return ret; }
@@ -555,7 +555,7 @@ static void hid_magn_3d_remove(struct platform_device *pdev)sensor_hub_remove_callback (hsdev,HID_USAGE_SENSOR_COMPASS_3D );iio_device_unregister (indio_dev); -hid_sensor_remove_trigger (indio_dev, &magn_state->magn_flux_attributes); +hid_sensor_remove_trigger (&magn_state->magn_flux_attributes); }static const struct platform_device_id hid_magn_3d_ids[] = {
Signature · 1 line
2.34.1
PATCH 9/10 iio: position: adapt to hid_sensor_remove_trigger() API change
In reply to Sanjay ChitrodaFrom: Sanjay Chitroda <[email protected]>
Update the driver to match the updated hid_sensor_remove_trigger() prototype, which no longer requires struct iio_dev.
--- drivers/iio/position/hid-sensor-custom-intel-hinge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/position/hid-sensor-custom-intel-hinge.c +2 -2
@@ -337,7 +337,7 @@ static int hid_hinge_probe(struct platform_device *pdev) error_remove_callback:sensor_hub_remove_callback (hsdev, hsdev->usage); error_remove_trigger: -hid_sensor_remove_trigger (indio_dev, &st->common_attributes); +hid_sensor_remove_trigger (&st->common_attributes);return ret; }
@@ -350,7 +350,7 @@ static void hid_hinge_remove(struct platform_device *pdev)iio_device_unregister (indio_dev);sensor_hub_remove_callback (hsdev, hsdev->usage); -hid_sensor_remove_trigger (indio_dev, &st->common_attributes); +hid_sensor_remove_trigger (&st->common_attributes); }static const struct platform_device_id hid_hinge_ids[] = {
Signature · 1 line
2.34.1
PATCH 10/10 iio: accel: adapt to hid_sensor_remove_trigger() API change
In reply to Sanjay ChitrodaFrom: Sanjay Chitroda <[email protected]>
Update the driver to match the updated hid_sensor_remove_trigger() prototype, which no longer requires struct iio_dev.
--- drivers/iio/accel/hid-sensor-accel-3d.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/accel/hid-sensor-accel-3d.c +2 -2
@@ -416,7 +416,7 @@ static int hid_accel_3d_probe(struct platform_device *pdev) error_iio_unreg:iio_device_unregister (indio_dev); error_remove_trigger: -hid_sensor_remove_trigger (indio_dev, &accel_state->common_attributes); +hid_sensor_remove_trigger (&accel_state->common_attributes);return ret; }
@@ -429,7 +429,7 @@ static void hid_accel_3d_remove(struct platform_device *pdev)sensor_hub_remove_callback (hsdev, hsdev->usage);iio_device_unregister (indio_dev); -hid_sensor_remove_trigger (indio_dev, &accel_state->common_attributes); +hid_sensor_remove_trigger (&accel_state->common_attributes); }static const struct platform_device_id hid_accel_3d_ids[] = {
Signature · 1 line
2.34.1
Re: [PATCH 02/10] iio: orientation: adapt to hid_sensor_remove_trigger() API change
In reply to Sanjay ChitrodaQuoted 2 lines · Sanjay Chitroda
Update the driver to match the updated
hid_sensor_remove_trigger()prototype, which no longer requires structiio_dev.
You haven't compiled the previous patch, right?
This is not the way how all this should be done.
Also NAK to the patch 1 as even unused parameter is there for the sake of consistency. The prototype to allocate and other in the similar group all have it.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 02/10] iio: orientation: adapt to hid_sensor_remove_trigger() API change
Quoted 11 lines · Andy Shevchenko
Quoted 2 lines · Sanjay Chitroda
Update the driver to match the updated
hid_sensor_remove_trigger()prototype, which no longer requires structiio_dev.You haven't compiled the previous patch, right?
This is not the way how all this should be done.Also NAK to the patch 1 as even unused parameter is there for the sake of consistency. The prototype to allocate and other in the similar group all have it.
Hi Andy,
Thank for the review comment.
I agree your point for consistency.
However primary object of this pre-series is to prepare the drivers for devm_ conversation.
I would prepare devm_ wrapper for the hid_sensor_setup_trigger() and respective resource release hid_sensor_remove_trigger().
... devm_hid_sensor_setup_trigger( ... )
{
...
.. hid_sensor_setup_trigger();
....
devm_add_action_or_release(dev, hid_sensor_remove_trigger, attrb)
......
}I observed that many HID IIO drivers are not covered fully with managed API.
This devm_* sensor setup trigger would use across multiple HID IIO sensors and will go step forward for managed API support.
Quoted 1 line
Jonathan Cameron
maintainerRe: [PATCH 02/10] iio: orientation: adapt to hid_sensor_remove_trigger() API change
In reply to a message not in the archiveQuoted 31 lines · On Tue, 28 Apr 2026 16:32:02 +0530 Sanjay Chitroda…
Quoted 5 lines · Andy Shevchenko
Quoted 2 lines · Sanjay Chitroda
Update the driver to match the updated
hid_sensor_remove_trigger()prototype, which no longer requires structiio_dev.Quoted 7 lines
You haven't compiled the previous patch, right?
This is not the way how all this should be done.Also NAK to the patch 1 as even unused parameter is there for the sake of consistency. The prototype to allocate and other in the similar group all have it.
Hi Andy,
Thank for the review comment.
I agree your point for consistency.However primary object of this pre-series is to prepare the drivers for
devm_conversation.I would prepare
devm_wrapper for thehid_sensor_setup_trigger()and respective resource releasehid_sensor_remove_trigger().... devm_hid_sensor_setup_trigger( ... )
{ ... .. hid_sensor_setup_trigger(); .... devm_add_action_or_release(dev, hid_sensor_remove_trigger, attrb) ...... }
Quoted 4 lines
I observed that many HID IIO drivers are not covered fully with managed API.
This devm_* sensor setup trigger would use across multiple HID IIO sensors and will go step forward for managed API support.
Show us what that looks like with this series squashed into a single patch as a percursor. It might be worth doing as part of that larger work - on its own it's not justified.
A series must be applicable 1 patch at a time without breaking anything.
Jonathan