The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 0/7] HID: iio: basic clean up for usage_id
@ 2026-06-06 12:17 Sanjay Chitroda
  2026-06-06 12:17 ` [PATCH 1/7] iio: gyro: hid-sensor-gyro-3d: use u32 instead of unsigned Sanjay Chitroda
                   ` (8 more replies)
  0 siblings, 9 replies; 17+ messages in thread
From: Sanjay Chitroda @ 2026-06-06 12:17 UTC (permalink / raw)
  To: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, David Lechner,
	Nuno Sá, Andy Shevchenko
  Cc: linux-input, linux-iio, linux-kernel, Sanjay Chitroda

Hi all,

This series updates all HID IIO drivers to use 'u32' instead of
bare 'unsigned' for the usage_id parameter.

This improves type clarity and ensures consistency with kernel
coding style, as HID usage IDs are defined as 32-bit values.

No functional changes are introduced.

Testing:
  - Compiled with W=1 for each patch in the series

---
Sanjay Chitroda (7):
      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

 drivers/iio/accel/hid-sensor-accel-3d.c       | 6 +++---
 drivers/iio/gyro/hid-sensor-gyro-3d.c         | 6 +++---
 drivers/iio/light/hid-sensor-als.c            | 6 +++---
 drivers/iio/light/hid-sensor-prox.c           | 4 ++--
 drivers/iio/orientation/hid-sensor-incl-3d.c  | 6 +++---
 drivers/iio/orientation/hid-sensor-rotation.c | 6 +++---
 drivers/iio/pressure/hid-sensor-press.c       | 6 +++---
 7 files changed, 20 insertions(+), 20 deletions(-)
---
base-commit: ae696dfa47c30016cd429b9db5e70b259b8f509e
change-id: 20260606-6-june-hid-iio-correct-usage-id-57ce92cb102b

Best regards,
--  
Sanjay Chitroda <sanjayembeddedse@gmail.com>


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 1/7] iio: gyro: hid-sensor-gyro-3d: use u32 instead of unsigned
  2026-06-06 12:17 [PATCH 0/7] HID: iio: basic clean up for usage_id Sanjay Chitroda
@ 2026-06-06 12:17 ` Sanjay Chitroda
  2026-06-08 13:58   ` Andy Shevchenko
  2026-06-06 12:17 ` [PATCH 2/7] iio: accel: hid-sensor-accel-3d: " Sanjay Chitroda
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 17+ messages in thread
From: Sanjay Chitroda @ 2026-06-06 12:17 UTC (permalink / raw)
  To: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, David Lechner,
	Nuno Sá, Andy Shevchenko
  Cc: linux-input, linux-iio, linux-kernel, Sanjay Chitroda

From: Sanjay Chitroda <sanjayembeddedse@gmail.com>

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

Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
---
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
- v3 link -> https://lore.kernel.org/all/20260509101040.791404-5-sanjayembedded@gmail.com/
---
 drivers/iio/gyro/hid-sensor-gyro-3d.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c
index e48c25c87b6d..bbca2111e79b 100644
--- a/drivers/iio/gyro/hid-sensor-gyro-3d.c
+++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c
@@ -177,7 +177,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);
@@ -199,7 +199,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)
 {
@@ -234,7 +234,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;

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 2/7] iio: accel: hid-sensor-accel-3d: use u32 instead of unsigned
  2026-06-06 12:17 [PATCH 0/7] HID: iio: basic clean up for usage_id Sanjay Chitroda
  2026-06-06 12:17 ` [PATCH 1/7] iio: gyro: hid-sensor-gyro-3d: use u32 instead of unsigned Sanjay Chitroda
@ 2026-06-06 12:17 ` Sanjay Chitroda
  2026-06-06 12:17 ` [PATCH 3/7] iio: light: hid-sensor-als: " Sanjay Chitroda
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: Sanjay Chitroda @ 2026-06-06 12:17 UTC (permalink / raw)
  To: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, David Lechner,
	Nuno Sá, Andy Shevchenko
  Cc: linux-input, linux-iio, linux-kernel, Sanjay Chitroda

From: Sanjay Chitroda <sanjayembeddedse@gmail.com>

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

Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
---
 drivers/iio/accel/hid-sensor-accel-3d.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c
