Skip to contentSkip to conversation

iio: gyro: header cleanups

PATCH Superseded Joshua Crofts 3 participants 16 messages Nov 25 – Nov 27

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover iio: gyro: header cleanups

Remove any kernel.h occurences in gyro/ and update the headers in accordance with IWYU (at least loosely).

---
Joshua Crofts (9):
iio: gyro: adis16080: reorder headers
iio: gyro: adis16080: apply iwyu principle
iio: gyro: adis16136: apply iwyu principle
iio: gyro: adis16130: apply iwyu principle
iio: gyro: adis16260: apply iwyu principle
iio: gyro: adxrs290: apply iwyu principle
iio: gyro: adxrs450: sort headers
iio: gyro: adxrs450: apply iwyu principle
iio: gyro: st_gyro: apply iwyu principle

 drivers/iio/gyro/adis16080.c      | 15 +++++++++++----
 drivers/iio/gyro/adis16130.c      | 10 ++++++----
 drivers/iio/gyro/adis16136.c      | 10 +++++++---
 drivers/iio/gyro/adis16260.c      |  9 ++++++---
 drivers/iio/gyro/adxrs290.c       |  5 ++++-
 drivers/iio/gyro/adxrs450.c       | 17 +++++++++++------
 drivers/iio/gyro/st_gyro_buffer.c |  1 -
 drivers/iio/gyro/st_gyro_core.c   |  7 +++++--
 drivers/iio/gyro/st_gyro_i2c.c    |  6 ++++--
 drivers/iio/gyro/st_gyro_spi.c    |  4 +++-
 10 files changed, 57 insertions(+), 27 deletions(-)

---
base-commit: 903941a9b06ae445c70646ab061b604c2dea17d3
change-id: 20261120-gyro-kernel-header-removal-7e7ce8b60656

Best regards,

Signature · 1 line
Joshua Crofts
#1 lore raw

PATCH 1/9 iio: gyro: adis16080: reorder headers

Sort the headers alphabetically for better readability.

---
 drivers/iio/gyro/adis16080.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/gyro/adis16080.c +3 -3
index 0c8bc1e569fe..27e6f28c69d5 100644
@@ -5,13 +5,13 @@
  * Copyright 2010 Analog Devices Inc.
  */
 #include <linux/delay.h>
-#include <linux/mutex.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
-#include <linux/spi/spi.h>
+#include <linux/module.h>
+#include <linux/mutex.h>
 #include <linux/slab.h>
+#include <linux/spi/spi.h>
 #include <linux/sysfs.h>
-#include <linux/module.h>
 
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
Signature · 1 line
2.56.0
#2 lore raw

PATCH 2/9 iio: gyro: adis16080: apply iwyu principle

In reply to Joshua Crofts

Remove the catch all kernel.h header and add/remove the remaining headers in accordance with the IWYU principle.

---
 drivers/iio/gyro/adis16080.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/iio/gyro/adis16080.c +8 -1
index 27e6f28c69d5..39437244031a 100644
@@ -4,14 +4,21 @@
  *
  * Copyright 2010 Analog Devices Inc.
  */
+
+#include <linux/array_size.h>
+#include <linux/bitops.h>
 #include <linux/delay.h>
 #include <linux/device.h>
-#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/math.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/slab.h>
 #include <linux/spi/spi.h>
 #include <linux/sysfs.h>
+#include <linux/types.h>
+
+#include <asm/byteorder.h>
 
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
Signature · 1 line
2.56.0
#3 lore raw

PATCH 3/9 iio: gyro: adis16136: apply iwyu principle

In reply to Joshua Crofts

Remove the catch all kernel.h header and add/remove the remaining headers in accordance with the IWYU principle.

---
 drivers/iio/gyro/adis16136.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/gyro/adis16136.c +7 -3
index b687588ada03..7981ad694c1a 100644
@@ -6,17 +6,21 @@
  *   Author: Lars-Peter Clausen <[email protected]>
  */
 
+#include <linux/array_size.h>
+#include <linux/bits.h>
+#include <linux/debugfs.h>
 #include <linux/device.h>
-#include <linux/kernel.h>
+#include <linux/kstrtox.h>
+#include <linux/module.h>
 #include <linux/spi/spi.h>
+#include <linux/sprintf.h>
 #include <linux/sysfs.h>
