ANDROID: scsi: ufs: replace fill_prdt with Android vendor hook

Like was done for the other non-upstream methods in
'struct ufs_hba_variant_ops', replace ->fill_prdt() with an Android
vendor hook.  This is considered to be better because it avoids any
conflicts with upstream changes to 'struct ufs_hba_variant_ops'.

Note that as a side effect of this change, fill_prdt is no longer
allowed to sleep.  That's fine for the only known use of this hook.

Bug: 162257402
Bug: 181359082
Change-Id: I8096932525c27b969193d769aff511a0114b35ad
Signed-off-by: Eric Biggers <ebiggers@google.com>
This commit is contained in:
Eric Biggers 2021-03-01 15:30:14 -08:00
parent ff882f5e56
commit 828de9bf79
4 changed files with 11 additions and 15 deletions

View File

@ -109,6 +109,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ftrace_oops_exit);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ftrace_size_check);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ftrace_format_check);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ftrace_dump_buffer);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_fill_prdt);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_prepare_command);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_update_sysfs);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_send_command);

View File

@ -2256,6 +2256,7 @@ static int ufshcd_map_sg(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
struct scsi_cmnd *cmd;
int sg_segments;
int i;
int err;
cmd = lrbp->cmd;
sg_segments = scsi_dma_map(cmd);
@ -2287,7 +2288,9 @@ static int ufshcd_map_sg(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
lrbp->utr_descriptor_ptr->prd_table_length = 0;
}
return ufshcd_vops_fill_prdt(hba, lrbp, sg_segments);
err = 0;
trace_android_vh_ufs_fill_prdt(hba, lrbp, sg_segments, &err);
return err;
}
/**

View File

@ -324,8 +324,6 @@ struct ufs_pwr_mode_info {
* @device_reset: called to issue a reset pulse on the UFS device
* @program_key: program or evict an inline encryption key
* @event_notify: called to notify important events
* @fill_prdt: called after initializing the standard PRDT fields so that any
* variant-specific PRDT fields can be initialized too
*/
struct ufs_hba_variant_ops {
const char *name;
@ -362,8 +360,6 @@ struct ufs_hba_variant_ops {
const union ufs_crypto_cfg_entry *cfg, int slot);
void (*event_notify)(struct ufs_hba *hba,
enum ufs_event_type evt, void *data);
int (*fill_prdt)(struct ufs_hba *hba, struct ufshcd_lrb *lrbp,
unsigned int segments);
};
/* clock gating state */
@ -1268,16 +1264,6 @@ static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba,
hba->vops->config_scaling_param(hba, profile, data);
}
static inline int ufshcd_vops_fill_prdt(struct ufs_hba *hba,
struct ufshcd_lrb *lrbp,
unsigned int segments)
{
if (hba->vops && hba->vops->fill_prdt)
return hba->vops->fill_prdt(hba, lrbp, segments);
return 0;
}
extern struct ufs_pm_lvl_states ufs_pm_lvl_states[];
/*

View File

@ -13,6 +13,12 @@
struct ufs_hba;
struct request;
struct ufshcd_lrb;
DECLARE_HOOK(android_vh_ufs_fill_prdt,
TP_PROTO(struct ufs_hba *hba, struct ufshcd_lrb *lrbp,
unsigned int segments, int *err),
TP_ARGS(hba, lrbp, segments, err));
DECLARE_HOOK(android_vh_ufs_prepare_command,
TP_PROTO(struct ufs_hba *hba, struct request *rq,
struct ufshcd_lrb *lrbp, int *err),