diff mbox series

[v5,2/8] scsi: ufs: introduce fixup_dev_quirks vops

Message ID 20200503113415.21034-3-stanley.chu@mediatek.com (mailing list archive)
State New, archived
Headers show
Series scsi: ufs: support LU Dedicated buffer mode for WriteBooster | expand

Commit Message

Stanley Chu May 3, 2020, 11:34 a.m. UTC
Some UFS deivces may have required device quirks or have non-standard
features which are enabled only on specified UFS hosts or for special
customers.

To not "pollute" common device quirk list, i.e., ufs_fixups table for
those devices mentioned above, introduce "fixup_dev_quirks" vops to
allow vendors to fix or modify device quirks accordingly.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 drivers/scsi/ufs/ufshcd.c | 1 +
 drivers/scsi/ufs/ufshcd.h | 7 +++++++
 2 files changed, 8 insertions(+)

Comments

Avri Altman May 4, 2020, 10:38 a.m. UTC | #1
> 
>         ufs_fixup_device_setup(hba);
> +       ufshcd_vops_fixup_dev_quirks(hba);
Maybe call your new ufshcd_vops_fixup_dev_quirks as part of ufs_fixup_device_setup.

Thanks,
Avri
Stanley Chu May 4, 2020, 2:41 p.m. UTC | #2
Hi Avri,

On Mon, 2020-05-04 at 10:38 +0000, Avri Altman wrote:
> > 
> >         ufs_fixup_device_setup(hba);
> > +       ufshcd_vops_fixup_dev_quirks(hba);
> Maybe call your new ufshcd_vops_fixup_dev_quirks as part of ufs_fixup_device_setup

The latter patch exports ufs_fixup_device_setup() for vendors to re-use
it to parse vendor-specific device quirk table during the call of
ufshcd_vops_fixup_dev_quirks(), thus ufshcd_vops_fixup_dev_quirks()
cannot be as part of ufs_fixup_device_setup().

Thanks,
Stanley Chu

> .
> 
> Thanks,
> Avri
Stanley Chu May 7, 2020, 11:56 p.m. UTC | #3
Hi Avri,

On Mon, 2020-05-04 at 22:41 +0800, Stanley Chu wrote:
> Hi Avri,
> 
> On Mon, 2020-05-04 at 10:38 +0000, Avri Altman wrote:
> > > 
> > >         ufs_fixup_device_setup(hba);
> > > +       ufshcd_vops_fixup_dev_quirks(hba);
> > Maybe call your new ufshcd_vops_fixup_dev_quirks as part of ufs_fixup_device_setup
> 
> The latter patch exports ufs_fixup_device_setup() for vendors to re-use
> it to parse vendor-specific device quirk table during the call of
> ufshcd_vops_fixup_dev_quirks(), thus ufshcd_vops_fixup_dev_quirks()
> cannot be as part of ufs_fixup_device_setup().

Maybe I could use a new function to contain ufs_fixup_device_setup() and
ufshcd_vops_fixup_dev_quirks() to make the code more clear here.

Thanks,
Stanley Chu
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 04ddfb15e858..da7b375709b6 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6899,6 +6899,7 @@  static int ufs_get_device_desc(struct ufs_hba *hba)
 	}
 
 	ufs_fixup_device_setup(hba);
+	ufshcd_vops_fixup_dev_quirks(hba);
 
 	/*
 	 * Probe WB only for UFS-3.1 devices or UFS devices with quirk
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 056537e52c19..5fa03e0f3bd1 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -336,6 +336,7 @@  struct ufs_hba_variant_ops {
 	void    (*hibern8_notify)(struct ufs_hba *, enum uic_cmd_dme,
 					enum ufs_notify_change_status);
 	int	(*apply_dev_quirks)(struct ufs_hba *hba);
+	void	(*fixup_dev_quirks)(struct ufs_hba *hba);
 	int     (*suspend)(struct ufs_hba *, enum ufs_pm_op);
 	int     (*resume)(struct ufs_hba *, enum ufs_pm_op);
 	void	(*dbg_register_dump)(struct ufs_hba *hba);
@@ -1085,6 +1086,12 @@  static inline int ufshcd_vops_apply_dev_quirks(struct ufs_hba *hba)
 	return 0;
 }
 
+static inline void ufshcd_vops_fixup_dev_quirks(struct ufs_hba *hba)
+{
+	if (hba->vops && hba->vops->fixup_dev_quirks)
+		hba->vops->fixup_dev_quirks(hba);
+}
+
 static inline int ufshcd_vops_suspend(struct ufs_hba *hba, enum ufs_pm_op op)
 {
 	if (hba->vops && hba->vops->suspend)