summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRam Kumar Dwivedi <ram.dwivedi@oss.qualcomm.com>2026-01-13 13:30:45 +0530
committerMartin K. Petersen <martin.petersen@oracle.com>2026-01-23 22:04:32 -0500
commit26c06d0baeb7999e44cf6717fc12d58a359eba99 (patch)
treebd1023496c70ae56fd09a5e5fe2f4f41128e9199 /drivers
parente2725ed2a7fb5f5f468020a52bd9ffc54caa7c8c (diff)
scsi: ufs: core: Enforce minimum PM level for sysfs configuration
Some UFS platforms only support a limited subset of power levels. Currently, the sysfs interface allows users to set any PM level without validating the minimum supported value. If an unsupported level is selected, suspend may fail. Introduce an pm_lvl_min field in the ufs_hba structure and use it to clamp the PM level requested via sysfs so that only supported levels are accepted. Platforms that require a minimum PM level can set this field during probe. Signed-off-by: Ram Kumar Dwivedi <ram.dwivedi@oss.qualcomm.com> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Link: https://patch.msgid.link/20260113080046.284089-4-ram.dwivedi@oss.qualcomm.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ufs/core/ufs-sysfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/ufs/core/ufs-sysfs.c b/drivers/ufs/core/ufs-sysfs.c
index b33f8656edb5..02e5468ad49d 100644
--- a/drivers/ufs/core/ufs-sysfs.c
+++ b/drivers/ufs/core/ufs-sysfs.c
@@ -141,7 +141,7 @@ static inline ssize_t ufs_sysfs_pm_lvl_store(struct device *dev,
if (kstrtoul(buf, 0, &value))
return -EINVAL;
- if (value >= UFS_PM_LVL_MAX)
+ if (value >= UFS_PM_LVL_MAX || value < hba->pm_lvl_min)
return -EINVAL;
if (ufs_pm_lvl_states[value].dev_state == UFS_DEEPSLEEP_PWR_MODE &&