[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251106-scsi-ufs-core-fix-sysfs-update-hid-group-v1-1-1262037d6c97@bootlin.com>
Date: Thu, 06 Nov 2025 11:46:04 +0100
From: "Thomas Richard (TI.com)" <thomas.richard@...tlin.com>
To: Alim Akhtar <alim.akhtar@...sung.com>,
Avri Altman <avri.altman@....com>, Bart Van Assche <bvanassche@....org>,
"James E.J. Bottomley" <James.Bottomley@...senPartnership.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Daniel Lee <chullee@...gle.com>
Cc: Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Gregory CLEMENT <gregory.clement@...tlin.com>, Udit Kumar <u-kumar1@...com>,
Prasanth Mantena <p-mantena@...com>, Abhash Kumar <a-kumar2@...com>,
linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
"Thomas Richard (TI.com)" <thomas.richard@...tlin.com>
Subject: [PATCH] scsi: ufs: core: fix hid sysfs group update
Without UFSHCD_QUIRK_SKIP_PH_CONFIGURATION, the UFS core fails to create
sysfs groups due to a pre-existing hid group.
[ 3.431670] Call trace:
[ 3.431673] show_stack+0x18/0x24 (C)
[ 3.431682] dump_stack_lvl+0x74/0x8c
[ 3.431691] dump_stack+0x18/0x24
[ 3.431696] sysfs_warn_dup+0x64/0x80
[ 3.431704] internal_create_group+0x450/0x46c
[ 3.431709] internal_create_groups+0x50/0xd0
[ 3.431714] sysfs_create_groups+0x18/0x24
[ 3.431719] ufs_sysfs_add_nodes+0x24/0x68
[ 3.431725] ufshcd_init+0xb3c/0xef0
[ 3.431730] ufshcd_pltfrm_init+0x514/0x7ec
[ 3.431735] cdns_ufs_pltfrm_probe+0x3c/0x80
[ 3.431740] platform_probe+0x5c/0x98
[ 3.431745] really_probe+0xbc/0x2a8
[ 3.431749] __driver_probe_device+0x78/0x12c
[ 3.431752] driver_probe_device+0xd8/0x15c
[ 3.431756] __device_attach_driver+0xb8/0x134
[ 3.431760] bus_for_each_drv+0x88/0xe8
[ 3.431763] __device_attach+0xa0/0x190
[ 3.431766] device_initial_probe+0x14/0x20
[ 3.431769] bus_probe_device+0xac/0xb0
[ 3.431773] device_add+0x5d4/0x7a4
[ 3.431779] of_device_add+0x44/0x60
[ 3.431785] of_platform_device_create_pdata+0x8c/0x120
[ 3.431789] of_platform_bus_create+0x158/0x39c
[ 3.431794] of_platform_populate+0x74/0x108
[ 3.431798] ti_j721e_ufs_probe+0xd8/0x1c0
[ 3.431803] platform_probe+0x5c/0x98
[ 3.431807] really_probe+0xbc/0x2a8
[ 3.431811] __driver_probe_device+0x78/0x12c
[ 3.431814] driver_probe_device+0xd8/0x15c
[ 3.431818] __device_attach_driver+0xb8/0x134
[ 3.431821] bus_for_each_drv+0x88/0xe8
[ 3.431824] __device_attach+0xa0/0x190
[ 3.431828] device_initial_probe+0x14/0x20
[ 3.431831] bus_probe_device+0xac/0xb0
[ 3.431834] deferred_probe_work_func+0x88/0xc0
[ 3.431838] process_one_work+0x148/0x28c
[ 3.431844] worker_thread+0x2d0/0x3d8
[ 3.431848] kthread+0x12c/0x204
[ 3.431855] ret_from_fork+0x10/0x20
[ 3.432030] cdns-ufshcd 4e84000.ufs: ufs_sysfs_add_nodes: sysfs groups creation failed (err = -17)
The issue occurs because, without UFSHCD_QUIRK_SKIP_PH_CONFIGURATION, the
hid group is updated before sysfs groups creation. The sysfs_update_group()
function silently creates missing group, the subsequent call to
ufs_sysfs_add_nodes() fails when it attempts to create the already-existing
hid group.
Without UFSHCD_QUIRK_SKIP_PH_CONFIGURATION:
ufshcd_init
ufshcd_device_params_init
ufs_get_device_desc
sysfs_update_group
ufs_sysfs_add_nodes
With UFSHCD_QUIRK_SKIP_PH_CONFIGURATION:
ufshcd_init
ufs_sysfs_add_nodes
Move the sysfs_update_group() call in ufshcd_device_init() after
ufshcd_device_params_init() to ensure hid group is updated once all groups
were created.
Fixes: bb7663dec67b ("scsi: ufs: sysfs: Make HID attributes visible")
Signed-off-by: Thomas Richard (TI.com) <thomas.richard@...tlin.com>
---
Issue found on a TI J784S4 EVM board. Testing confirms the issue is fixed
on my platform. However, I was unable to verify if HID attributes are
visible when the feature is supported.
---
drivers/ufs/core/ufshcd.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 9ca27de4767a..94bcb75ea2f8 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -8503,8 +8503,6 @@ static int ufs_get_device_desc(struct ufs_hba *hba)
DEVICE_DESC_PARAM_EXT_UFS_FEATURE_SUP) &
UFS_DEV_HID_SUPPORT;
- sysfs_update_group(&hba->dev->kobj, &ufs_sysfs_hid_group);
-
model_index = desc_buf[DEVICE_DESC_PARAM_PRDCT_NAME];
err = ufshcd_read_string_desc(hba, model_index,
@@ -9033,6 +9031,9 @@ static int ufshcd_device_init(struct ufs_hba *hba, bool init_dev_params)
ret = ufshcd_device_params_init(hba);
if (ret)
return ret;
+
+ sysfs_update_group(&hba->dev->kobj, &ufs_sysfs_hid_group);
+
if (is_mcq_supported(hba) &&
hba->quirks & UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH) {
ufshcd_config_mcq(hba);
---
base-commit: 6146a0f1dfae5d37442a9ddcba012add260bceb0
change-id: 20251106-scsi-ufs-core-fix-sysfs-update-hid-group-57915023480e
Best regards,
--
Thomas Richard (TI.com) <thomas.richard@...tlin.com>
Powered by blists - more mailing lists