index 2bf05ab5235e..42c4259bf209 100644
--- a/drivers/iio/accel/hid-sensor-accel-3d.c
+++ b/drivers/iio/accel/hid-sensor-accel-3d.c
@@ -223,7 +223,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);
@@ -247,7 +247,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)
 {
@@ -283,7 +283,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;

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 3/7] iio: light: hid-sensor-als: use u32 instead of unsigned
  2026-06-06 12:17 [PATCH 0/7] HID: iio: basic clean up for usage_id Sanjay Chitroda
  2026-06-06 12:17 ` [PATCH 1/7] iio: gyro: hid-sensor-gyro-3d: use u32 instead of unsigned Sanjay Chitroda
  2026-06-06 12:17 ` [PATCH 2/7] iio: accel: hid-sensor-accel-3d: " Sanjay Chitroda
@ 2026-06-06 12:17 ` Sanjay Chitroda
  2026-06-07 20:50   ` Maxwell Doose
  2026-06-08  6:41   ` Joshua Crofts
  2026-06-06 12:17 ` [PATCH 4/7] iio: light: hid-sensor-prox: " Sanjay Chitroda
                   ` (5 subsequent siblings)
  8 siblings, 2 replies; 17+ messages in thread
From: Sanjay Chitroda @ 2026-06-06 12:17 UTC (permalink / raw)
  To: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, David Lechner,
	Nuno Sá, Andy Shevchenko
  Cc: linux-input, linux-iio, linux-kernel, Sanjay Chitroda

From: Sanjay Chitroda <sanjayembeddedse@gmail.com>

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

Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
---
 drivers/iio/light/hid-sensor-als.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c
index d72e260b8266..ae2fda8dc500 100644
--- a/drivers/iio/light/hid-sensor-als.c
+++ b/drivers/iio/light/hid-sensor-als.c
@@ -241,7 +241,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);
@@ -263,7 +263,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)
 {
@@ -305,7 +305,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;

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 4/7] iio: light: hid-sensor-prox: use u32 instead of unsigned
  2026-06-06 12:17 [PATCH 0/7] HID: iio: basic clean up for usage_id Sanjay Chitroda
                   ` (2 preceding siblings ...)
  2026-06-06 12:17 ` [PATCH 3/7] iio: light: hid-sensor-als: " Sanjay Chitroda
@ 2026-06-06 12:17 ` Sanjay Chitroda
  2026-06-06 12:17 ` [PATCH 5/7] iio: orientation: hid-sensor-incl-3d: " Sanjay Chitroda
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: Sanjay Chitroda @ 2026-06-06 12:17 UTC (permalink / raw)
  To: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, David Lechner,
	Nuno Sá, Andy Shevchenko
  Cc: linux-input, linux-iio, linux-kernel, Sanjay Chitroda

From: Sanjay Chitroda <sanjayembeddedse@gmail.com>

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

Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
---
 drivers/iio/light/hid-sensor-prox.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
index edc9274a2c07..9059f00f0ced 100644
--- a/drivers/iio/light/hid-sensor-prox.c
+++ b/drivers/iio/light/hid-sensor-prox.c
@@ -166,7 +166,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);
@@ -183,7 +183,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)
 {

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 5/7] iio: orientation: hid-sensor-incl-3d: use u32 instead of unsigned
  2026-06-06 12:17 [PATCH 0/7] HID: iio: basic clean up for usage_id Sanjay Chitroda
                   ` (3 preceding siblings ...)
  2026-06-06 12:17 ` [PATCH 4/7] iio: light: hid-sensor-prox: " Sanjay Chitroda
@ 2026-06-06 12:17 ` Sanjay Chitroda
  2026-06-06 12:17 ` [PATCH 6/7] iio: orientation: hid-sensor-rotation: " Sanjay Chitroda
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: Sanjay Chitroda @ 2026-06-06 12:17 UTC (permalink / raw)
  To: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, David Lechner,
	Nuno Sá, Andy Shevchenko
  Cc: linux-input, linux-iio, linux-kernel, Sanjay Chitroda

From: Sanjay Chitroda <sanjayembeddedse@gmail.com>

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

Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
---
 drivers/iio/orientation/hid-sensor-incl-3d.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/orientation/hid-sensor-incl-3d.c b/drivers/iio/orientation/hid-sensor-incl-3d.c
index 4e23a598a3fb..c7fbff498be7 100644
--- a/drivers/iio/orientation/hid-sensor-incl-3d.c
+++ b/drivers/iio/orientation/hid-sensor-incl-3d.c
@@ -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;

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 6/7] iio: orientation: hid-sensor-rotation: use u32 instead of unsigned
  2026-06-06 12:17 [PATCH 0/7] HID: iio: basic clean up for usage_id Sanjay Chitroda
                   ` (4 preceding siblings ...)
  2026-06-06 12:17 ` [PATCH 5/7] iio: orientation: hid-sensor-incl-3d: " Sanjay Chitroda
@ 2026-06-06 12:17 ` Sanjay Chitroda
  2026-06-06 12:17 ` [PATCH 7/7] iio: pressure: hid-sensor-press: " Sanjay Chitroda
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: Sanjay Chitroda @ 2026-06-06 12:17 UTC (permalink / raw)
  To: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, David Lechner,
	Nuno Sá, Andy Shevchenko
  Cc: linux-input, linux-iio, linux-kernel, Sanjay Chitroda

From: Sanjay Chitroda <sanjayembeddedse@gmail.com>

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

Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
---
 drivers/iio/orientation/hid-sensor-rotation.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/orientation/hid-sensor-rotation.c b/drivers/iio/orientation/hid-sensor-rotation.c
index 4a11e4555099..20563d8efaf6 100644
--- a/drivers/iio/orientation/hid-sensor-rotation.c
+++ b/drivers/iio/orientation/hid-sensor-rotation.c
@@ -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;

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 7/7] iio: pressure: hid-sensor-press: use u32 instead of unsigned
  2026-06-06 12:17 [PATCH 0/7] HID: iio: basic clean up for usage_id Sanjay Chitroda
                   ` (5 preceding siblings ...)
  2026-06-06 12:17 ` [PATCH 6/7] iio: orientation: hid-sensor-rotation: " Sanjay Chitroda
@ 2026-06-06 12:17 ` Sanjay Chitroda
  2026-06-08 18:41 ` [PATCH 0/7] HID: iio: basic clean up for usage_id Jonathan Cameron
  2026-06-08 22:03 ` Maxwell Doose
  8 siblings, 0 replies; 17+ messages in thread
