Skip to contentSkip to conversation

ufs: core: Revert "Make HID attributes visible"

PATCH Applied Bart Van Assche 6 participants 7 messages Oct 28, 2025 – Nov 10, 2025

Subsystems (2)
lore
Share & tools
lore

Bart Van Assche

author reviewer
#0 lore raw

PATCH 1/1 ufs: core: Revert "Make HID attributes visible"

Patch "Make HID attributes visible" is needed for older kernel versions (e.g. 6.12) where ufs_get_device_desc() is called from ufshcd_probe_hba(). In these older kernel versions ufshcd_get_device_desc() may be called after the sysfs attributes have been added. In the upstream kernel however ufshcd_get_device_desc() is called before ufs_sysfs_add_nodes(). See also the ufshcd_device_params_init() call from ufshcd_init(). Hence, calling sysfs_update_group() is not necessary.

See also commit 69f5eb78d4b0 ("scsi: ufs: core: Move the ufshcd_device_init(hba, true) call") in kernel v6.13.

This patch fixes the following kernel warning:

sysfs: cannot create duplicate filename '/devices/platform/3c2d0000.ufs/hid'

Workqueue: async async_run_entry_fn
Call trace:
 dump_backtrace+0xfc/0x17c
 show_stack+0x18/0x28
 dump_stack_lvl+0x40/0x104
 dump_stack+0x18/0x3c
 sysfs_warn_dup+0x6c/0xc8
 internal_create_group+0x1c8/0x504
 sysfs_create_groups+0x38/0x9c
 ufs_sysfs_add_nodes+0x20/0x58
 ufshcd_init+0x1114/0x134c
 ufshcd_pltfrm_init+0x728/0x7d8
 ufs_google_probe+0x30/0x84
 platform_probe+0xa0/0xe0
 really_probe+0x114/0x454
 __driver_probe_device+0xa4/0x160
 driver_probe_device+0x44/0x23c
 __device_attach_driver+0x15c/0x1f4
 bus_for_each_drv+0x10c/0x168
 __device_attach_async_helper+0x80/0xf8
 async_run_entry_fn+0x4c/0x17c
 process_one_work+0x26c/0x65c
 worker_thread+0x33c/0x498
 kthread+0x110/0x134
 ret_from_fork+0x10/0x20

ufshcd 3c2d0000.ufs: ufs_sysfs_add_nodes: sysfs groups creation failed (err = -17)

Cc Daniel Lee <[email protected]>
Cc Peter Wang <[email protected]>
Cc Bjorn Andersson <[email protected]>
Cc Neil Armstrong <[email protected]>
Fixes bb7663dec67b ("scsi: ufs: sysfs: Make HID attributes visible")
Fixes bb7663dec67b ("scsi: ufs: sysfs: Make HID attributes visible")
---
 drivers/ufs/core/ufs-sysfs.c | 2 +-
 drivers/ufs/core/ufs-sysfs.h | 1 -
 drivers/ufs/core/ufshcd.c    | 2 --
 3 files changed, 1 insertion(+), 4 deletions(-)
drivers/ufs/core/ufs-sysfs.c +1 -1
index c040afc6668e..0086816b27cd 100644
@@ -1949,7 +1949,7 @@ static umode_t ufs_sysfs_hid_is_visible(struct kobject *kobj,
 	return	hba->dev_info.hid_sup ? attr->mode : 0;
 }
 
-const struct attribute_group ufs_sysfs_hid_group = {
+static const struct attribute_group ufs_sysfs_hid_group = {
 	.name = "hid",
 	.attrs = ufs_sysfs_hid,
 	.is_visible = ufs_sysfs_hid_is_visible,
drivers/ufs/core/ufs-sysfs.h +0 -1
index 6efb82a082fd..8d94af3b8077 100644
@@ -14,6 +14,5 @@ void ufs_sysfs_remove_nodes(struct device *dev);
 
 extern const struct attribute_group ufs_sysfs_unit_descriptor_group;
 extern const struct attribute_group ufs_sysfs_lun_attributes_group;
-extern const struct attribute_group ufs_sysfs_hid_group;
 
 #endif
drivers/ufs/core/ufshcd.c +0 -2
index 5d6297aa5c28..2b76f543d072 100644
@@ -8499,8 +8499,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,
Acked-by on v1 1/1
#1 lore raw

Hi,

Quoted 41 lines · Bart Van Assche

Patch "Make HID attributes visible" is needed for older kernel versions (e.g. 6.12) where ufs_get_device_desc() is called from ufshcd_probe_hba(). In these older kernel versions ufshcd_get_device_desc() may be called after the sysfs attributes have been added. In the upstream kernel however ufshcd_get_device_desc() is called before ufs_sysfs_add_nodes(). See also the ufshcd_device_params_init() call from ufshcd_init(). Hence, calling sysfs_update_group() is not necessary.

See also commit 69f5eb78d4b0 ("scsi: ufs: core: Move the ufshcd_device_init(hba, true) call") in kernel v6.13.

This patch fixes the following kernel warning:

sysfs: cannot create duplicate filename '/devices/platform/3c2d0000.ufs/hid'

Workqueue: async async_run_entry_fn
Call trace:
  dump_backtrace+0xfc/0x17c
  show_stack+0x18/0x28
  dump_stack_lvl+0x40/0x104
  dump_stack+0x18/0x3c
  sysfs_warn_dup+0x6c/0xc8
  internal_create_group+0x1c8/0x504
  sysfs_create_groups+0x38/0x9c
  ufs_sysfs_add_nodes+0x20/0x58
  ufshcd_init+0x1114/0x134c
  ufshcd_pltfrm_init+0x728/0x7d8
  ufs_google_probe+0x30/0x84
  platform_probe+0xa0/0xe0
  really_probe+0x114/0x454
  __driver_probe_device+0xa4/0x160
  driver_probe_device+0x44/0x23c
  __device_attach_driver+0x15c/0x1f4
  bus_for_each_drv+0x10c/0x168
  __device_attach_async_helper+0x80/0xf8
  async_run_entry_fn+0x4c/0x17c
  process_one_work+0x26c/0x65c
  worker_thread+0x33c/0x498
  kthread+0x110/0x134
  ret_from_fork+0x10/0x20

ufshcd 3c2d0000.ufs: ufs_sysfs_add_nodes: sysfs groups creation failed (err = -17)

Quoted 8 lines
Cc Daniel Lee <[email protected]>
Cc Peter Wang <[email protected]>
Cc Bjorn Andersson <[email protected]>
Cc Neil Armstrong <[email protected]>
Fixes bb7663dec67b ("scsi: ufs: sysfs: Make HID attributes visible")
Fixes bb7663dec67b ("scsi: ufs: sysfs: Make HID attributes visible")

Duplicate fixes, but perhaps you could specify this revert is only for v6.18 and the original commit should be backported ?

Anyway:

Thanks,
Neil

Quoted 43 lines
---
  drivers/ufs/core/ufs-sysfs.c | 2 +-
  drivers/ufs/core/ufs-sysfs.h | 1 -
  drivers/ufs/core/ufshcd.c    | 2 --
  3 files changed, 1 insertion(+), 4 deletions(-)
drivers/ufs/core/ufs-sysfs.c +1 -1
index c040afc6668e..0086816b27cd 100644
@@ -1949,7 +1949,7 @@ static umode_t ufs_sysfs_hid_is_visible(struct kobject *kobj,
  	return	hba->dev_info.hid_sup ? attr->mode : 0;
  }
 
-const struct attribute_group ufs_sysfs_hid_group = {
+static const struct attribute_group ufs_sysfs_hid_group = {
  	.name = "hid",
  	.attrs = ufs_sysfs_hid,
  	.is_visible = ufs_sysfs_hid_is_visible,
drivers/ufs/core/ufs-sysfs.h +0 -1
index 6efb82a082fd..8d94af3b8077 100644
@@ -14,6 +14,5 @@ void ufs_sysfs_remove_nodes(struct device *dev);
 
  extern const struct attribute_group ufs_sysfs_unit_descriptor_group;
  extern const struct attribute_group ufs_sysfs_lun_attributes_group;
-extern const struct attribute_group ufs_sysfs_hid_group;
 
  #endif
drivers/ufs/core/ufshcd.c +0 -2
index 5d6297aa5c28..2b76f543d072 100644
@@ -8499,8 +8499,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,
author reviewer
#2 lore raw
Quoted 3 lines · Neil Armstrong
Quoted 1 line
Fixes bb7663dec67b ("scsi: ufs: sysfs: Make HID attributes visible")

Duplicate fixes, but perhaps you could specify this revert is only for v6.18 and the original commit should be backported ?

I think this patch should be backported to all kernels that include commit bb7663dec67b because that commit may cause UFS attribute creation to fail for any kernel version.

Quoted 2 lines

Anyway:

Thanks!

Bart.

Reviewed-by on v1 1/1
#3 lore raw
In reply to Bart Van Assche
Quoted 13 lines · Bart Van Assche

Patch "Make HID attributes visible" is needed for older kernel versions
(e.g. 6.12) where ufs_get_device_desc() is called from ufshcd_probe_hba().
In these older kernel versions ufshcd_get_device_desc() may be called after the sysfs attributes have been added. In the upstream kernel however
ufshcd_get_device_desc() is called before ufs_sysfs_add_nodes(). See also
the ufshcd_device_params_init() call from ufshcd_init(). Hence, calling
sysfs_update_group() is not necessary.

Quoted 3 lines

See also commit 69f5eb78d4b0 ("scsi: ufs: core: Move the ufshcd_device_init(hba, true) call") in kernel v6.13.

Reviewed-by on v1 1/1
#4 lore raw
In reply to Bart Van Assche
Quoted 39 lines · Bart Van Assche

Patch "Make HID attributes visible" is needed for older kernel versions (e.g. 6.12) where ufs_get_device_desc() is called from ufshcd_probe_hba(). In these older kernel versions ufshcd_get_device_desc() may be called after the sysfs attributes have been added. In the upstream kernel however ufshcd_get_device_desc() is called before ufs_sysfs_add_nodes(). See also the ufshcd_device_params_init() call from ufshcd_init(). Hence, calling sysfs_update_group() is not necessary.

See also commit 69f5eb78d4b0 ("scsi: ufs: core: Move the ufshcd_device_init(hba, true) call") in kernel v6.13.

This patch fixes the following kernel warning:

sysfs: cannot create duplicate filename '/devices/platform/3c2d0000.ufs/hid'

Workqueue: async async_run_entry_fn
Call trace:
 dump_backtrace+0xfc/0x17c
 show_stack+0x18/0x28
 dump_stack_lvl+0x40/0x104
 dump_stack+0x18/0x3c
 sysfs_warn_dup+0x6c/0xc8
 internal_create_group+0x1c8/0x504
 sysfs_create_groups+0x38/0x9c
 ufs_sysfs_add_nodes+0x20/0x58
 ufshcd_init+0x1114/0x134c
 ufshcd_pltfrm_init+0x728/0x7d8
 ufs_google_probe+0x30/0x84
 platform_probe+0xa0/0xe0
 really_probe+0x114/0x454
 __driver_probe_device+0xa4/0x160
 driver_probe_device+0x44/0x23c
 __device_attach_driver+0x15c/0x1f4
 bus_for_each_drv+0x10c/0x168
 __device_attach_async_helper+0x80/0xf8
 async_run_entry_fn+0x4c/0x17c
 process_one_work+0x26c/0x65c
 worker_thread+0x33c/0x498
 kthread+0x110/0x134
 ret_from_fork+0x10/0x20
Quoted 5 lines

ufshcd 3c2d0000.ufs: ufs_sysfs_add_nodes: sysfs groups creation failed (err = -17)

Cc Daniel Lee <[email protected]>
Cc Peter Wang <[email protected]>
Cc Bjorn Andersson <[email protected]>

Thanks for continuing the research, this looks even better than what we discussed :)

Regards,
Bjorn

Quoted 48 lines
Cc Neil Armstrong <[email protected]>
Fixes bb7663dec67b ("scsi: ufs: sysfs: Make HID attributes visible")
Fixes bb7663dec67b ("scsi: ufs: sysfs: Make HID attributes visible")
---
 drivers/ufs/core/ufs-sysfs.c | 2 +-
 drivers/ufs/core/ufs-sysfs.h | 1 -
 drivers/ufs/core/ufshcd.c    | 2 --
 3 files changed, 1 insertion(+), 4 deletions(-)
drivers/ufs/core/ufs-sysfs.c +1 -1
index c040afc6668e..0086816b27cd 100644
@@ -1949,7 +1949,7 @@ static umode_t ufs_sysfs_hid_is_visible(struct kobject *kobj,
 	return	hba->dev_info.hid_sup ? attr->mode : 0;
 }
 
-const struct attribute_group ufs_sysfs_hid_group = {
+static const struct attribute_group ufs_sysfs_hid_group = {
 	.name = "hid",
 	.attrs = ufs_sysfs_hid,
 	.is_visible = ufs_sysfs_hid_is_visible,
drivers/ufs/core/ufs-sysfs.h +0 -1
index 6efb82a082fd..8d94af3b8077 100644
@@ -14,6 +14,5 @@ void ufs_sysfs_remove_nodes(struct device *dev);
 
 extern const struct attribute_group ufs_sysfs_unit_descriptor_group;
 extern const struct attribute_group ufs_sysfs_lun_attributes_group;
-extern const struct attribute_group ufs_sysfs_hid_group;
 
 #endif
drivers/ufs/core/ufshcd.c +0 -2
index 5d6297aa5c28..2b76f543d072 100644
@@ -8499,8 +8499,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,
#5 lore raw
In reply to Bart Van Assche
Quoted 9 lines · Bart Van Assche

Patch "Make HID attributes visible" is needed for older kernel versions (e.g. 6.12) where ufs_get_device_desc() is called from ufshcd_probe_hba(). In these older kernel versions ufshcd_get_device_desc() may be called after the sysfs attributes have been added. In the upstream kernel however ufshcd_get_device_desc() is called before ufs_sysfs_add_nodes(). See also the ufshcd_device_params_init() call from ufshcd_init(). Hence, calling sysfs_update_group() is not necessary.

[...]

Applied to 6.18/scsi-fixes, thanks!

[1/1] ufs: core: Revert "Make HID attributes visible"

      https://git.kernel.org/mkp/scsi/c/f838d624fd11
Signature · 1 line
Martin K. Petersen
#6 lore raw

Hello,

Quoted 10 lines · Martin K. Petersen
Quoted 8 lines · Bart Van Assche

Patch "Make HID attributes visible" is needed for older kernel versions (e.g. 6.12) where ufs_get_device_desc() is called from ufshcd_probe_hba(). In these older kernel versions ufshcd_get_device_desc() may be called after the sysfs attributes have been added. In the upstream kernel however ufshcd_get_device_desc() is called before ufs_sysfs_add_nodes(). See also the ufshcd_device_params_init() call from ufshcd_init(). Hence, calling sysfs_update_group() is not necessary.

Quoted 7 lines
Quoted 1 line

[...]

Applied to 6.18/scsi-fixes, thanks!

[1/1] ufs: core: Revert "Make HID attributes visible"

      https://git.kernel.org/mkp/scsi/c/f838d624fd11

I tested kernel 6.18-rc5 as requested by Bart [1]. Issue is fixed !!

[1]
https://lore.kernel.org/linux-scsi/[email protected]/

Best Regards,
Thomas