lkml.org 
[lkml]   [2023]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH V5 1/2] ufs: core: Add CPU latency QoS support for ufs driver
From
On 12/13/23 04:43, Maramaina Naresh wrote:
> +static ssize_t ufshcd_pm_qos_enable_store(struct device *dev,
> + struct device_attribute *attr, const char *buf, size_t count)
> +{
> + struct ufs_hba *hba = dev_get_drvdata(dev);
> + u32 value;
> +
> + if (kstrtou32(buf, 0, &value))
> + return -EINVAL;
> +
> + value = !!value;
> + if (value)
> + ufshcd_pm_qos_init(hba);
> + else
> + ufshcd_pm_qos_exit(hba);
> +
> + return count;
> +}

Please use kstrtobool() instead of kstrtou32().

> +static void ufshcd_init_pm_qos_sysfs(struct ufs_hba *hba)
> +{
> + hba->pm_qos_enable_attr.show = ufshcd_pm_qos_enable_show;
> + hba->pm_qos_enable_attr.store = ufshcd_pm_qos_enable_store;
> + sysfs_attr_init(&hba->pm_qos_enable_attr.attr);
> + hba->pm_qos_enable_attr.attr.name = "pm_qos_enable";
> + hba->pm_qos_enable_attr.attr.mode = 0644;
> + if (device_create_file(hba->dev, &hba->pm_qos_enable_attr))
> + dev_err(hba->dev, "Failed to create sysfs for pm_qos_enable\n");
> +}

Calling device_create_file() and device_remove_file() is not acceptable because of
the race conditions these calls introduce for udev rules. Please add this attribute
into an existing group and update the is_visible callback function of that group.
See also ufs_sysfs_groups[].

Thanks,

Bart.

\
 
 \ /
  Last update: 2023-12-18 22:56    [W:1.925 / U:0.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site