Re: [PATCH v1 1/1] iio: core: Split debugfs routines
From: Joshua Crofts
Date: Tue Nov 24 2026 - 05:17:11 EST
On 24-Nov-26 10:44, Andy Shevchenko wrote:
> Split debugfs routines into a separate file for easier maintenance.
> No functional changes intended.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
>
> 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
>
> diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile
> index 8a897b6729d2..5fd81b20da22 100644
> --- a/drivers/iio/Makefile
> +++ b/drivers/iio/Makefile
> @@ -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
> diff --git a/drivers/iio/iio_core.h b/drivers/iio/iio_core.h
> index 59fa1bd9924b..985ac82a37f9 100644
> --- a/drivers/iio/iio_core.h
> +++ b/drivers/iio/iio_core.h
> @@ -16,6 +16,20 @@ struct iio_buffer;
> struct iio_chan_spec;
> struct iio_dev;
>
> +#if defined(CONFIG_DEBUG_FS)
Veeery small nit, but why not #ifdef CONFIG_DEBUG_FS? It's not
as if you're checking for multiple defines.
> +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;
>
...
> +static const struct file_operations iio_debugfs_reg_fops = {
> + .open = simple_open,
> + .read = iio_debugfs_read_reg,
> + .write = iio_debugfs_write_reg,
> +};
> +
> +static void iio_device_unregister_debugfs(struct iio_dev *indio_dev)
Static here but not in the header file. Same goes for register_debugfs().
--
Kind regards,
Joshua Crofts