Skip to contentSkip to conversation

iio: gts-helper: fix error headers

PATCH In review Javier Carrasco 4 participants 4 messages Aug 14 – Aug 19

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

PATCH 1/1 iio: gts-helper: fix error headers

Both industrialio-gts-helper.c and iio-gts-helper.h use error codes defined in <asm-generic/errno-base.h> (usually included via <linux/errno.h>), but only industrialio-gts-helper.c includes it. On the other hand, that file also uses error macros like IS_ERR() and PTR_ERR(), which are included in <linux/err.h>.

Add the right includes to provide the used elements from the error headers:

- <linux/errno.h> in iio-gts-helper.h

- <linux/err.h> in industrialio-gts-helper.c, which in turn includes <asm/errno.h>, which only includes <asm-generic/errno-base.h>

---
I stumbled upon this while refactoring veml6031x00.c
(which uses IIO GTS) just because clangd threw a couple of errors where -EINVAL is returned in iio-gts-helper.h

In the end everything compiles anyway, and therefore I have not added a "Fixes:" tag, but please let me know if that is really required for something like this. It is also true that if the gts header is included first, the compiler will throw the same error clangd showed me and the kernel won't compile... Unlikely to ever happen, though.

I have compiled and tested this implementation with the driver I am attempting to upstream without any issues.

---
 drivers/iio/industrialio-gts-helper.c | 2 +-
 include/linux/iio/iio-gts-helper.h    | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/iio/industrialio-gts-helper.c +1 -1
index 4f52dc373abf..af6ed37fb34a 100644
@@ -5,7 +5,7 @@
  */
 
 #include <linux/device.h>
-#include <linux/errno.h>
+#include <linux/err.h>
 #include <linux/export.h>
 #include <linux/minmax.h>
 #include <linux/module.h>
include/linux/iio/iio-gts-helper.h +1 -0
index 66f830ab9b49..f63a482b82b8 100644
@@ -7,6 +7,7 @@
 #ifndef __IIO_GTS_HELPER__
 #define __IIO_GTS_HELPER__
 
+#include <linux/errno.h>
 #include <linux/types.h>
 
 struct device;

---
base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
change-id: 20260814-iio-gts-err-headers-d7ecb6b5ebb7

Best regards,

Signature · 1 line
Javier Carrasco <[email protected]>
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Javier Carrasco

Both industrialio-gts-helper.c and iio-gts-helper.h use error codes defined in <asm-generic/errno-base.h> (usually included via <linux/errno.h>), but only industrialio-gts-helper.c includes it. On the other hand, that file also uses error macros like IS_ERR() and PTR_ERR(), which are included in <linux/err.h>.

Quoted 7 lines

Add the right includes to provide the used elements from the error headers:

- <linux/errno.h> in iio-gts-helper.h

- <linux/err.h> in industrialio-gts-helper.c, which in turn includes <asm/errno.h>, which only includes <asm-generic/errno-base.h>

Makes a perfect sense.

Quoted 8 lines

---
I stumbled upon this while refactoring veml6031x00.c
(which uses IIO GTS) just because clangd threw a couple of errors where -EINVAL is returned in iio-gts-helper.h

In the end everything compiles anyway, and therefore I have not added a "Fixes:" tag, but please let me know if that is really required for something like this.

Yes, sounds good to me.

Quoted 3 lines

It is also true that if the gts header is
included first, the compiler will throw the same error clangd showed me and the kernel won't compile... Unlikely to ever happen, though.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Javier Carrasco
Quoted 20 lines · Javier Carrasco

Both industrialio-gts-helper.c and iio-gts-helper.h use error codes defined in <asm-generic/errno-base.h> (usually included via <linux/errno.h>), but only industrialio-gts-helper.c includes it. On the other hand, that file also uses error macros like IS_ERR() and PTR_ERR(), which are included in <linux/err.h>.

Add the right includes to provide the used elements from the error headers:

- <linux/errno.h> in iio-gts-helper.h

- <linux/err.h> in industrialio-gts-helper.c, which in turn includes <asm/errno.h>, which only includes <asm-generic/errno-base.h>

---
I stumbled upon this while refactoring veml6031x00.c
(which uses IIO GTS) just because clangd threw a couple of errors where -EINVAL is returned in iio-gts-helper.h

