scsi: ufs: Use the resource-managed function to add devfreq device
authorChanwoo Choi <[email protected]>
Tue, 8 Nov 2016 09:13:28 +0000 (18:13 +0900)
committerMartin K. Petersen <[email protected]>
Wed, 9 Nov 2016 00:16:34 +0000 (19:16 -0500)
This patch uses the resource-managed to add the devfreq device.  This
function will make it easy to handle the devfreq device.

- struct devfreq *devm_devfreq_add_device(struct device *dev,
  struct devfreq_dev_profile *profile,
  const char *governor_name,
  void *data);
Cc: Vinayak Holikatti <[email protected]>
Cc: James E.J. Bottomley <[email protected]>
Cc: Martin K. Petersen <[email protected]>
Cc: [email protected]
Signed-off-by: Chanwoo Choi <[email protected]>
Reviewed-by: Subhash Jadavani <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
drivers/scsi/ufs/ufshcd.c

index 8cf5d8f7683bca92fcd3d8016c48023ec2284cb8..9ca041b131e9853cc648731a077981311c568d66 100644 (file)
@@ -6250,8 +6250,6 @@ void ufshcd_remove(struct ufs_hba *hba)
        ufshcd_hba_stop(hba, true);
 
        ufshcd_exit_clk_gating(hba);
-       if (ufshcd_is_clkscaling_enabled(hba))
-               devfreq_remove_device(hba->devfreq);
        ufshcd_hba_exit(hba);
 }
 EXPORT_SYMBOL_GPL(ufshcd_remove);
@@ -6579,7 +6577,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
        }
 
        if (ufshcd_is_clkscaling_enabled(hba)) {
-               hba->devfreq = devfreq_add_device(dev, &ufs_devfreq_profile,
+               hba->devfreq = devm_devfreq_add_device(dev, &ufs_devfreq_profile,
                                                   "simple_ondemand", NULL);
                if (IS_ERR(hba->devfreq)) {
                        dev_err(hba->dev, "Unable to register with devfreq %ld\n",