2020-05-08 02:25:21

by Stanley Chu

[permalink] [raw]
Subject: [PATCH v7 3/8] scsi: ufs: export ufs_fixup_device_setup() function

Export ufs_fixup_device_setup() to allow vendors to re-use it for
fixing device quriks on specified UFS hosts.

Signed-off-by: Stanley Chu <[email protected]>
Reviewed-by: Avri Altman <[email protected]>
---
drivers/scsi/ufs/ufshcd.c | 7 ++++---
drivers/scsi/ufs/ufshcd.h | 1 +
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 8d86d9a6a622..663ae842ea9a 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6838,12 +6838,12 @@ static void ufshcd_wb_probe(struct ufs_hba *hba, u8 *desc_buf)
hba->caps &= ~UFSHCD_CAP_WB_EN;
}

-static void ufshcd_fixup_dev_quirks(struct ufs_hba *hba)
+void ufshcd_fixup_dev_quirks(struct ufs_hba *hba, struct ufs_dev_fix *fixups)
{
struct ufs_dev_fix *f;
struct ufs_dev_info *dev_info = &hba->dev_info;

- for (f = ufs_fixups; f->quirk; f++) {
+ for (f = fixups; f->quirk; f++) {
if ((f->wmanufacturerid == dev_info->wmanufacturerid ||
f->wmanufacturerid == UFS_ANY_VENDOR) &&
((dev_info->model &&
@@ -6852,11 +6852,12 @@ static void ufshcd_fixup_dev_quirks(struct ufs_hba *hba)
hba->dev_quirks |= f->quirk;
}
}
+EXPORT_SYMBOL_GPL(ufshcd_fixup_dev_quirks);

static void ufs_fixup_device_setup(struct ufs_hba *hba)
{
/* fix by general quirk table */
- ufshcd_fixup_dev_quirks(hba);
+ ufshcd_fixup_dev_quirks(hba, ufs_fixups);

/* allow vendors to fix quirks */
ufshcd_vops_fixup_dev_quirks(hba);
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 897338ba67aa..4d296acadd6f 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -952,6 +952,7 @@ int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode,

void ufshcd_auto_hibern8_enable(struct ufs_hba *hba);
void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit);
+void ufshcd_fixup_dev_quirks(struct ufs_hba *hba, struct ufs_dev_fix *fixups);
#define SD_ASCII_STD true
#define SD_RAW false
int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index,
--
2.18.0


2020-05-08 07:46:00

by Avri Altman

[permalink] [raw]
Subject: RE: [PATCH v7 3/8] scsi: ufs: export ufs_fixup_device_setup() function


>
> -static void ufshcd_fixup_dev_quirks(struct ufs_hba *hba)
> +void ufshcd_fixup_dev_quirks(struct ufs_hba *hba, struct ufs_dev_fix
> *fixups)
> {
> struct ufs_dev_fix *f;
> struct ufs_dev_info *dev_info = &hba->dev_info;
Now that you are exporting it, maybe return if (!fixups)?

2020-05-08 07:48:50

by Stanley Chu

[permalink] [raw]
Subject: RE: [PATCH v7 3/8] scsi: ufs: export ufs_fixup_device_setup() function

Hi Avri,

On Fri, 2020-05-08 at 07:42 +0000, Avri Altman wrote:
> >
> > -static void ufshcd_fixup_dev_quirks(struct ufs_hba *hba)
> > +void ufshcd_fixup_dev_quirks(struct ufs_hba *hba, struct ufs_dev_fix
> > *fixups)
> > {
> > struct ufs_dev_fix *f;
> > struct ufs_dev_info *dev_info = &hba->dev_info;
> Now that you are exporting it, maybe return if (!fixups)?
>

Good idea, I will add it in next version.

Thanks,
Stanley Chu