-#include <linux/module.h>
+#include <linux/types.h>
 
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
 #include <linux/iio/imu/adis.h>
 
-#include <linux/debugfs.h>
 
 #define ADIS16136_REG_FLASH_CNT		0x00
 #define ADIS16136_REG_TEMP_OUT		0x02
Signature · 1 line
2.56.0
#4 lore raw

PATCH 4/9 iio: gyro: adis16130: apply iwyu principle

In reply to Joshua Crofts

Remove the catch all kernel.h header and add/remove the remaining headers in accordance with the IWYU principle.

---
 drivers/iio/gyro/adis16130.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/iio/gyro/adis16130.c +6 -4
index 2535e3c94037..ff406e034676 100644
@@ -5,14 +5,16 @@
  * Copyright 2010 Analog Devices Inc.
  */
 
+#include <linux/array_size.h>
+#include <linux/bits.h>
+#include <linux/errno.h>
+#include <linux/module.h>
 #include <linux/mutex.h>
-#include <linux/kernel.h>
 #include <linux/spi/spi.h>
-#include <linux/module.h>
-
+#include <linux/unaligned.h>
+#include <linux/types.h>
 #include <linux/iio/iio.h>
 
-#include <linux/unaligned.h>
 
 #define ADIS16130_CON         0x0
 #define ADIS16130_CON_RD      (1 << 6)
Signature · 1 line
2.56.0
#5 lore raw

Re: [PATCH 4/9] iio: gyro: adis16130: apply iwyu principle

Quoted 2 lines · Joshua Crofts

Remove the catch all kernel.h header and add/remove the remaining headers in accordance with the IWYU principle.

...

drivers/iio/gyro/adis16130.c

Quoted 5 lines
drivers/iio/gyro/adis16130.c +0 -3
-#include <linux/kernel.h>
 #include <linux/spi/spi.h>
-#include <linux/module.h>
 
-

Leave this blank line before iio/ group as it originally was.

Quoted 5 lines
drivers/iio/gyro/adis16130.c +2 -1
+#include <linux/unaligned.h>
+#include <linux/types.h>
 #include <linux/iio/iio.h>
 
-#include <linux/unaligned.h>
Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#6 lore raw

Re: [PATCH 4/9] iio: gyro: adis16130: apply iwyu principle

Quoted 6 lines · On Wed, 25 Nov 2026 23:57:13 +0200 Andy Shevchenko…
Quoted 2 lines · Joshua Crofts

Remove the catch all kernel.h header and add/remove the remaining headers in accordance with the IWYU principle.

...

Quoted 7 lines

drivers/iio/gyro/adis16130.c

Quoted 5 lines
drivers/iio/gyro/adis16130.c +0 -3
-#include <linux/kernel.h>
 #include <linux/spi/spi.h>
-#include <linux/module.h>  
 
-  

Leave this blank line before iio/ group as it originally was.

Tweaked and also removed the extra line we end up with at the end as a result of moving unaligned.h

Quoted 7 lines
Quoted 6 lines
drivers/iio/gyro/adis16130.c +2 -1
+#include <linux/unaligned.h>
+#include <linux/types.h>
 #include <linux/iio/iio.h>
 
-#include <linux/unaligned.h>  
#7 lore raw

PATCH 5/9 iio: gyro: adis16260: apply iwyu principle

In reply to Joshua Crofts

Remove the catch all kernel.h header and add/remove the remaining headers in accordance with the IWYU principle.

---
 drivers/iio/gyro/adis16260.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/iio/gyro/adis16260.c +6 -3
index a79a8edf4c98..a7deccd6e55f 100644
@@ -5,10 +5,13 @@
  * Copyright 2010 Analog Devices Inc.
  */
 
-#include <linux/device.h>
-#include <linux/kernel.h>
-#include <linux/spi/spi.h>
+#include <linux/array_size.h>
+#include <linux/bits.h>
+#include <linux/dev_printk.h>
+#include <linux/errno.h>
 #include <linux/module.h>
+#include <linux/spi/spi.h>
+#include <linux/types.h>
 
 #include <linux/iio/iio.h>
 #include <linux/iio/imu/adis.h>
Signature · 1 line
2.56.0
#8 lore raw

PATCH 6/9 iio: gyro: adxrs290: apply iwyu principle