From: Sanjay Chitroda @ 2026-06-06 12:17 UTC (permalink / raw)
  To: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, David Lechner,
	Nuno Sá, Andy Shevchenko
  Cc: linux-input, linux-iio, linux-kernel, Sanjay Chitroda

From: Sanjay Chitroda <sanjayembeddedse@gmail.com>

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

Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
---
 drivers/iio/pressure/hid-sensor-press.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/pressure/hid-sensor-press.c b/drivers/iio/pressure/hid-sensor-press.c
index a039b99d9851..3e47a10d72a8 100644
--- a/drivers/iio/pressure/hid-sensor-press.c
+++ b/drivers/iio/pressure/hid-sensor-press.c
@@ -155,7 +155,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);
@@ -176,7 +176,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)
 {
@@ -204,7 +204,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;

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/7] iio: light: hid-sensor-als: use u32 instead of unsigned
  2026-06-06 12:17 ` [PATCH 3/7] iio: light: hid-sensor-als: " Sanjay Chitroda
@ 2026-06-07 20:50   ` Maxwell Doose
  2026-06-08  6:37     ` Joshua Crofts
  2026-06-08  6:41   ` Joshua Crofts
  1 sibling, 1 reply; 17+ messages in thread
From: Maxwell Doose @ 2026-06-07 20:50 UTC (permalink / raw)
  To: Sanjay Chitroda
  Cc: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, David Lechner,
	Nuno Sá, Andy Shevchenko, linux-input, linux-iio,
	linux-kernel

On Sat, Jun 6, 2026 at 7:19 AM Sanjay Chitroda
<sanjayembeddedse@gmail.com> wrote:
>
> From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
>
> Prefer 'u32' instead of bare 'unsigned' variable to improve code
> clarity and consistency with kernel style.
>
> Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
> ---
>  drivers/iio/light/hid-sensor-als.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>

Do we *need* u32 though? Usually these types are for places where we
require specific bit-widths for a reason (e.g., reading a hardware
register) but I'm not sure that's the case here. I could be totally
wrong, in that case please correct me but otherwise I unfortunately
don't see much value in this. That's just my personal opinion though,
Jonathan may think otherwise.

