diff mbox series

[v4,2/3] scsi: ufs: Introduce ufshcd_is_auto_hibern8_supported()

Message ID 1558361445-30994-3-git-send-email-stanley.chu@mediatek.com (mailing list archive)
State New, archived
Headers show
Series scsi: ufs: Add error handling of Auto-Hibernate | expand

Commit Message

Stanley Chu May 20, 2019, 2:10 p.m. UTC
ufshcd_is_auto_hibern8_supported() will be used elsewhere
in the driver, thus refactor it for preparation.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
---
 drivers/scsi/ufs/ufshcd.c | 2 +-
 drivers/scsi/ufs/ufshcd.h | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

Comments

Avri Altman May 21, 2019, 6:18 a.m. UTC | #1
> 
> ufshcd_is_auto_hibern8_supported() will be used elsewhere
> in the driver, thus refactor it for preparation.
You missed a couple of spots, e.g. in ufshcd_auto_hibern8_enable and in ufs-sysfs.

Thanks,
Avri
Stanley Chu May 21, 2019, 6:29 a.m. UTC | #2
Hi Avri,

On Tue, 2019-05-21 at 06:18 +0000, Avri Altman wrote:
> > 
> > ufshcd_is_auto_hibern8_supported() will be used elsewhere
> > in the driver, thus refactor it for preparation.
> You missed a couple of spots, e.g. in ufshcd_auto_hibern8_enable and in ufs-sysfs.

Yes...
Will re-factor them as well in next version.

> 
> Thanks,
> Avri

Thanks,
Stanley
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index ba04d07df279..c904625d9905 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -8312,7 +8312,7 @@  int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
 						UIC_LINK_HIBERN8_STATE);
 
 	/* Set the default auto-hiberate idle timer value to 150 ms */
-	if ((hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT) && !hba->ahit) {
+	if (ufshcd_is_auto_hibern8_supported(hba) && !hba->ahit) {
 		hba->ahit = FIELD_PREP(UFSHCI_AHIBERN8_TIMER_MASK, 150) |
 			    FIELD_PREP(UFSHCI_AHIBERN8_SCALE_MASK, 3);
 	}
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index ecfa898b9ccc..994d73d03207 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -740,6 +740,11 @@  return true;
 #endif
 }
 
+static inline bool ufshcd_is_auto_hibern8_supported(struct ufs_hba *hba)
+{
+	return (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT);
+}
+
 #define ufshcd_writel(hba, val, reg)	\
 	writel((val), (hba)->mmio_base + (reg))
 #define ufshcd_readl(hba, reg)	\