In reply to Joshua Crofts

Remove the catch all kernel.h header and add/remove the remaining headers in accordance with the IWYU principle.

---
 drivers/iio/gyro/adxrs290.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/iio/gyro/adxrs290.c +4 -1
index b61cc81122a6..581de4c68396 100644
@@ -6,14 +6,17 @@
  * Copyright (C) 2020 Analog Devices, Inc.
  */
 
+#include <linux/array_size.h>
 #include <linux/bitfield.h>
 #include <linux/bitops.h>
 #include <linux/cleanup.h>
 #include <linux/delay.h>
 #include <linux/device.h>
-#include <linux/kernel.h>
+#include <linux/errno.h>
 #include <linux/module.h>
+#include <linux/mutex.h>
 #include <linux/spi/spi.h>
+#include <linux/types.h>
 
 #include <linux/iio/buffer.h>
 #include <linux/iio/iio.h>
Signature · 1 line
2.56.0
#9 lore raw

PATCH 7/9 iio: gyro: adxrs450: sort headers

In reply to Joshua Crofts

Sort headers alphabetically to improve code style.

---
 drivers/iio/gyro/adxrs450.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/iio/gyro/adxrs450.c +6 -6
index 030d042cab8b..be904d615f59 100644
@@ -5,17 +5,17 @@
  * Copyright 2011 Analog Devices Inc.
  */
 
-#include <linux/interrupt.h>
-#include <linux/irq.h>
 #include <linux/delay.h>
-#include <linux/mutex.h>
 #include <linux/device.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <linux/kernel.h>
-#include <linux/spi/spi.h>
-#include <linux/slab.h>
-#include <linux/sysfs.h>
 #include <linux/list.h>
 #include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/slab.h>
+#include <linux/spi/spi.h>
+#include <linux/sysfs.h>
 
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
Signature · 1 line
2.56.0
#10 lore raw

PATCH 8/9 iio: gyro: adxrs450: apply iwyu principle

In reply to Joshua Crofts

Remove the catch all kernel.h header and add/remove the remaining headers in accordance with the IWYU principle.

---
 drivers/iio/gyro/adxrs450.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/iio/gyro/adxrs450.c +6 -1
index be904d615f59..b46722ff39fe 100644
@@ -5,17 +5,22 @@
  * Copyright 2011 Analog Devices Inc.
  */
 
+#include <linux/array_size.h>
+#include <linux/bitops.h>
 #include <linux/delay.h>
 #include <linux/device.h>
+#include <linux/errno.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
-#include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/slab.h>
 #include <linux/spi/spi.h>
 #include <linux/sysfs.h>
+#include <linux/types.h>
+
+#include <asm/byteorder.h>
 
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
Signature · 1 line
2.56.0
#11 lore raw

PATCH 9/9 iio: gyro: st_gyro: apply iwyu principle

In reply to Joshua Crofts

Remove the catch all kernel.h header and add/remove the remaining headers in accordance with the IWYU principle.

---
 drivers/iio/gyro/st_gyro_buffer.c | 1 -
 drivers/iio/gyro/st_gyro_core.c   | 7 +++++--
 drivers/iio/gyro/st_gyro_i2c.c    | 6 ++++--
 drivers/iio/gyro/st_gyro_spi.c    | 4 +++-
 4 files changed, 12 insertions(+), 6 deletions(-)
drivers/iio/gyro/st_gyro_buffer.c +0 -1
index 1ebfe7aa6c96..a58545bfa7f0 100644
@@ -7,7 +7,6 @@
  * Denis Ciocca <[email protected]>
  */
 
-#include <linux/kernel.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/buffer.h>
 #include <linux/iio/trigger.h>
drivers/iio/gyro/st_gyro_core.c +5 -2
index 7fd82cd707c7..1f0f5b12bdb8 100644
@@ -7,11 +7,14 @@
  * Denis Ciocca <[email protected]>
  */
 
-#include <linux/kernel.h>
+#include <linux/array_size.h>
+#include <linux/bits.h>
+#include <linux/errno.h>
+#include <linux/interrupt.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
-#include <linux/interrupt.h>
 #include <linux/sysfs.h>
+
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
 #include <linux/iio/trigger.h>
