Re: [PATCH 3/9] iio: backend: add debugFs interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 9 Jul 2024 13:14:30 +0200
Nuno Sa <nuno.sa@xxxxxxxxxx> wrote:

> This adds a basic debugfs interface for backends. Two new ops are being
> added:
> 
>  * debugfs_reg_access: Analogous to the core IIO one but for backend
>    devices.
>  * debugfs_print_chan_status: One useful usecase for this one is for
>    testing test tones in a digital interface and "ask" the backend to
>    dump more details on why a test tone might have errors.
> 
> Signed-off-by: Nuno Sa <nuno.sa@xxxxxxxxxx>
Debugfs deserved docs as well as sysfs.
Same place in Documentation/ABI/

Obviously we've neglected this in the past, but nice to do it right
nor new stuff.

one trivial comment below.

> +
> +/**
> + * iio_backend_debugfs_add - Add debugfs interfaces for Backends
> + * @back: Backend device
> + * @indio_dev: IIO device
> + */
> +void iio_backend_debugfs_add(struct iio_backend *back,
> +			     struct iio_dev *indio_dev)
> +{
> +	struct dentry *d = iio_get_debugfs_dentry(indio_dev);
> +	char attr_name[128];
> +
> +	if (!IS_ENABLED(CONFIG_DEBUG_FS))
> +		return;
If this happens, d will be null anyway...  Maybe it's worth keeping
as a form of local docs though.

> +	if (!back->ops->debugfs_reg_access || !d)
> +		return;
> +
> +	snprintf(attr_name, sizeof(attr_name), "%s_direct_reg_access",
> +		 back->name);
> +
> +	debugfs_create_file(attr_name, 0644, d, back,
> +			    &iio_backend_debugfs_reg_fops);
> +}
> +EXPORT_SYMBOL_NS_GPL(iio_backend_debugfs_add, IIO_BACKEND);
>




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux