]> git.baikalelectronics.ru Git - kernel.git/commitdiff
scsi: ufs: Make the config_scaling_param calls type safe
authorBart Van Assche <bvanassche@acm.org>
Tue, 19 Apr 2022 22:57:57 +0000 (15:57 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 26 Apr 2022 03:23:03 +0000 (23:23 -0400)
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: Bean Huo <beanhuo@micron.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufs-qcom.c
drivers/scsi/ufs/ufshcd.h

index 46b24b926860d630328c62149b13d71e841d134f..851caef04a602fb7648b0da0f38d3c1a5b195e86 100644 (file)
@@ -1448,23 +1448,17 @@ 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_dev_profile *p,
+                                       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;
 }
 #else
 static void ufs_qcom_config_scaling_param(struct ufs_hba *hba,
-                                         struct devfreq_dev_profile *p,
-                                         void *data)
+               struct devfreq_dev_profile *p,
+               struct devfreq_simple_ondemand_data *data)
 {
 }
 #endif
index 37e8b72b8c86fd8eb861411dc029f5d565975efa..a755718649ae00534cd595e5fc9be9a0fa04185e 100644 (file)
@@ -348,8 +348,8 @@ struct ufs_hba_variant_ops {
        int     (*phy_initialization)(struct ufs_hba *);
        int     (*device_reset)(struct ufs_hba *hba);
        void    (*config_scaling_param)(struct ufs_hba *hba,
-                                       struct devfreq_dev_profile *profile,
-                                       void *data);
+                               struct devfreq_dev_profile *profile,
+                               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[];