Re: [PATCH v2 1/2] scsi: ufs: core: Defer debugfs init until after device init
From: Peter Wang
Date: Tue Nov 24 2026 - 01:15:28 EST
On Tue, 2026-11-24 at 09:29 +0800, Po-Wen Kao wrote:
> ufshcd_hba_init() currently creates the debugfs hierarchy and fault
> injection attributes before the controller version (hba-
> >ufs_version),
> controller locks, and device descriptor (hba->dev_info.wspecversion)
> are
> initialized.
>
> Move ufs_debugfs_hba_init() and ufs_fault_inject_hba_init() into
> ufshcd_init() alongside ufs_sysfs_add_nodes(), and move the matching
> ufs_debugfs_hba_exit() from ufshcd_hba_exit() into ufshcd_remove()
> alongside ufs_sysfs_remove_nodes(). Use disable_delayed_work_sync()
> in
> ufs_debugfs_hba_exit() so an in-flight exception event cannot re-
> queue
> debugfs_ee_work while scsi_remove_host() is still tearing down
> devices.
>
> Moving the exit call symmetrically keeps probe error paths from
> tearing
> down uncreated debugfs state, drains debugfs readers before
> scsi_remove_host() removes the WLUN during unbind, and lets debugfs
> initialization inspect both hba->ufs_version and
> hba->dev_info.wspecversion directly.
>
> Suggested-by: Peter Wang <peter.wang@xxxxxxxxxxxx>
> Signed-off-by: Brian Kao <powenkao@xxxxxxxxxx>
> ---
Reviewed-by: Peter Wang <peter.wang@xxxxxxxxxxxx>