-- 
best regards,
max

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/7] iio: light: hid-sensor-als: use u32 instead of unsigned
  2026-06-07 20:50   ` Maxwell Doose
@ 2026-06-08  6:37     ` Joshua Crofts
  2026-06-08 18:40       ` Jonathan Cameron
  0 siblings, 1 reply; 17+ messages in thread
From: Joshua Crofts @ 2026-06-08  6:37 UTC (permalink / raw)
  To: Maxwell Doose
  Cc: Sanjay Chitroda, Jiri Kosina, Jonathan Cameron,
	Srinivas Pandruvada, David Lechner, Nuno Sá, Andy Shevchenko,
	linux-input, linux-iio, linux-kernel

On Sun, 7 Jun 2026 at 22:54, Maxwell Doose <m32285159@gmail.com> wrote:
>
> On Sat, Jun 6, 2026 at 7:19 AM Sanjay Chitroda
> <sanjayembeddedse@gmail.com> wrote:
> >
> > From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
> >
> > Prefer 'u32' instead of bare 'unsigned' variable to improve code
> > clarity and consistency with kernel style.
> >
> > Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
> > ---
> >  drivers/iio/light/hid-sensor-als.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
>
> Do we *need* u32 though? Usually these types are for places where we
> require specific bit-widths for a reason (e.g., reading a hardware
> register) but I'm not sure that's the case here. I could be totally
> wrong, in that case please correct me but otherwise I unfortunately
> don't see much value in this. That's just my personal opinion though,
> Jonathan may think otherwise.

Aside from the array of usage ids that are u32 defined here:
https://elixir.bootlin.com/linux/v7.1-rc6/source/drivers/iio/light/hid-sensor-als.c#L46

there are additional structs used in the HID drivers that take u32 (I
had a similar
patch moving `unsigned` to `unsigned int`, but it was recommended to use the
types that the structs use, hence u32).

-- 
Kind regards

CJD

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/7] iio: light: hid-sensor-als: use u32 instead of unsigned
  2026-06-06 12:17 ` [PATCH 3/7] iio: light: hid-sensor-als: " Sanjay Chitroda
  2026-06-07 20:50   ` Maxwell Doose
@ 2026-06-08  6:41   ` Joshua Crofts
  2026-06-08 18:34     ` Jonathan Cameron
  1 sibling, 1 reply; 17+ messages in thread
From: Joshua Crofts @ 2026-06-08  6:41 UTC (permalink / raw)
  To: Sanjay Chitroda
  Cc: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, David Lechner,
	Nuno Sá, Andy Shevchenko, linux-input, linux-iio,
	linux-kernel

On Sat, 6 Jun 2026 at 14:19, Sanjay Chitroda <sanjayembeddedse@gmail.com> wrote:
>
> From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
>
> Prefer 'u32' instead of bare 'unsigned' variable to improve code
> clarity and consistency with kernel style.
>
> Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
> ---
>  drivers/iio/light/hid-sensor-als.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c
> index d72e260b8266..ae2fda8dc500 100644
> --- a/drivers/iio/light/hid-sensor-als.c
> +++ b/drivers/iio/light/hid-sensor-als.c
> @@ -241,7 +241,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)

Code-wise fine, however looking at this function, usage_id is never
actually used,
though not sure whether removing it would break the ABI... up to you
to check it.

-- 
Kind regards

CJD

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/7] iio: gyro: hid-sensor-gyro-3d: use u32 instead of unsigned
  2026-06-06 12:17 ` [PATCH 1/7] iio: gyro: hid-sensor-gyro-3d: use u32 instead of unsigned Sanjay Chitroda
@ 2026-06-08 13:58   ` Andy Shevchenko
  0 siblings, 0 replies; 17+ messages in thread
From: Andy Shevchenko @ 2026-06-08 13:58 UTC (permalink / raw)
  To: Sanjay Chitroda
  Cc: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, David Lechner,
	Nuno Sá, Andy Shevchenko, linux-input, linux-iio,
	linux-kernel

On Sat, Jun 06, 2026 at 05:47:42PM +0530, Sanjay Chitroda wrote:

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

...


>  /* 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)

It still has an indentation issue and I dunno if it's okay to solve at the same
time. Jonathan?

...

>  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)

Ditto.

...

>  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)

Ditto.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/7] iio: light: hid-sensor-als: use u32 instead of unsigned
  2026-06-08  6:41   ` Joshua Crofts
