scsi: ufs: enable runtime pm only after ufshcd init

Previous code enables runtime pm before ufshcd_init() is completed,
and before the hba struct is stored in the platform device private
data. This means that pm runtime calls will have null hba pointer
as well as partially initialized driver.
Instead, enable pm runtime only after ufshcd_init() is done and
after hba struct is stored in the platform device private data.

Change-Id: I8225736916a9eda3d9f58d2b0e2566065766b914
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
This commit is contained in:
Gilad Broner 2015-02-03 11:31:35 +02:00 committed by David Keitel
parent 413d97dd2a
commit da7f098c89

View file

@ -378,8 +378,6 @@ int ufshcd_pltfrm_init(struct platform_device *pdev,
ufshcd_parse_pm_qos(hba, irq);
ufshcd_parse_pm_levels(hba);
pm_runtime_set_active(&pdev->dev);
pm_runtime_enable(&pdev->dev);
if (!dev->dma_mask)
dev->dma_mask = &dev->coherent_dma_mask;
@ -387,16 +385,15 @@ int ufshcd_pltfrm_init(struct platform_device *pdev,
err = ufshcd_init(hba, mmio_base, irq);
if (err) {
dev_err(dev, "Intialization failed\n");
goto out_disable_rpm;
goto dealloc_host;
}
platform_set_drvdata(pdev, hba);
return 0;
pm_runtime_set_active(&pdev->dev);
pm_runtime_enable(&pdev->dev);
out_disable_rpm:
pm_runtime_disable(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);
return 0;
dealloc_host:
ufshcd_dealloc_host(hba);
out: