Skip to contentSkip to conversation

HID: iio: basic clean up and introduce devm_ API for HID sensors

PATCH In review Sanjay Chitroda 4 participants 14 messages May 24 – Jun 3

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 cover HID: iio: basic clean up and introduce devm_ API for HID sensors

From: Sanjay Chitroda <[email protected]>

Key highlights:
- 0000-0024: General cleanup and kernel few coding style fixes across HID IIO drivers
- 0025: Remove unused iio_dev argument from HID IIO sensor helper
- 0026: Introduce devm_hid_sensor_setup_trigger() device-managed API
- 0027-0036: Convert HID IIO sensor drivers to use the new devm-based trigger setup

changes in v4:
- Extend the series to cover remaining HID IIO drivers with devm API usage
- Reorder patches to place cleanup and warning fix at beginning and, devm-related changes toward the end based on feedback from David
- v3 series -> https://lore.kernel.org/all/[email protected]/
changes in v3:
- Added cleanup and prepratory changes before adding devm_ API
conversion based on self review: 0002, 0004, 0006, 0007 and 0008
- Address andy's review comment on commit message and coding style
- v2 series -> https://lore.kernel.org/all/[email protected]/
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/[email protected]/

Testing:
- Compiled with W=1 for each patch in series
- Build-tested on QEMU x86_64

P.S.
- Sashiko reported an issue in a different driver and noted that it is not introduced by this series. I have taken this feedback into account and will address the actual issue in a separate series focus on that driver.
- Once this series is merged into the IIO tree, a number of HID IIO drivers will become available to fully converted to devm API usage.
- The changes are organized across drivers to keep similar modifications grouped together for consistency, making the series easier to review, rather than grouping all changes per driver.

Thanks,
Sanjay Chitroda

Sanjay Chitroda (36):
iio: hid-sensors: add missing blank line after declarations
iio: gyro: hid-sensor-gyro-3d: use u32 instead of unsigned
iio: accel: hid-sensor-accel-3d: use u32 instead of unsigned
iio: light: hid-sensor-als: use u32 instead of unsigned
iio: light: hid-sensor-prox: use u32 instead of unsigned
iio: orientation: hid-sensor-incl-3d: use u32 instead of unsigned
iio: orientation: hid-sensor-rotation: use u32 instead of unsigned
iio: pressure: hid-sensor-press: use u32 instead of unsigned
iio: humidity: hid-sensor-humidity: align parenthesis for readability
iio: gyro: hid-sensor-gyro-3d: align parenthesis for readability
iio: magnetometer: hid-sensor-magn-3d: align parenthesis for
readability
iio: humidity: hid-sensor-humidity: use common device for devres
iio: position: hid-sensor-custom-intel-hinge: use common device for
devres
iio: temperature: hid-sensor-temperature: use common device for devres
iio: humidity: hid-sensor-humidity: use local struct device
iio: gyro: hid-sensor-gyro-3d: use local struct device
iio: accel: hid-sensor-accel-3d: use local struct device
iio: light: hid-sensor-als: use local struct device
iio: light: hid-sensor-prox: use local struct device
iio: magnetometer: hid-sensor-magn-3d: use local struct device
iio: orientation: hid-sensor-incl-3d: use local struct device
iio: orientation: hid-sensor-rotation: use local struct device
iio: position: hid-sensor-custom-intel-hinge: use local struct device
iio: pressure: hid-sensor-press: use local struct device
iio: hid-sensors: remove unused iio_dev argument
iio: hid-sensors: introduce device managed API
iio: gyro: hid-sensor-gyro-3d: drop hid_sensor_remove_trigger() using
devm API
iio: humidity: hid-sensor-humidity: drop hid_sensor_remove_trigger()
using devm API
iio: light: hid-sensor-prox: drop hid_sensor_remove_trigger() using
devm API
iio: light: hid-sensor-als: drop hid_sensor_remove_trigger() using
devm API
iio: magnetometer: hid-sensor-magn-3d: drop
hid_sensor_remove_trigger() using devm API
iio: orientation: hid-sensor-incl-3d: drop hid_sensor_remove_trigger()
using devm API
iio: orientation: hid-sensor-rotation: drop
hid_sensor_remove_trigger() using devm API
iio: position: hid-sensor-custom-intel-hinge: drop
hid_sensor_remove_trigger() using devm API
iio: pressure: hid-sensor-press: drop hid_sensor_remove_trigger()
using devm API
iio: temperature: hid-sensor-temperature: drop
hid_sensor_remove_trigger() using devm API

 drivers/iio/accel/hid-sensor-accel-3d.c       |  30 ++---
 .../common/hid-sensors/hid-sensor-trigger.c   |  24 +++-
 .../common/hid-sensors/hid-sensor-trigger.h   |   5 +-
 drivers/iio/gyro/hid-sensor-gyro-3d.c         |  96 ++++++++-------
 drivers/iio/humidity/hid-sensor-humidity.c    |  61 +++++-----
 drivers/iio/light/hid-sensor-als.c            |  31 +++--
 drivers/iio/light/hid-sensor-prox.c           |  30 ++---
 drivers/iio/magnetometer/hid-sensor-magn-3d.c | 112 +++++++++---------
 drivers/iio/orientation/hid-sensor-incl-3d.c  |  36 +++---
 drivers/iio/orientation/hid-sensor-rotation.c |  38 +++---
 .../position/hid-sensor-custom-intel-hinge.c  |  27 ++---
 drivers/iio/pressure/hid-sensor-press.c       |  36 +++---
 .../iio/temperature/hid-sensor-temperature.c  |  15 +--
 13 files changed, 264 insertions(+), 277 deletions(-)

