[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9861ce52-8163-40aa-b156-dd656143a73d@acm.org>
Date: Mon, 18 Dec 2023 13:55:51 -0800
From: Bart Van Assche <bvanassche@....org>
To: Maramaina Naresh <quic_mnaresh@...cinc.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Peter Wang <peter.wang@...iatek.com>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
Cc: Alim Akhtar <alim.akhtar@...sung.com>, Avri Altman <avri.altman@....com>,
Stanley Jhu <chu.stanley@...il.com>, linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mediatek@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, quic_cang@...cinc.com,
quic_nguyenb@...cinc.com
Subject: Re: [PATCH V5 1/2] ufs: core: Add CPU latency QoS support for ufs
driver
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.
Powered by blists - more mailing lists