RE: [RFC PATCH v3 1/1] scsi: ufs: Enable power management for wlun

From: Avri Altman
Date: Sat Feb 13 2021 - 16:46:28 EST


> + } else {
Is it possible to get here?
Scsi_scan_host is called only after successful add_wluns

> + /* device wlun is probed */
> + hba->luns_avail--;
> + }
> +}
> +


>
> /**
> @@ -7254,6 +7312,14 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba
> *hba)
> goto out;
> }
> ufshcd_blk_pm_runtime_init(hba->sdev_ufs_device);
> + /*
> + * A pm_runtime_put_sync is invoked when this device enables
> blk_pm_runtime
> + * & would suspend the device-wlun upon timer expiry.
> + * But suspending device wlun _may_ put the ufs device in the pre-defined
> + * low power mode (SSU <rpm_lvl>). Probing of other luns may fail then.
> + * Don't allow this suspend until all the luns have been probed.
Maybe add one more sentence: see pm_runtime_mark_last_busy in ufshcd_setup_links



> - ufshcd_clear_ua_wluns(hba);
Are there any callers left to ufshcd_clear_ua_wluns?
Can it be removed?

> + if (hba->wlun_dev_clr_ua)
> + ufshcd_clear_ua_wlun(hba, UFS_UPIU_UFS_DEVICE_WLUN);
>
> cmd[4] = pwr_mode << 4;