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

From: Asutosh Das
Date: Tue Feb 16 2021 - 12:39:14 EST


On Fri, Feb 12 2021 at 19:25 -0800, Bart Van Assche wrote:
On 2/11/21 11:18 AM, Asutosh Das wrote:
+static inline bool is_rpmb_wlun(struct scsi_device *sdev)
+{
+ return (sdev->lun == ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_RPMB_WLUN));
+}
+
+static inline bool is_device_wlun(struct scsi_device *sdev)
+{
+ return (sdev->lun ==
+ ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_UFS_DEVICE_WLUN));
+}

A minor comment: checkpatch should have reported that "return is not a
function" for the above code.

/**
+ * ufshcd_setup_links - associate link b/w device wlun and other luns
+ * @sdev: pointer to SCSI device
+ * @hba: pointer to ufs hba
+ *
+ * Returns void
+ */

Please leave out "Returns void".

+static int ufshcd_wl_suspend(struct device *dev)
+{
+ struct scsi_device *sdev = to_scsi_device(dev);
+ struct ufs_hba *hba;
+ int ret;
+ ktime_t start = ktime_get();
+
+ if (is_rpmb_wlun(sdev))
+ return 0;
+ hba = shost_priv(sdev->host);
+ ret = __ufshcd_wl_suspend(hba, UFS_SYSTEM_PM);
+ if (ret)
+ dev_err(&sdev->sdev_gendev, "%s failed: %d\n", __func__, ret);
+
+ trace_ufshcd_wl_suspend(dev_name(dev), ret,
+ ktime_to_us(ktime_sub(ktime_get(), start)),
+ hba->curr_dev_pwr_mode, hba->uic_link_state);
+
+ return ret;
+
+}

Please remove the blank line after the return statement.

Otherwise this patch looks good to me. Hence:

Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx>


Done.

Thanks,
-asd