Quoted 5 lines

In the end everything compiles anyway, and therefore I have not added a "Fixes:" tag, but please let me know if that is really required for something like this. It is also true that if the gts header is included first, the compiler will throw the same error clangd showed me and the kernel won't compile... Unlikely to ever happen, though.

Unlikely or not, this sounds like an error to me. Hence, I don't think a fixes-tag would be wrong either.

Anyways - thanks!

Quoted 39 lines

I have compiled and tested this implementation with the driver I am attempting to upstream without any issues.

---
  drivers/iio/industrialio-gts-helper.c | 2 +-
  include/linux/iio/iio-gts-helper.h    | 1 +
  2 files changed, 2 insertions(+), 1 deletion(-)
drivers/iio/industrialio-gts-helper.c +1 -1
index 4f52dc373abf..af6ed37fb34a 100644
@@ -5,7 +5,7 @@
   */
 
  #include <linux/device.h>
-#include <linux/errno.h>
+#include <linux/err.h>
  #include <linux/export.h>
  #include <linux/minmax.h>
  #include <linux/module.h>
include/linux/iio/iio-gts-helper.h +1 -1
index 66f830ab9b49..f63a482b82b8 100644
@@ -7,6 +7,7 @@
  #ifndef __IIO_GTS_HELPER__
  #define __IIO_GTS_HELPER__
 
+#include <linux/errno.h>
  #include <linux/types.h>
 
  struct device;
 
---

base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
change-id: 20260814-iio-gts-err-headers-d7ecb6b5ebb7

Best regards,

Signature · 5 lines
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~
maintainer
#3 lore raw
Quoted 27 lines · On Mon, 17 Aug 2026 14:03:53 +0300 Matti Vaittinen <[email protected]>…
Quoted 20 lines · Javier Carrasco

Both industrialio-gts-helper.c and iio-gts-helper.h use error codes defined in <asm-generic/errno-base.h> (usually included via <linux/errno.h>), but only industrialio-gts-helper.c includes it. On the other hand, that file also uses error macros like IS_ERR() and PTR_ERR(), which are included in <linux/err.h>.

Add the right includes to provide the used elements from the error headers:

- <linux/errno.h> in iio-gts-helper.h

- <linux/err.h> in industrialio-gts-helper.c, which in turn includes <asm/errno.h>, which only includes <asm-generic/errno-base.h>

---
I stumbled upon this while refactoring veml6031x00.c
(which uses IIO GTS) just because clangd threw a couple of errors where -EINVAL is returned in iio-gts-helper.h

Quoted 5 lines

In the end everything compiles anyway, and therefore I have not added a "Fixes:" tag, but please let me know if that is really required for something like this. It is also true that if the gts header is included first, the compiler will throw the same error clangd showed me and the kernel won't compile... Unlikely to ever happen, though.

Quoted 7 lines

Unlikely or not, this sounds like an error to me. Hence, I don't think a fixes-tag would be wrong either.

Anyways - thanks!

Applied (without fixes tag - not known to be a problem right now and these sort of things are really common) to the testing branch of iio.git

Thanks,

Jonathan

Quoted 41 lines
Quoted 39 lines

I have compiled and tested this implementation with the driver I am attempting to upstream without any issues.

---
  drivers/iio/industrialio-gts-helper.c | 2 +-
  include/linux/iio/iio-gts-helper.h    | 1 +
  2 files changed, 2 insertions(+), 1 deletion(-)
drivers/iio/industrialio-gts-helper.c +1 -1
index 4f52dc373abf..af6ed37fb34a 100644
@@ -5,7 +5,7 @@
   */
 
  #include <linux/device.h>
-#include <linux/errno.h>
+#include <linux/err.h>
  #include <linux/export.h>
  #include <linux/minmax.h>
  #include <linux/module.h>
include/linux/iio/iio-gts-helper.h +1 -1
index 66f830ab9b49..f63a482b82b8 100644
@@ -7,6 +7,7 @@
  #ifndef __IIO_GTS_HELPER__
  #define __IIO_GTS_HELPER__
 
+#include <linux/errno.h>
  #include <linux/types.h>
 
  struct device;
 
---

base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
change-id: 20260814-iio-gts-err-headers-d7ecb6b5ebb7

Best regards,