Re: [PATCH 06/10] thunderbolt: Create debugfs directory automatically for services

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

 



On Wed, Nov 04, 2020 at 05:00:26PM +0300, Mika Westerberg wrote:
> This allows service drivers to use it as parent directory if they need
> to add their own debugfs entries.
> 
> Signed-off-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
> ---
>  drivers/thunderbolt/debugfs.c | 24 ++++++++++++++++++++++++
>  drivers/thunderbolt/tb.h      |  4 ++++
>  drivers/thunderbolt/xdomain.c |  3 +++
>  include/linux/thunderbolt.h   |  4 ++++
>  4 files changed, 35 insertions(+)
> 
> diff --git a/drivers/thunderbolt/debugfs.c b/drivers/thunderbolt/debugfs.c
> index ed65d2b13964..a80278fc50af 100644
> --- a/drivers/thunderbolt/debugfs.c
> +++ b/drivers/thunderbolt/debugfs.c
> @@ -691,6 +691,30 @@ void tb_switch_debugfs_remove(struct tb_switch *sw)
>  	debugfs_remove_recursive(sw->debugfs_dir);
>  }
>  
> +/**
> + * tb_service_debugfs_init() - Add debugfs directory for service
> + * @svc: Thunderbolt service pointer
> + *
> + * Adds debugfs directory for service.
> + */
> +void tb_service_debugfs_init(struct tb_service *svc)
> +{
> +	svc->debugfs_dir = debugfs_create_dir(dev_name(&svc->dev),
> +					      tb_debugfs_root);
> +}
> +
> +/**
> + * tb_service_debugfs_remove() - Remove service debugfs directory
> + * @svc: Thunderbolt service pointer
> + *
> + * Removes the previously created debugfs directory for @svc.
> + */
> +void tb_service_debugfs_remove(struct tb_service *svc)
> +{
> +	debugfs_remove(svc->debugfs_dir);

debugfs_remove_recursive() just to be safe that you really did clean
everything up?  As you aren't "owning" this directory here, you don't
know what will get added by some other patch :)

Other than that tiny nit, this series looks good to me, nice work.

thanks,

greg k-h



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux