Re: [PATCH v2 1/2] scsi: ufs: core: Add support to notify userspace of UniPro QoS events

From: Can Guo

Date: Sun Mar 01 2026 - 04:10:20 EST


Hi Bart,

On 2/26/2026 2:48 AM, Bart Van Assche wrote:

On 2/24/26 6:29 PM, Can Guo wrote:
+What: /sys/bus/platform/drivers/ufshcd/*/dme_qos_notification
+What: /sys/bus/platform/devices/*.ufs/dme_qos_notification
+Date:        February 2026
+Contact:    Can Guo <can.guo@xxxxxxxxxxxxxxxx>
+Description:
+        This attribute shows and clears the DME    Quality of Service
+        notification from UFSHCI UECDME.
+
+        The attribute is read/write.

The above text is incomplete. It should explain that
dme_qos_notification is a bitfield, what the meaning of the bits in this
bitfield are, when this bitfield is updated, that the only value that
can be written into this bitfield is 0 and also what the effect of
writing 0 into this bitfield is.
Done.

diff --git a/drivers/ufs/core/ufshcd-priv.h b/drivers/ufs/core/ufshcd-priv.h
index 7d6d19361af9..14e8cb145f43 100644
--- a/drivers/ufs/core/ufshcd-priv.h
+++ b/drivers/ufs/core/ufshcd-priv.h
@@ -446,4 +446,10 @@ static inline void ufs_rpmb_remove(struct ufs_hba *hba)
  }
  #endif
  +static inline void sysfs_notify_dirent_safe(struct kernfs_node *sd)
+{
+    if (sd)
+        sysfs_notify_dirent(sd);
+}

This function is very short and is not used outside
drivers/ufs/core/ufshcd.c. Is it really needed to introduce this function? If this function is preserved, please consider moving it into
drivers/ufs/core/ufshcd.c.
Done.

> @@ -11044,6 +11051,8 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
>           goto out_disable;
>
>       ufs_sysfs_add_nodes(hba->dev);
> +    hba->dme_qos_sysfs_handle = sysfs_get_dirent(hba->dev->kobj.sd,
> +                             "dme_qos_notification");
>       async_schedule(ufshcd_async_scan, hba);
>
>       device_enable_async_suspend(dev);

Where is the sysfs_put() call that corresponds to the above sysfs_get_dirent() call?
Good catch, I missed it.. Will add it in next version.

+ * @dme_qos_notification: UFS host controller DME QoS notification

Please explain also here that this is a bitfield and where the meaning
of the bits in this bitfield are defined.
Done.

Thanks,

Bart.