base-commit: 08297ca8422541dde6c8b7e6b1d68bd4aa4568ef

Signature · 1 line
2.34.1
#1 lore raw

PATCH v4 1/36 iio: hid-sensors: add missing blank line after declarations

From: Sanjay Chitroda <[email protected]>

Add a blank line after variable declarations to improve readability and align with kernel coding style.

---
Changes in v4:
- Rectify commit message with input from David

---
 drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/iio/common/hid-sensors/hid-sensor-trigger.c +3 -0
index 417c4ab8c1b2..c8ccf96f3d03 100644
@@ -314,7 +314,9 @@ static int __maybe_unused hid_sensor_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct hid_sensor_common *attrb = iio_device_get_drvdata(indio_dev);
+
 	schedule_work(&attrb->work);
+
 	return 0;
 }
 
@@ -322,6 +324,7 @@ static int __maybe_unused hid_sensor_runtime_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct hid_sensor_common *attrb = iio_device_get_drvdata(indio_dev);
+
 	return _hid_sensor_power_state(attrb, true);
 }
 
Signature · 1 line
2.34.1
#2 lore raw

PATCH v4 2/36 iio: gyro: hid-sensor-gyro-3d: use u32 instead of unsigned

In reply to Sanjay Chitroda

From: Sanjay Chitroda <[email protected]>

Prefer 'u32' instead of bare 'unsigned' variable to improve code clarity and consistency with kernel style.

---
Changes in v4:
- Use 'u32' instead of 'unsigned int' as driver is already uses that and respective prototype has same data type with input from David and Andy
- Link to v3 -> https://lore.kernel.org/all/[email protected]/

---
 drivers/iio/gyro/hid-sensor-gyro-3d.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/gyro/hid-sensor-gyro-3d.c +3 -3