@ 2026-06-08 18:34     ` Jonathan Cameron
  0 siblings, 0 replies; 17+ messages in thread
From: Jonathan Cameron @ 2026-06-08 18:34 UTC (permalink / raw)
  To: Joshua Crofts
  Cc: Sanjay Chitroda, Jiri Kosina, Srinivas Pandruvada, David Lechner,
	Nuno Sá, Andy Shevchenko, linux-input, linux-iio,
	linux-kernel

On Mon, 8 Jun 2026 08:41:07 +0200
Joshua Crofts <joshua.crofts1@gmail.com> wrote:

> On Sat, 6 Jun 2026 at 14:19, Sanjay Chitroda <sanjayembeddedse@gmail.com> wrote:
> >
> > From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
> >
> > Prefer 'u32' instead of bare 'unsigned' variable to improve code
> > clarity and consistency with kernel style.
> >
> > Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
> > ---
> >  drivers/iio/light/hid-sensor-als.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c
> > index d72e260b8266..ae2fda8dc500 100644
> > --- a/drivers/iio/light/hid-sensor-als.c
> > +++ b/drivers/iio/light/hid-sensor-als.c
> > @@ -241,7 +241,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)  
> 
> Code-wise fine, however looking at this function, usage_id is never
> actually used,
> though not sure whether removing it would break the ABI... up to you
> to check it.
> 
It is a callback so signature needs to match.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/7] iio: light: hid-sensor-als: use u32 instead of unsigned
  2026-06-08  6:37     ` Joshua Crofts
@ 2026-06-08 18:40       ` Jonathan Cameron
  2026-06-08 22:01         ` Maxwell Doose
  0 siblings, 1 reply; 17+ messages in thread
From: Jonathan Cameron @ 2026-06-08 18:40 UTC (permalink / raw)
  To: Joshua Crofts
  Cc: Maxwell Doose, Sanjay Chitroda, Jiri Kosina, Srinivas Pandruvada,
	David Lechner, Nuno Sá, Andy Shevchenko, linux-input,
	linux-iio, linux-kernel

On Mon, 8 Jun 2026 08:37:38 +0200
Joshua Crofts <joshua.crofts1@gmail.com> wrote:

> On Sun, 7 Jun 2026 at 22:54, Maxwell Doose <m32285159@gmail.com> wrote:
> >
> > On Sat, Jun 6, 2026 at 7:19 AM Sanjay Chitroda
> > <sanjayembeddedse@gmail.com> wrote:  
> > >
> > > From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
> > >
> > > Prefer 'u32' instead of bare 'unsigned' variable to improve code
> > > clarity and consistency with kernel style.
> > >
> > > Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
> > > ---
> > >  drivers/iio/light/hid-sensor-als.c | 6 +++---
> > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > >  
> >
> > Do we *need* u32 though? Usually these types are for places where we
> > require specific bit-widths for a reason (e.g., reading a hardware
> > register) but I'm not sure that's the case here. I could be totally
> > wrong, in that case please correct me but otherwise I unfortunately
> > don't see much value in this. That's just my personal opinion though,
> > Jonathan may think otherwise.  
> 
> Aside from the array of usage ids that are u32 defined here:
> https://elixir.bootlin.com/linux/v7.1-rc6/source/drivers/iio/light/hid-sensor-als.c#L46
> 
> there are additional structs used in the HID drivers that take u32 (I
> had a similar
> patch moving `unsigned` to `unsigned int`, but it was recommended to use the
> types that the structs use, hence u32).
> 
Here the reason for the change is even simpler. These are callbacks assigned to:

struct hid_sensor_hub_callbacks {
	struct platform_device *pdev;
	int (*suspend)(struct hid_sensor_hub_device *hsdev, void *priv);
	int (*resume)(struct hid_sensor_hub_device *hsdev, void *priv);
	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 given those signatures, these should always have been u32.

I would like that clearly stated in the patch descriptions. Consistency
is a bit too vague.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/7] HID: iio: basic clean up for usage_id
  2026-06-06 12:17 [PATCH 0/7] HID: iio: basic clean up for usage_id Sanjay Chitroda
                   ` (6 preceding siblings ...)
  2026-06-06 12:17 ` [PATCH 7/7] iio: pressure: hid-sensor-press: " Sanjay Chitroda
@ 2026-06-08 18:41 ` Jonathan Cameron
  2026-06-08 22:03 ` Maxwell Doose
  8 siblings, 0 replies; 17+ messages in thread
From: Jonathan Cameron @ 2026-06-08 18:41 UTC (permalink / raw)
  To: Sanjay Chitroda
  Cc: Jiri Kosina, Srinivas Pandruvada, David Lechner, Nuno Sá,
	Andy Shevchenko, linux-input, linux-iio, linux-kernel

On Sat, 06 Jun 2026 17:47:41 +0530
Sanjay Chitroda <sanjayembeddedse@gmail.com> wrote:

> Hi all,
> 
> This series updates all HID IIO drivers to use 'u32' instead of
> bare 'unsigned' for the usage_id parameter.
> 
> This improves type clarity and ensures consistency with kernel
> coding style, as HID usage IDs are defined as 32-bit values.

Other than adding some more detail to the consistency part
(make sure to mention the callback signatures), this looks fine to
me.

Jonathan

> 
> No functional changes are introduced.
> 
> Testing:
>   - Compiled with W=1 for each patch in the series
> 
> ---
> Sanjay Chitroda (7):
>       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
> 
>  drivers/iio/accel/hid-sensor-accel-3d.c       | 6 +++---
>  drivers/iio/gyro/hid-sensor-gyro-3d.c         | 6 +++---
>  drivers/iio/light/hid-sensor-als.c            | 6 +++---
>  drivers/iio/light/hid-sensor-prox.c           | 4 ++--
>  drivers/iio/orientation/hid-sensor-incl-3d.c  | 6 +++---
>  drivers/iio/orientation/hid-sensor-rotation.c | 6 +++---
>  drivers/iio/pressure/hid-sensor-press.c       | 6 +++---
>  7 files changed, 20 insertions(+), 20 deletions(-)
> ---
> base-commit: ae696dfa47c30016cd429b9db5e70b259b8f509e
> change-id: 20260606-6-june-hid-iio-correct-usage-id-57ce92cb102b
> 
> Best regards,
> --  
> Sanjay Chitroda <sanjayembeddedse@gmail.com>
> 


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/7] iio: light: hid-sensor-als: use u32 instead of unsigned
  2026-06-08 18:40       ` Jonathan Cameron
@ 2026-06-08 22:01         ` Maxwell Doose
  0 siblings, 0 replies; 17+ messages in thread
From: Maxwell Doose @ 2026-06-08 22:01 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Joshua Crofts, Sanjay Chitroda, Jiri Kosina, Srinivas Pandruvada,
	David Lechner, Nuno Sá, Andy Shevchenko, linux-input,
	linux-iio, linux-kernel

On Mon, 8 Jun 2026 19:40:47 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Mon, 8 Jun 2026 08:37:38 +0200
> Joshua Crofts <joshua.crofts1@gmail.com> wrote:
> 
> > On Sun, 7 Jun 2026 at 22:54, Maxwell Doose <m32285159@gmail.com> wrote:  
> > >
> > > On Sat, Jun 6, 2026 at 7:19 AM Sanjay Chitroda
> > > <sanjayembeddedse@gmail.com> wrote:    
> > > >
> > > > From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
> > > >
> > > > Prefer 'u32' instead of bare 'unsigned' variable to improve code
> > > > clarity and consistency with kernel style.
> > > >
> > > > Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
> > > > ---
> > > >  drivers/iio/light/hid-sensor-als.c | 6 +++---
> > > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > > >    
> > >
> > > Do we *need* u32 though? Usually these types are for places where we
> > > require specific bit-widths for a reason (e.g., reading a hardware
> > > register) but I'm not sure that's the case here. I could be totally
> > > wrong, in that case please correct me but otherwise I unfortunately
> > > don't see much value in this. That's just my personal opinion though,
> > > Jonathan may think otherwise.    
> > 
> > Aside from the array of usage ids that are u32 defined here:
> > https://elixir.bootlin.com/linux/v7.1-rc6/source/drivers/iio/light/hid-sensor-als.c#L46
> > 
> > there are additional structs used in the HID drivers that take u32 (I
> > had a similar
> > patch moving `unsigned` to `unsigned int`, but it was recommended to use the
> > types that the structs use, hence u32).
> >   
> Here the reason for the change is even simpler. These are callbacks assigned to:
> 
> struct hid_sensor_hub_callbacks {
> 	struct platform_device *pdev;
> 	int (*suspend)(struct hid_sensor_hub_device *hsdev, void *priv);
> 	int (*resume)(struct hid_sensor_hub_device *hsdev, void *priv);
> 	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 given those signatures, these should always have been u32.
>

Ah then perhaps I was a bit harsh on Sanjay.

>
> I would like that clearly stated in the patch descriptions. Consistency
> is a bit too vague.
>

Agree though. But given this

Reviewed-by: Maxwell Doose <m32285159@gmail.com>

-- 
best regards,
max

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/7] HID: iio: basic clean up for usage_id
  2026-06-06 12:17 [PATCH 0/7] HID: iio: basic clean up for usage_id Sanjay Chitroda
                   ` (7 preceding siblings ...)
  2026-06-08 18:41 ` [PATCH 0/7] HID: iio: basic clean up for usage_id Jonathan Cameron
@ 2026-06-08 22:03 ` Maxwell Doose
  8 siblings, 0 replies; 17+ messages in thread
From: Maxwell Doose @ 2026-06-08 22:03 UTC (permalink / raw)
  To: Sanjay Chitroda
  Cc: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, David Lechner,
	Nuno Sá, Andy Shevchenko, linux-input, linux-iio,
	linux-kernel

On Sat, 06 Jun 2026 17:47:41 +0530
Sanjay Chitroda <sanjayembeddedse@gmail.com> wrote:

> Hi all,
> 
> This series updates all HID IIO drivers to use 'u32' instead of
> bare 'unsigned' for the usage_id parameter.
> 
> This improves type clarity and ensures consistency with kernel
> coding style, as HID usage IDs are defined as 32-bit values.
> 
> No functional changes are introduced.
> 
> Testing:
>   - Compiled with W=1 for each patch in the series
> 
> ---
> Sanjay Chitroda (7):
>       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
> 
>  drivers/iio/accel/hid-sensor-accel-3d.c       | 6 +++---
>  drivers/iio/gyro/hid-sensor-gyro-3d.c         | 6 +++---
>  drivers/iio/light/hid-sensor-als.c            | 6 +++---
>  drivers/iio/light/hid-sensor-prox.c           | 4 ++--
>  drivers/iio/orientation/hid-sensor-incl-3d.c  | 6 +++---
>  drivers/iio/orientation/hid-sensor-rotation.c | 6 +++---
>  drivers/iio/pressure/hid-sensor-press.c       | 6 +++---
>  7 files changed, 20 insertions(+), 20 deletions(-)
> ---
> base-commit: ae696dfa47c30016cd429b9db5e70b259b8f509e
> change-id: 20260606-6-june-hid-iio-correct-usage-id-57ce92cb102b
> 
> Best regards,
> --  
> Sanjay Chitroda <sanjayembeddedse@gmail.com>
> 
> 

This series:

Reviewed-by: Maxwell Doose <m32285159@gmail.com>

-- 
best regards,
max

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2026-06-08 22:03 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-06 12:17 [PATCH 0/7] HID: iio: basic clean up for usage_id Sanjay Chitroda
2026-06-06 12:17 ` [PATCH 1/7] iio: gyro: hid-sensor-gyro-3d: use u32 instead of unsigned Sanjay Chitroda
2026-06-08 13:58   ` Andy Shevchenko
2026-06-06 12:17 ` [PATCH 2/7] iio: accel: hid-sensor-accel-3d: " Sanjay Chitroda
2026-06-06 12:17 ` [PATCH 3/7] iio: light: hid-sensor-als: " Sanjay Chitroda
2026-06-07 20:50   ` Maxwell Doose
2026-06-08  6:37     ` Joshua Crofts
2026-06-08 18:40       ` Jonathan Cameron
2026-06-08 22:01         ` Maxwell Doose
2026-06-08  6:41   ` Joshua Crofts
2026-06-08 18:34     ` Jonathan Cameron
2026-06-06 12:17 ` [PATCH 4/7] iio: light: hid-sensor-prox: " Sanjay Chitroda
2026-06-06 12:17 ` [PATCH 5/7] iio: orientation: hid-sensor-incl-3d: " Sanjay Chitroda
2026-06-06 12:17 ` [PATCH 6/7] iio: orientation: hid-sensor-rotation: " Sanjay Chitroda
2026-06-06 12:17 ` [PATCH 7/7] iio: pressure: hid-sensor-press: " Sanjay Chitroda
2026-06-08 18:41 ` [PATCH 0/7] HID: iio: basic clean up for usage_id Jonathan Cameron
2026-06-08 22:03 ` Maxwell Doose

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox