Message ID | 20220727071024epcms2p70366b54ac8eca3758b7cf4336e0d457c@epcms2p7 (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | scsi: ufs: wb: Add sysfs attribute and cleanup | expand |
On Wed, 2022-07-27 at 16:10 +0900, Jinyoung CHOI wrote: > The explicit flushing should check the following. > - UFSHCD_CAP_WB_EN > - UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL > > Changed to improve readability. > > Reviewed-by: Avri Altman <avri.altman@wdc.com> > Signed-off-by: Jinyoung Choi <j-young.choi@samsung.com> Acked-by: Bean Huo <beanhuo@micron.com>
On 7/27/22 00:10, Jinyoung CHOI wrote: > diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h > index 94bcfec98fb8..78adc556444a 100644 > --- a/include/ufs/ufshcd.h > +++ b/include/ufs/ufshcd.h > @@ -1017,6 +1017,12 @@ static inline bool ufshcd_is_wb_allowed(struct ufs_hba *hba) > return hba->caps & UFSHCD_CAP_WB_EN; > } > > +static inline bool ufshcd_is_wb_buf_flush_allowed(struct ufs_hba *hba) > +{ > + return ufshcd_is_wb_allowed(hba) && > + !(hba->quirks & UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL); > +} Since this function is only used inside the UFS driver core it should be added in drivers/ufs/core/ufshcd-priv.h instead of include/ufs/ufshcd.h. Thanks, Bart.
>On 7/27/22 00:10, Jinyoung CHOI wrote: >> diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h >> index 94bcfec98fb8..78adc556444a 100644 >> --- a/include/ufs/ufshcd.h >> +++ b/include/ufs/ufshcd.h >> @@ -1017,6 +1017,12 @@ static inline bool ufshcd_is_wb_allowed(struct ufs_hba *hba) >> return hba->caps & UFSHCD_CAP_WB_EN; >> } >> >> +static inline bool ufshcd_is_wb_buf_flush_allowed(struct ufs_hba *hba) >> +{ >> + return ufshcd_is_wb_allowed(hba) && >> + !(hba->quirks & UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL); >> +} > >Since this function is only used inside the UFS driver core it should be >added in drivers/ufs/core/ufshcd-priv.h instead of include/ufs/ufshcd.h. > >Thanks, > >Bart. OK, I will move it. I didn't know the exact purpose of ufshcd-priv.h. Thank you for telling me. Thanks, Jinyoung.
diff --git a/drivers/ufs/core/ufs-sysfs.c b/drivers/ufs/core/ufs-sysfs.c index e7800e49998a..63b02b2541c8 100644 --- a/drivers/ufs/core/ufs-sysfs.c +++ b/drivers/ufs/core/ufs-sysfs.c @@ -271,8 +271,7 @@ static ssize_t wb_buf_flush_en_store(struct device *dev, unsigned int wb_buf_flush_en; ssize_t res; - if (ufshcd_is_wb_allowed(hba) && - !(hba->quirks & UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL)) { + if (!ufshcd_is_wb_buf_flush_allowed(hba)) { dev_warn(dev, "It is not allowed to configure WB buf flush!\n"); return -EOPNOTSUPP; } diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index a8a797e0033d..17a14b046c44 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -294,7 +294,8 @@ static void ufshcd_wb_set_default_flags(struct ufs_hba *hba) ufshcd_wb_toggle(hba, true); ufshcd_wb_toggle_buf_flush_during_h8(hba, true); - if (!(hba->quirks & UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL)) + + if (ufshcd_is_wb_buf_flush_allowed(hba)) ufshcd_wb_toggle_buf_flush(hba, true); } @@ -5816,7 +5817,7 @@ static bool ufshcd_wb_presrv_usrspc_keep_vcc_on(struct ufs_hba *hba, static void ufshcd_wb_force_disable(struct ufs_hba *hba) { - if (!(hba->quirks & UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL)) + if (ufshcd_is_wb_buf_flush_allowed(hba)) ufshcd_wb_toggle_buf_flush(hba, false); ufshcd_wb_toggle_buf_flush_during_h8(hba, false); diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index 94bcfec98fb8..78adc556444a 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -1017,6 +1017,12 @@ static inline bool ufshcd_is_wb_allowed(struct ufs_hba *hba) return hba->caps & UFSHCD_CAP_WB_EN; } +static inline bool ufshcd_is_wb_buf_flush_allowed(struct ufs_hba *hba) +{ + return ufshcd_is_wb_allowed(hba) && + !(hba->quirks & UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL); +} + #define ufshcd_writel(hba, val, reg) \ writel((val), (hba)->mmio_base + (reg)) #define ufshcd_readl(hba, reg) \