index c340cc899a7c..020812639947 100644
@@ -187,7 +187,7 @@ static const struct iio_info gyro_3d_info = {
 
 /* Callback handler to send event after all samples are received and captured */
 static int gyro_3d_proc_event(struct hid_sensor_hub_device *hsdev,
-				unsigned usage_id,
+				u32 usage_id,
 				void *priv)
 {
 	struct iio_dev *indio_dev = platform_get_drvdata(priv);
@@ -209,7 +209,7 @@ static int gyro_3d_proc_event(struct hid_sensor_hub_device *hsdev,
 
 /* Capture samples in local storage */
 static int gyro_3d_capture_sample(struct hid_sensor_hub_device *hsdev,
-				unsigned usage_id,
+				u32 usage_id,
 				size_t raw_len, char *raw_data,
 				void *priv)
 {
@@ -244,7 +244,7 @@ static int gyro_3d_capture_sample(struct hid_sensor_hub_device *hsdev,
 static int gyro_3d_parse_report(struct platform_device *pdev,
 				struct hid_sensor_hub_device *hsdev,
 				struct iio_chan_spec *channels,
-				unsigned usage_id,
+				u32 usage_id,
 				struct gyro_3d_state *st)
 {
 	int ret;
Signature · 1 line
2.34.1
maintainer
#3 lore raw

Re: [PATCH v4 02/36] iio: gyro: hid-sensor-gyro-3d: use u32 instead of unsigned

Quoted 4 lines · On Mon, 25 May 2026 00:50:25 +0530 Sanjay Chitroda…

From: Sanjay Chitroda <[email protected]>

Prefer 'u32' instead of bare 'unsigned' variable to improve code clarity and consistency with kernel style.

I think it is relevant that the definition of the callbacks is:

struct hid_sensor_hub_callbacks {
...

int (*capture_sample)(struct hid_sensor_hub_device *hsdev,
u32 usage_id, size_t raw_len, char *raw_data, void *priv);
int (*send_event)(struct hid_sensor_hub_device *hsdev, u32 usage_id,
void *priv);
};

So in all cases we have a u32. Same applies to other calls the usage_id is passed to.

Quoted 41 lines

---
Changes in v4:
- Use 'u32' instead of 'unsigned int' as driver is already uses that and respective prototype has same data type with input from David and Andy
- Link to v3 -> https://lore.kernel.org/all/[email protected]/

---
 drivers/iio/gyro/hid-sensor-gyro-3d.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/gyro/hid-sensor-gyro-3d.c +3 -3
index c340cc899a7c..020812639947 100644
@@ -187,7 +187,7 @@ static const struct iio_info gyro_3d_info = {
 
 /* Callback handler to send event after all samples are received and captured */
 static int gyro_3d_proc_event(struct hid_sensor_hub_device *hsdev,
-				unsigned usage_id,
+				u32 usage_id,
 				void *priv)
 {
 	struct iio_dev *indio_dev = platform_get_drvdata(priv);
@@ -209,7 +209,7 @@ static int gyro_3d_proc_event(struct hid_sensor_hub_device *hsdev,
 
 /* Capture samples in local storage */
 static int gyro_3d_capture_sample(struct hid_sensor_hub_device *hsdev,
-				unsigned usage_id,
+				u32 usage_id,
 				size_t raw_len, char *raw_data,
 				void *priv)
 {
@@ -244,7 +244,7 @@ static int gyro_3d_capture_sample(struct hid_sensor_hub_device *hsdev,
 static int gyro_3d_parse_report(struct platform_device *pdev,
 				struct hid_sensor_hub_device *hsdev,
 				struct iio_chan_spec *channels,
-				unsigned usage_id,
+				u32 usage_id,
 				struct gyro_3d_state *st)
 {
 	int ret;
#4 lore raw

PATCH v4 3/36 iio: accel: hid-sensor-accel-3d: use u32 instead of unsigned

In reply to Sanjay Chitroda

From: Sanjay Chitroda <[email protected]>

Prefer 'u32' instead of bare 'unsigned' variable to improve code clarity and consistency with kernel style.

---
 drivers/iio/accel/hid-sensor-accel-3d.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/accel/hid-sensor-accel-3d.c +3 -3
index 2ff591b3458f..67fb8efd6b10 100644
@@ -233,7 +233,7 @@ static void hid_sensor_push_data(struct iio_dev *indio_dev, void *data,
 
 /* Callback handler to send event after all samples are received and captured */
 static int accel_3d_proc_event(struct hid_sensor_hub_device *hsdev,
-				unsigned usage_id,
+				u32 usage_id,
 				void *priv)
 {
 	struct iio_dev *indio_dev = platform_get_drvdata(priv);
@@ -257,7 +257,7 @@ static int accel_3d_proc_event(struct hid_sensor_hub_device *hsdev,
 
 /* Capture samples in local storage */
 static int accel_3d_capture_sample(struct hid_sensor_hub_device *hsdev,
-				unsigned usage_id,
+				u32 usage_id,
 				size_t raw_len, char *raw_data,
 				void *priv)
 {
@@ -293,7 +293,7 @@ static int accel_3d_capture_sample(struct hid_sensor_hub_device *hsdev,
 static int accel_3d_parse_report(struct platform_device *pdev,
 				struct hid_sensor_hub_device *hsdev,
 				struct iio_chan_spec *channels,
-				unsigned usage_id,
+				u32 usage_id,
 				struct accel_3d_state *st)
 {
 	int ret;
Signature · 1 line
2.34.1
#5 lore raw

PATCH v4 4/36 iio: light: hid-sensor-als: use u32 instead of unsigned

In reply to Sanjay Chitroda

From: Sanjay Chitroda <[email protected]>

Prefer 'u32' instead of bare 'unsigned' variable to improve code clarity and consistency with kernel style.

---
 drivers/iio/light/hid-sensor-als.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/light/hid-sensor-als.c +3 -3
index 384572844162..ac654b2bbc1b 100644
@@ -251,7 +251,7 @@ static const struct iio_info als_info = {
 
 /* Callback handler to send event after all samples are received and captured */
 static int als_proc_event(struct hid_sensor_hub_device *hsdev,
-				unsigned usage_id,
+				u32 usage_id,
 				void *priv)
 {
 	struct iio_dev *indio_dev = platform_get_drvdata(priv);
@@ -273,7 +273,7 @@ static int als_proc_event(struct hid_sensor_hub_device *hsdev,
 
 /* Capture samples in local storage */
 static int als_capture_sample(struct hid_sensor_hub_device *hsdev,
-				unsigned usage_id,
+				u32 usage_id,
 				size_t raw_len, char *raw_data,
 				void *priv)
 {
@@ -315,7 +315,7 @@ static int als_capture_sample(struct hid_sensor_hub_device *hsdev,
 /* Parse report which is specific to an usage id*/
 static int als_parse_report(struct platform_device *pdev,
 				struct hid_sensor_hub_device *hsdev,
-				unsigned usage_id,
+				u32 usage_id,
 				struct als_state *st)
 {
 	struct iio_chan_spec *channels;
Signature · 1 line
2.34.1
#6 lore raw

PATCH v4 5/36 iio: light: hid-sensor-prox: use u32 instead of unsigned

In reply to Sanjay Chitroda

From: Sanjay Chitroda <[email protected]>

Prefer 'u32' instead of bare 'unsigned' variable to improve code clarity and consistency with kernel style.

---
 drivers/iio/light/hid-sensor-prox.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/light/hid-sensor-prox.c +2 -2
index efa904a70d0e..ac55808f161b 100644
@@ -176,7 +176,7 @@ static const struct iio_info prox_info = {
 
 /* Callback handler to send event after all samples are received and captured */
 static int prox_proc_event(struct hid_sensor_hub_device *hsdev,
-				unsigned usage_id,
+				u32 usage_id,
 				void *priv)
 {
 	struct iio_dev *indio_dev = platform_get_drvdata(priv);
@@ -193,7 +193,7 @@ static int prox_proc_event(struct hid_sensor_hub_device *hsdev,
 
 /* Capture samples in local storage */
 static int prox_capture_sample(struct hid_sensor_hub_device *hsdev,
-				unsigned usage_id,
+				u32 usage_id,
 				size_t raw_len, char *raw_data,
 				void *priv)
 {
Signature · 1 line
2.34.1
#7 lore raw

PATCH v4 6/36 iio: orientation: hid-sensor-incl-3d: use u32 instead of unsigned

In reply to Sanjay Chitroda

From: Sanjay Chitroda <[email protected]>

Prefer 'u32' instead of bare 'unsigned' variable to improve code clarity and consistency with kernel style.

---
 drivers/iio/orientation/hid-sensor-incl-3d.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/orientation/hid-sensor-incl-3d.c +3 -3
index 4e23a598a3fb..c7fbff498be7 100644
@@ -189,7 +189,7 @@ static const struct iio_info incl_3d_info = {
 
 /* Callback handler to send event after all samples are received and captured */
 static int incl_3d_proc_event(struct hid_sensor_hub_device *hsdev,
-				unsigned usage_id,
+				u32 usage_id,
 				void *priv)
 {
 	struct iio_dev *indio_dev = platform_get_drvdata(priv);
@@ -212,7 +212,7 @@ static int incl_3d_proc_event(struct hid_sensor_hub_device *hsdev,
 
 /* Capture samples in local storage */
 static int incl_3d_capture_sample(struct hid_sensor_hub_device *hsdev,
-				unsigned usage_id,
+				u32 usage_id,
 				size_t raw_len, char *raw_data,
 				void *priv)
 {
@@ -247,7 +247,7 @@ static int incl_3d_capture_sample(struct hid_sensor_hub_device *hsdev,
 static int incl_3d_parse_report(struct platform_device *pdev,
 				struct hid_sensor_hub_device *hsdev,
 				struct iio_chan_spec *channels,
-				unsigned usage_id,
+				u32 usage_id,
 				struct incl_3d_state *st)
 {
 	int ret;
Signature · 1 line
2.34.1
#8 lore raw

PATCH v4 7/36 iio: orientation: hid-sensor-rotation: use u32 instead of unsigned

In reply to Sanjay Chitroda

From: Sanjay Chitroda <[email protected]>

Prefer 'u32' instead of bare 'unsigned' variable to improve code clarity and consistency with kernel style.

---
 drivers/iio/orientation/hid-sensor-rotation.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/orientation/hid-sensor-rotation.c +3 -3
index 4a11e4555099..20563d8efaf6 100644
@@ -176,7 +176,7 @@ static const struct iio_info dev_rot_info = {
 
 /* Callback handler to send event after all samples are received and captured */
 static int dev_rot_proc_event(struct hid_sensor_hub_device *hsdev,
-				unsigned usage_id,
+				u32 usage_id,
 				void *priv)
 {
 	struct iio_dev *indio_dev = platform_get_drvdata(priv);
@@ -209,7 +209,7 @@ static int dev_rot_proc_event(struct hid_sensor_hub_device *hsdev,
 
 /* Capture samples in local storage */
 static int dev_rot_capture_sample(struct hid_sensor_hub_device *hsdev,
-				unsigned usage_id,
+				u32 usage_id,
 				size_t raw_len, char *raw_data,
 				void *priv)
 {
@@ -240,7 +240,7 @@ static int dev_rot_capture_sample(struct hid_sensor_hub_device *hsdev,
 /* Parse report which is specific to an usage id*/
 static int dev_rot_parse_report(struct platform_device *pdev,
 				struct hid_sensor_hub_device *hsdev,
-				unsigned usage_id,
+				u32 usage_id,
 				struct dev_rot_state *st)
 {
 	int ret;
Signature · 1 line
2.34.1
#9 lore raw

PATCH v4 8/36 iio: pressure: hid-sensor-press: use u32 instead of unsigned

In reply to Sanjay Chitroda

From: Sanjay Chitroda <[email protected]>

Prefer 'u32' instead of bare 'unsigned' variable to improve code clarity and consistency with kernel style.

---
 drivers/iio/pressure/hid-sensor-press.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/pressure/hid-sensor-press.c +3 -3
index 5f1d6abda3e4..a5db5220d3d5 100644
@@ -165,7 +165,7 @@ static const struct iio_info press_info = {
 
 /* Callback handler to send event after all samples are received and captured */
 static int press_proc_event(struct hid_sensor_hub_device *hsdev,
-				unsigned usage_id,
+				u32 usage_id,
 				void *priv)
 {
 	struct iio_dev *indio_dev = platform_get_drvdata(priv);
@@ -186,7 +186,7 @@ static int press_proc_event(struct hid_sensor_hub_device *hsdev,
 
 /* Capture samples in local storage */
 static int press_capture_sample(struct hid_sensor_hub_device *hsdev,
-				unsigned usage_id,
+				u32 usage_id,
 				size_t raw_len, char *raw_data,
 				void *priv)
 {
@@ -214,7 +214,7 @@ static int press_capture_sample(struct hid_sensor_hub_device *hsdev,
 static int press_parse_report(struct platform_device *pdev,
 				struct hid_sensor_hub_device *hsdev,
 				struct iio_chan_spec *channels,
-				unsigned usage_id,
+				u32 usage_id,
 				struct press_state *st)
 {
 	int ret;
Signature · 1 line
2.34.1
#10 lore raw

PATCH v4 9/36 iio: humidity: hid-sensor-humidity: align parenthesis for readability

In reply to Sanjay Chitroda

From: Sanjay Chitroda <[email protected]>

Adjust alignment of parentheses to improve readability and maintain consistency with kernel coding style

---
 drivers/iio/humidity/hid-sensor-humidity.c | 46 +++++++++++-----------
 1 file changed, 23 insertions(+), 23 deletions(-)
drivers/iio/humidity/hid-sensor-humidity.c +23 -23
index be2338d5f407..6fed019f4099 100644
@@ -45,7 +45,7 @@ static const struct iio_chan_spec humidity_channels[] = {
 
 /* Adjust channel real bits based on report descriptor */
 static void humidity_adjust_channel_bit_mask(struct iio_chan_spec *channels,
-					int channel, int size)
+					     int channel, int size)
 {
 	channels[channel].scan_type.sign = 's';
 	/* Real storage bits will change based on the report desc. */
@@ -55,8 +55,8 @@ static void humidity_adjust_channel_bit_mask(struct iio_chan_spec *channels,
 }
 
 static int humidity_read_raw(struct iio_dev *indio_dev,
-				struct iio_chan_spec const *chan,
-				int *val, int *val2, long mask)
+			     struct iio_chan_spec const *chan,
+			     int *val, int *val2, long mask)
 {
 	struct hid_humidity_state *humid_st = iio_priv(indio_dev);
 
@@ -101,8 +101,8 @@ static int humidity_read_raw(struct iio_dev *indio_dev,
 }
 
 static int humidity_write_raw(struct iio_dev *indio_dev,
-				struct iio_chan_spec const *chan,
-				int val, int val2, long mask)
+			      struct iio_chan_spec const *chan,
+			      int val, int val2, long mask)
 {
 	struct hid_humidity_state *humid_st = iio_priv(indio_dev);
 
@@ -127,7 +127,7 @@ static const struct iio_info humidity_info = {
 
 /* Callback handler to send event after all samples are received and captured */
 static int humidity_proc_event(struct hid_sensor_hub_device *hsdev,
-				unsigned int usage_id, void *pdev)
+			       unsigned int usage_id, void *pdev)
 {
 	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
 	struct hid_humidity_state *humid_st = iio_priv(indio_dev);
@@ -141,8 +141,8 @@ static int humidity_proc_event(struct hid_sensor_hub_device *hsdev,
 
 /* Capture samples in local storage */
 static int humidity_capture_sample(struct hid_sensor_hub_device *hsdev,
-				unsigned int usage_id, size_t raw_len,
-				char *raw_data, void *pdev)
+				   unsigned int usage_id, size_t raw_len,
+				   char *raw_data, void *pdev)
 {
 	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
 	struct hid_humidity_state *humid_st = iio_priv(indio_dev);
@@ -159,17 +159,17 @@ static int humidity_capture_sample(struct hid_sensor_hub_device *hsdev,
 
 /* Parse report which is specific to an usage id */
 static int humidity_parse_report(struct platform_device *pdev,
-				struct hid_sensor_hub_device *hsdev,
-				struct iio_chan_spec *channels,
-				unsigned int usage_id,
-				struct hid_humidity_state *st)
+				 struct hid_sensor_hub_device *hsdev,
+				 struct iio_chan_spec *channels,
+				 unsigned int usage_id,
+				 struct hid_humidity_state *st)
 {
 	int ret;
 
 	ret = sensor_hub_input_get_attribute_info(hsdev, HID_INPUT_REPORT,
-					usage_id,
-					HID_USAGE_SENSOR_ATMOSPHERIC_HUMIDITY,
-					&st->humidity_attr);
+						  usage_id,
+						  HID_USAGE_SENSOR_ATMOSPHERIC_HUMIDITY,
+						  &st->humidity_attr);
 	if (ret < 0)
 		return ret;
 
@@ -208,20 +208,20 @@ static int hid_humidity_probe(struct platform_device *pdev)
 	humid_st->common_attributes.pdev = pdev;
 
 	ret = hid_sensor_parse_common_attributes(hsdev,
-					HID_USAGE_SENSOR_HUMIDITY,
-					&humid_st->common_attributes,
-					humidity_sensitivity_addresses,
-					ARRAY_SIZE(humidity_sensitivity_addresses));
+						 HID_USAGE_SENSOR_HUMIDITY,
+						 &humid_st->common_attributes,
+						 humidity_sensitivity_addresses,
+						 ARRAY_SIZE(humidity_sensitivity_addresses));
 	if (ret)
 		return ret;
 
 	humid_chans = devm_kmemdup(&indio_dev->dev, humidity_channels,
-					sizeof(humidity_channels), GFP_KERNEL);
+				   sizeof(humidity_channels), GFP_KERNEL);
 	if (!humid_chans)
 		return -ENOMEM;
 
 	ret = humidity_parse_report(pdev, hsdev, humid_chans,
-				HID_USAGE_SENSOR_HUMIDITY, humid_st);
+				    HID_USAGE_SENSOR_HUMIDITY, humid_st);
 	if (ret)
 		return ret;
 
@@ -234,7 +234,7 @@ static int hid_humidity_probe(struct platform_device *pdev)
 	atomic_set(&humid_st->common_attributes.data_ready, 0);
 
 	ret = hid_sensor_setup_trigger(indio_dev, name,
-				&humid_st->common_attributes);
+				       &humid_st->common_attributes);
 	if (ret)
 		return ret;
 
@@ -242,7 +242,7 @@ static int hid_humidity_probe(struct platform_device *pdev)
 
 	humidity_callbacks.pdev = pdev;
 	ret = sensor_hub_register_callback(hsdev, HID_USAGE_SENSOR_HUMIDITY,
-					&humidity_callbacks);
+					   &humidity_callbacks);
 	if (ret)
 		goto error_remove_trigger;
 
Signature · 1 line
2.34.1
maintainer
#11 lore raw
In reply to Sanjay Chitroda
Quoted 28 lines · On Mon, 25 May 2026 00:50:23 +0530 Sanjay Chitroda…

From: Sanjay Chitroda <[email protected]>

Key highlights:
- 0000-0024: General cleanup and kernel few coding style fixes across HID IIO drivers
- 0025: Remove unused iio_dev argument from HID IIO sensor helper
- 0026: Introduce devm_hid_sensor_setup_trigger() device-managed API
- 0027-0036: Convert HID IIO sensor drivers to use the new devm-based trigger setup

changes in v4:
- Extend the series to cover remaining HID IIO drivers with devm API usage
- Reorder patches to place cleanup and warning fix at beginning and, devm-related changes toward the end based on feedback from David
- v3 series -> https://lore.kernel.org/all/[email protected]/
changes in v3:
- Added cleanup and prepratory changes before adding devm_ API
conversion based on self review: 0002, 0004, 0006, 0007 and 0008
- Address andy's review comment on commit message and coding style
- v2 series -> https://lore.kernel.org/all/[email protected]/
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/[email protected]/

Testing:
- Compiled with W=1 for each patch in series
- Build-tested on QEMU x86_64

Quoted 10 lines

P.S.
- Sashiko reported an issue in a different driver and noted that it is not introduced by this series. I have taken this feedback into account and will address the actual issue in a separate series focus on that driver.
- Once this series is merged into the IIO tree, a number of HID IIO drivers will become available to fully converted to devm API usage.
- The changes are organized across drivers to keep similar modifications grouped together for consistency, making the series easier to review, rather than grouping all changes per driver.

The series is mostly fine, though not sure what happened with how you sent it as I have it in seperate threads of 10 patches at a time. If you are having email troubles with big series, use b4 to send them instead (instructions on kernel.org)

My main concern is this is a lot of churn on a critical driver. I'd like therefore to be able to see the full benefit of those devm patches rather than get us part way as this does.

Jonathan

Quoted 70 lines

Thanks,
Sanjay Chitroda

Sanjay Chitroda (36):
iio: hid-sensors: add missing blank line after declarations
iio: gyro: hid-sensor-gyro-3d: use u32 instead of unsigned
iio: accel: hid-sensor-accel-3d: use u32 instead of unsigned
iio: light: hid-sensor-als: use u32 instead of unsigned
iio: light: hid-sensor-prox: use u32 instead of unsigned
iio: orientation: hid-sensor-incl-3d: use u32 instead of unsigned
iio: orientation: hid-sensor-rotation: use u32 instead of unsigned
iio: pressure: hid-sensor-press: use u32 instead of unsigned
iio: humidity: hid-sensor-humidity: align parenthesis for readability
iio: gyro: hid-sensor-gyro-3d: align parenthesis for readability
iio: magnetometer: hid-sensor-magn-3d: align parenthesis for
readability
iio: humidity: hid-sensor-humidity: use common device for devres
iio: position: hid-sensor-custom-intel-hinge: use common device for
devres
iio: temperature: hid-sensor-temperature: use common device for devres
iio: humidity: hid-sensor-humidity: use local struct device
iio: gyro: hid-sensor-gyro-3d: use local struct device
iio: accel: hid-sensor-accel-3d: use local struct device
iio: light: hid-sensor-als: use local struct device
iio: light: hid-sensor-prox: use local struct device
iio: magnetometer: hid-sensor-magn-3d: use local struct device
iio: orientation: hid-sensor-incl-3d: use local struct device
iio: orientation: hid-sensor-rotation: use local struct device
iio: position: hid-sensor-custom-intel-hinge: use local struct device
iio: pressure: hid-sensor-press: use local struct device
iio: hid-sensors: remove unused iio_dev argument
iio: hid-sensors: introduce device managed API
iio: gyro: hid-sensor-gyro-3d: drop hid_sensor_remove_trigger() using
devm API
iio: humidity: hid-sensor-humidity: drop hid_sensor_remove_trigger()
using devm API
iio: light: hid-sensor-prox: drop hid_sensor_remove_trigger() using
devm API
iio: light: hid-sensor-als: drop hid_sensor_remove_trigger() using
devm API
iio: magnetometer: hid-sensor-magn-3d: drop
hid_sensor_remove_trigger() using devm API
iio: orientation: hid-sensor-incl-3d: drop hid_sensor_remove_trigger()
using devm API
iio: orientation: hid-sensor-rotation: drop
hid_sensor_remove_trigger() using devm API
iio: position: hid-sensor-custom-intel-hinge: drop
hid_sensor_remove_trigger() using devm API
iio: pressure: hid-sensor-press: drop hid_sensor_remove_trigger()
using devm API
iio: temperature: hid-sensor-temperature: drop
hid_sensor_remove_trigger() using devm API

 drivers/iio/accel/hid-sensor-accel-3d.c       |  30 ++---
 .../common/hid-sensors/hid-sensor-trigger.c   |  24 +++-
 .../common/hid-sensors/hid-sensor-trigger.h   |   5 +-
 drivers/iio/gyro/hid-sensor-gyro-3d.c         |  96 ++++++++-------
 drivers/iio/humidity/hid-sensor-humidity.c    |  61 +++++-----
 drivers/iio/light/hid-sensor-als.c            |  31 +++--
 drivers/iio/light/hid-sensor-prox.c           |  30 ++---
 drivers/iio/magnetometer/hid-sensor-magn-3d.c | 112 +++++++++---------
 drivers/iio/orientation/hid-sensor-incl-3d.c  |  36 +++---
 drivers/iio/orientation/hid-sensor-rotation.c |  38 +++---
 .../position/hid-sensor-custom-intel-hinge.c  |  27 ++---
 drivers/iio/pressure/hid-sensor-press.c       |  36 +++---
 .../iio/temperature/hid-sensor-temperature.c  |  15 +--
 13 files changed, 264 insertions(+), 277 deletions(-)

base-commit: 08297ca8422541dde6c8b7e6b1d68bd4aa4568ef

#12 lore raw
Quoted 63 lines · Jonathan Cameron
Quoted 37 lines · On Mon, 25 May 2026 00:50:23 +0530 Sanjay Chitroda…

From: Sanjay Chitroda <[email protected]>

Key highlights:
- 0000-0024: General cleanup and kernel few coding style fixes across HID IIO drivers
- 0025: Remove unused iio_dev argument from HID IIO sensor helper
- 0026: Introduce devm_hid_sensor_setup_trigger() device-managed API
- 0027-0036: Convert HID IIO sensor drivers to use the new devm- based trigger setup

changes in v4:
- Extend the series to cover remaining HID IIO drivers with devm API usage
- Reorder patches to place cleanup and warning fix at beginning and,
  devm-related changes toward the end based on feedback from David
- v3 series ->
https://lore.kernel.org/all/[email protected]/
changes in v3:
- Added cleanup and prepratory changes before adding devm_ API conversion based on self review: 0002, 0004, 0006, 0007 and 0008
- Address andy's review comment on commit message and coding style
- v2 series ->
https://lore.kernel.org/all/[email protected]/
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/[email protected]/

Testing:
  - Compiled with W=1 for each patch in series
  - Build-tested on QEMU x86_64

Quoted 16 lines

P.S.
- Sashiko reported an issue in a different driver and noted that it is not
  introduced by this series. I have taken this feedback into account and
  will address the actual issue in a separate series focus on that driver.
- Once this series is merged into the IIO tree, a number of HID IIO drivers will become available to fully converted to devm API usage.
- The changes are organized across drivers to keep similar modifications
  grouped together for consistency, making the series easier to review,
  rather than grouping all changes per driver.

The series is mostly fine, though not sure what happened with how you sent
it as I have it in seperate threads of 10 patches at a time. If you are having
email troubles with big series, use b4 to send them instead (instructions on kernel.org)

Quoted 6 lines

My main concern is this is a lot of churn on a critical driver. I'd like therefore
to be able to see the full benefit of those devm patches rather than get us
part way as this does.

I am not able to apply this patchset cleanly on 7.1-rc6. This series does formatting changes, u32 changes and devm changes. Atleast three different series will be better.

Thanks,
Srinivas

Quoted 84 lines

Jonathan

Quoted 82 lines

Thanks,
Sanjay Chitroda

Sanjay Chitroda (36):
  iio: hid-sensors: add missing blank line after declarations
  iio: gyro: hid-sensor-gyro-3d: use u32 instead of unsigned
  iio: accel: hid-sensor-accel-3d: use u32 instead of unsigned
  iio: light: hid-sensor-als: use u32 instead of unsigned
  iio: light: hid-sensor-prox: use u32 instead of unsigned
  iio: orientation: hid-sensor-incl-3d: use u32 instead of unsigned
  iio: orientation: hid-sensor-rotation: use u32 instead of unsigned
  iio: pressure: hid-sensor-press: use u32 instead of unsigned
  iio: humidity: hid-sensor-humidity: align parenthesis for readability
  iio: gyro: hid-sensor-gyro-3d: align parenthesis for readability
  iio: magnetometer: hid-sensor-magn-3d: align parenthesis for readability
  iio: humidity: hid-sensor-humidity: use common device for devres
  iio: position: hid-sensor-custom-intel-hinge: use common device for
    devres
  iio: temperature: hid-sensor-temperature: use common device for devres
  iio: humidity: hid-sensor-humidity: use local struct device
  iio: gyro: hid-sensor-gyro-3d: use local struct device
  iio: accel: hid-sensor-accel-3d: use local struct device
  iio: light: hid-sensor-als: use local struct device
  iio: light: hid-sensor-prox: use local struct device
  iio: magnetometer: hid-sensor-magn-3d: use local struct device
  iio: orientation: hid-sensor-incl-3d: use local struct device
  iio: orientation: hid-sensor-rotation: use local struct device
  iio: position: hid-sensor-custom-intel-hinge: use local struct device
  iio: pressure: hid-sensor-press: use local struct device
  iio: hid-sensors: remove unused iio_dev argument
  iio: hid-sensors: introduce device managed API
  iio: gyro: hid-sensor-gyro-3d: drop hid_sensor_remove_trigger() using
    devm API
  iio: humidity: hid-sensor-humidity: drop hid_sensor_remove_trigger()
    using devm API
  iio: light: hid-sensor-prox: drop hid_sensor_remove_trigger() using
    devm API
  iio: light: hid-sensor-als: drop hid_sensor_remove_trigger() using
    devm API
  iio: magnetometer: hid-sensor-magn-3d: drop hid_sensor_remove_trigger() using devm API
  iio: orientation: hid-sensor-incl-3d: drop hid_sensor_remove_trigger()
    using devm API
  iio: orientation: hid-sensor-rotation: drop hid_sensor_remove_trigger() using devm API
  iio: position: hid-sensor-custom-intel-hinge: drop hid_sensor_remove_trigger() using devm API
  iio: pressure: hid-sensor-press: drop hid_sensor_remove_trigger() using devm API
  iio: temperature: hid-sensor-temperature: drop hid_sensor_remove_trigger() using devm API

 drivers/iio/accel/hid-sensor-accel-3d.c       |  30 ++--- .../common/hid-sensors/hid-sensor-trigger.c   |  24 +++- .../common/hid-sensors/hid-sensor-trigger.h   |   5 +- drivers/iio/gyro/hid-sensor-gyro-3d.c         |  96 ++++++++------ -
 drivers/iio/humidity/hid-sensor-humidity.c    |  61 +++++----- drivers/iio/light/hid-sensor-als.c            |  31 +++-- drivers/iio/light/hid-sensor-prox.c           |  30 ++--- drivers/iio/magnetometer/hid-sensor-magn-3d.c | 112 +++++++++-----
----
 drivers/iio/orientation/hid-sensor-incl-3d.c  |  36 +++--- drivers/iio/orientation/hid-sensor-rotation.c |  38 +++--- .../position/hid-sensor-custom-intel-hinge.c  |  27 ++--- drivers/iio/pressure/hid-sensor-press.c       |  36 +++--- .../iio/temperature/hid-sensor-temperature.c  |  15 +--

 13 files changed, 264 insertions(+), 277 deletions(-)

base-commit: 08297ca8422541dde6c8b7e6b1d68bd4aa4568ef

#13 lore raw
In reply to Jonathan Cameron
Quoted 39 lines · Jonathan Cameron
Quoted 26 lines · On Mon, 25 May 2026 00:50:23 +0530 Sanjay Chitroda…

Key highlights:
- 0000-0024: General cleanup and kernel few coding style fixes across HID IIO drivers
- 0025: Remove unused iio_dev argument from HID IIO sensor helper
- 0026: Introduce devm_hid_sensor_setup_trigger() device-managed API
- 0027-0036: Convert HID IIO sensor drivers to use the new devm-based trigger setup

changes in v4:
- Extend the series to cover remaining HID IIO drivers with devm API usage
- Reorder patches to place cleanup and warning fix at beginning and, devm-related changes toward the end based on feedback from David
- v3 series -> https://lore.kernel.org/all/[email protected]/
changes in v3:
- Added cleanup and prepratory changes before adding devm_ API
conversion based on self review: 0002, 0004, 0006, 0007 and 0008
- Address andy's review comment on commit message and coding style
- v2 series -> https://lore.kernel.org/all/[email protected]/
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/[email protected]/

Testing:
- Compiled with W=1 for each patch in series
- Build-tested on QEMU x86_64

Quoted 10 lines

P.S.
- Sashiko reported an issue in a different driver and noted that it is not introduced by this series. I have taken this feedback into account and will address the actual issue in a separate series focus on that driver.
- Once this series is merged into the IIO tree, a number of HID IIO drivers will become available to fully converted to devm API usage.
- The changes are organized across drivers to keep similar modifications grouped together for consistency, making the series easier to review, rather than grouping all changes per driver.

Quoted 3 lines

The series is mostly fine, though not sure what happened with how you sent it as I have it in seperate threads of 10 patches at a time. If you are having email troubles with big series, use b4 to send them instead (instructions on kernel.org)

I'm also confused. Fix your email and then come with better series chaining.

Quoted 3 lines

My main concern is this is a lot of churn on a critical driver. I'd like therefore to be able to see the full benefit of those devm patches rather than get us part way as this does.

Signature · 2 lines
With Best Regards,
Andy Shevchenko