iio: core: Split debugfs routines
PATCH v2 1/1 iio: core: Split debugfs routines
Split debugfs routines into a separate file for easier maintenance. No functional changes intended.
---
v2: fixed compilation errors (LKP, Joshua)
Cc: Rupesh Majhi <[email protected]>
Rupesh, feel free to include this patch into your series as the first one.
Fun fact: This patch was written with zero AI assistance.
drivers/iio/Makefile | 1 + drivers/iio/iio_core.h | 14 +++ drivers/iio/industrialio-core.c | 152 +------------------------- drivers/iio/industrialio-debugfs.c | 165 +++++++++++++++++++++++++++++ 4 files changed, 182 insertions(+), 150 deletions(-) create mode 100644 drivers/iio/industrialio-debugfs.c
drivers/iio/Makefile +1 -0
@@ -8,6 +8,7 @@ industrialio-y := industrialio-core.o industrialio-event.o inkern.o industrialio-$(CONFIG_IIO_BUFFER) += industrialio-buffer.o industrialio-$(CONFIG_IIO_TRIGGER) += industrialio-trigger.o industrialio-$(CONFIG_ACPI) += industrialio-acpi.o +industrialio-$(CONFIG_DEBUG_FS) += industrialio-debugfs.o obj-$(CONFIG_IIO_CONFIGFS) += industrialio-configfs.o obj-$(CONFIG_IIO_GTS_HELPER) += industrialio-gts-helper.o
drivers/iio/iio_core.h +14 -0
@@ -16,6 +16,20 @@ struct iio_buffer;struct iio_chan_spec ;struct iio_dev ; +#if defined(CONFIG_DEBUG_FS ) +void iio_debugfs_create (void ); +void iio_debugfs_remove (void ); + +void iio_device_unregister_debugfs (struct iio_dev *indio_dev); +void iio_device_register_debugfs (struct iio_dev *indio_dev); +#else +static inline void iio_debugfs_create (void ) {} +static inline void iio_debugfs_remove (void ) {} + +static void iio_device_register_debugfs (struct iio_dev *indio_dev) {} +static void iio_device_unregister_debugfs (struct iio_dev *indio_dev) {} +#endif /* CONFIG_DEBUG_FS */ +extern const struct device_type iio_device_type;struct iio_dev_buffer_pair {
drivers/iio/industrialio-core.c +2 -150
184 lines not on this page · raw message
drivers/iio/industrialio-debugfs.c new file +165 -0
165 lines not on this page · raw message
Signature · 1 line
2.50.1
Quoted 2 lines · Andy Shevchenko
Split debugfs routines into a separate file for easier maintenance. No functional changes intended.
...
drivers/iio/iio_core.h struct iio_buffer; · line 30
Quoted 12 lines
drivers/iio/iio_core.h +12
-0+#if defined(CONFIG_DEBUG_FS ) +void iio_debugfs_create (void ); +void iio_debugfs_remove (void ); + +void iio_device_unregister_debugfs (struct iio_dev *indio_dev); +void iio_device_register_debugfs (struct iio_dev *indio_dev); +#else +static inline void iio_debugfs_create (void ) {} +static inline void iio_debugfs_remove (void ) {} + +static void iio_device_register_debugfs (struct iio_dev *indio_dev) {} +static void iio_device_unregister_debugfs (struct iio_dev *indio_dev) {}
Gah, these missing inline keyword... Please, add them when applying. Or tell me that I need to send a v3.
static inline void iio_device_register_debugfs(struct iio_dev *indio_dev) {} static inline void iio_device_unregister_debugfs(struct iio_dev *indio_dev) {}
Quoted 1 line
+#endif /*
CONFIG_DEBUG_FS*/
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 43 lines · Andy Shevchenko
Split debugfs routines into a separate file for easier maintenance. No functional changes intended.
Signed-off-by Andy Shevchenko <[email protected]>Reviewed-by Nuno Sá <[email protected]>---
v2: fixed compilation errors (LKP, Joshua)
Cc: Rupesh Majhi <[email protected]>
Rupesh, feel free to include this patch into your series as the first one.Fun fact: This patch was written with zero AI assistance.
drivers/iio/Makefile | 1 + drivers/iio/iio_core.h | 14 +++ drivers/iio/industrialio-core.c | 152 +------------------------- drivers/iio/industrialio-debugfs.c | 165 +++++++++++++++++++++++++++++ 4 files changed, 182 insertions(+), 150 deletions(-) create mode 100644 drivers/iio/industrialio-debugfs.cdrivers/iio/Makefile +1
-0@@ -8,6 +8,7 @@ industrialio-y := industrialio-core.o industrialio-event.o inkern.o industrialio-$(CONFIG_IIO_BUFFER) += industrialio-buffer.o industrialio-$(CONFIG_IIO_TRIGGER) += industrialio-trigger.o industrialio-$(CONFIG_ACPI) += industrialio-acpi.o +industrialio-$(CONFIG_DEBUG_FS) += industrialio-debugfs.o obj-$(CONFIG_IIO_CONFIGFS) += industrialio-configfs.o obj-$(CONFIG_IIO_GTS_HELPER) += industrialio-gts-helper.odrivers/iio/iio_core.h +2
-0@@ -16,6 +16,20 @@ struct iio_buffer;struct iio_chan_spec ;struct iio_dev ; +#if defined(CONFIG_DEBUG_FS ) +void iio_debugfs_create (void );
drivers/iio/iio_core.h struct iio_buffer; · line 30
Quoted 10 lines
drivers/iio/iio_core.h +10
-0+void iio_debugfs_remove (void ); + +void iio_device_unregister_debugfs (struct iio_dev *indio_dev); +void iio_device_register_debugfs (struct iio_dev *indio_dev); +#else +static inline void iio_debugfs_create (void ) {} +static inline void iio_debugfs_remove (void ) {} + +static void iio_device_register_debugfs (struct iio_dev *indio_dev) {} +static void iio_device_unregister_debugfs (struct iio_dev *indio_dev) {}
I checked Sashiko and it points out that building with debugfs disabled causes compiler warnings:
In file included from drivers/iio/industrialio-event.c:22:drivers/iio/iio_core.h:30:13: warning: ‘iio_device_unregister_debugfs’ defined but not used [-Wunused-function]
30 | static void iio_device_unregister_debugfs(struct iio_dev *indio_dev) {}
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/iio_core.h:29:13: warning: ‘iio_device_register_debugfs’ defined but not used [-Wunused-function]
29 | static void iio_device_register_debugfs(struct iio_dev *indio_dev) {}
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
CC io_uring/fs.o
CC io_uring/splice.o
CC io_uring/sync.o
CC kernel/nsproxy.o
In file included from drivers/iio/inkern.c:18:
drivers/iio/iio_core.h:30:13: warning: ‘iio_device_unregister_debugfs’ defined but not used [-Wunused-function]
30 | static void iio_device_unregister_debugfs(struct iio_dev *indio_dev) {}
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/iio_core.h:29:13: warning: ‘iio_device_register_debugfs’ defined but not used [-Wunused-function]
29 | static void iio_device_register_debugfs(struct iio_dev *indio_dev) {}
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~Better to mark the functions static inline.
After adding inline,
Signature · 2 lines
Kind regards, Joshua Crofts
Quoted 1 line · Joshua Crofts
On 25-Nov-26 14:59, Andy Shevchenko wrote:
...
Quoted 4 lines
drivers/iio/iio_core.h struct iio_buffer; · line 30
Quoted 2 lines
drivers/iio/iio_core.h +2
-0+static void iio_device_register_debugfs (struct iio_dev *indio_dev) {} +static void iio_device_unregister_debugfs (struct iio_dev *indio_dev) {}I checked Sashiko and it points out that building with debugfs disabled causes compiler warnings:
Right, you were a bit late after my reply to myself :-), but thanks for double check!
I think this warrants a v3.
Quoted 3 lines
After adding inline,
Reviewed-by Joshua Crofts <[email protected]>
Sure, thanks!
Signature · 2 lines
With Best Regards, Andy Shevchenko