Commit c906e832 authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen
Browse files

scsi: ufs: Make the config_scaling_param calls type safe

Pass the actual type to config_scaling_param callback as the third argment
instead of a void pointer. Remove a superfluous NULL pointer check from
ufs_qcom_config_scaling_param().

Link: https://lore.kernel.org/r/20220419225811.4127248-15-bvanassche@acm.org


Tested-by: default avatarBean Huo <beanhuo@micron.com>
Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: default avatarBean Huo <beanhuo@micron.com>
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 778d2b0e
Loading
Loading
Loading
Loading
+4 −10
Original line number Diff line number Diff line
@@ -1449,14 +1449,8 @@ static int ufs_qcom_device_reset(struct ufs_hba *hba)
#if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND)
static void ufs_qcom_config_scaling_param(struct ufs_hba *hba,
					struct devfreq_dev_profile *p,
					  void *data)
					struct devfreq_simple_ondemand_data *d)
{
	static struct devfreq_simple_ondemand_data *d;

	if (!data)
		return;

	d = (struct devfreq_simple_ondemand_data *)data;
	p->polling_ms = 60;
	d->upthreshold = 70;
	d->downdifferential = 5;
@@ -1464,7 +1458,7 @@ static void ufs_qcom_config_scaling_param(struct ufs_hba *hba,
#else
static void ufs_qcom_config_scaling_param(struct ufs_hba *hba,
		struct devfreq_dev_profile *p,
					  void *data)
		struct devfreq_simple_ondemand_data *data)
{
}
#endif
+5 −5
Original line number Diff line number Diff line
@@ -349,7 +349,7 @@ struct ufs_hba_variant_ops {
	int	(*device_reset)(struct ufs_hba *hba);
	void	(*config_scaling_param)(struct ufs_hba *hba,
				struct devfreq_dev_profile *profile,
					void *data);
				struct devfreq_simple_ondemand_data *data);
	int	(*program_key)(struct ufs_hba *hba,
			       const union ufs_crypto_cfg_entry *cfg, int slot);
	void	(*event_notify)(struct ufs_hba *hba,
@@ -1358,11 +1358,11 @@ static inline int ufshcd_vops_device_reset(struct ufs_hba *hba)
}

static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba,
						    struct devfreq_dev_profile
						    *profile, void *data)
		struct devfreq_dev_profile *p,
		struct devfreq_simple_ondemand_data *data)
{
	if (hba->vops && hba->vops->config_scaling_param)
		hba->vops->config_scaling_param(hba, profile, data);
		hba->vops->config_scaling_param(hba, p, data);
}

extern struct ufs_pm_lvl_states ufs_pm_lvl_states[];