drivers/iio/gyro/st_gyro_i2c.c +4 -2
index a587e9023ceb..b98b19d93b1c 100644
@@ -7,9 +7,11 @@
  * Denis Ciocca <[email protected]>
  */
 
-#include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/dev_printk.h>
+#include <linux/errno.h>
 #include <linux/i2c.h>
+#include <linux/module.h>
+
 #include <linux/iio/iio.h>
 
 #include <linux/iio/common/st_sensors.h>
drivers/iio/gyro/st_gyro_spi.c +3 -1
index c56331755b5c..b53e3d292a63 100644
@@ -7,9 +7,11 @@
  * Denis Ciocca <[email protected]>
  */
 
-#include <linux/kernel.h>
+#include <linux/dev_printk.h>
+#include <linux/errno.h>
 #include <linux/module.h>
 #include <linux/spi/spi.h>
+
 #include <linux/iio/iio.h>
 
 #include <linux/iio/common/st_sensors.h>
Signature · 1 line
2.56.0
maintainer
#13 lore raw
In reply to Joshua Crofts
Quoted 4 lines · On Wed, 25 Nov 2026 20:24:01 +0100 Joshua Crofts <[email protected]> wrote:

Remove any kernel.h occurences in gyro/ and update the headers in accordance with IWYU (at least loosely).

I suspect we won't get much additional review on this lot and seeing as Andy already took a look, I'll pick them up now.

Applied to the testing branch of iio.git

thanks,

Jonathan

Quoted 28 lines

---
Joshua Crofts (9):
iio: gyro: adis16080: reorder headers
iio: gyro: adis16080: apply iwyu principle
iio: gyro: adis16136: apply iwyu principle
iio: gyro: adis16130: apply iwyu principle
iio: gyro: adis16260: apply iwyu principle
iio: gyro: adxrs290: apply iwyu principle
iio: gyro: adxrs450: sort headers
iio: gyro: adxrs450: apply iwyu principle
iio: gyro: st_gyro: apply iwyu principle

 drivers/iio/gyro/adis16080.c      | 15 +++++++++++----
 drivers/iio/gyro/adis16130.c      | 10 ++++++----
 drivers/iio/gyro/adis16136.c      | 10 +++++++---
 drivers/iio/gyro/adis16260.c      |  9 ++++++---
 drivers/iio/gyro/adxrs290.c       |  5 ++++-
 drivers/iio/gyro/adxrs450.c       | 17 +++++++++++------
 drivers/iio/gyro/st_gyro_buffer.c |  1 -
 drivers/iio/gyro/st_gyro_core.c   |  7 +++++--
 drivers/iio/gyro/st_gyro_i2c.c    |  6 ++++--
 drivers/iio/gyro/st_gyro_spi.c    |  4 +++-
 10 files changed, 57 insertions(+), 27 deletions(-)

---
base-commit: 903941a9b06ae445c70646ab061b604c2dea17d3
change-id: 20261120-gyro-kernel-header-removal-7e7ce8b60656

Best regards,

#14 lore raw
Quoted 9 lines · Jonathan Cameron
Quoted 4 lines · On Wed, 25 Nov 2026 20:24:01 +0100 Joshua Crofts <[email protected]> wrote:

Remove any kernel.h occurences in gyro/ and update the headers in accordance with IWYU (at least loosely).

I suspect we won't get much additional review on this lot and seeing as Andy already took a look, I'll pick them up now.

Ah, well Sashiko had some remarks to patches 2 and 3. Alright if I send patches for you to fixup the applied ones?

Signature · 2 lines
Kind regards,
Joshua Crofts
maintainer
#15 lore raw
Quoted 7 lines · On Thu, 26 Nov 2026 10:14:54 +0100 Joshua Crofts <[email protected]> wrote:
Quoted 6 lines · Jonathan Cameron
Quoted 3 lines · On Wed, 25 Nov 2026 20:24:01 +0100 Joshua Crofts <[email protected]> wrote:

Remove any kernel.h occurences in gyro/ and update the headers in accordance with IWYU (at least loosely).

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

I suspect we won't get much additional review on this lot and seeing as Andy already took a look, I'll pick them up now.

Ah, well Sashiko had some remarks to patches 2 and 3. Alright if I send patches for you to fixup the applied ones?

I forgot to check Sashiko

Have dropped those two patches. Send a v2 of them.

Thanks,

Jonathan