Skip to content

Commit 0818a69

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: ufs: core: Simplify driver shutdown
All UFS host drivers call ufshcd_shutdown(). Hence, instead of calling ufshcd_shutdown() from the host driver .shutdown() callback, inline that function into ufshcd_wl_shutdown(). Reviewed-by: Adrian Hunter <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent b251f6c commit 0818a69

File tree

13 files changed

+5
-53
lines changed

13 files changed

+5
-53
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9950,9 +9950,7 @@ EXPORT_SYMBOL(ufshcd_runtime_resume);
99509950
static void ufshcd_wl_shutdown(struct device *dev)
99519951
{
99529952
struct scsi_device *sdev = to_scsi_device(dev);
9953-
struct ufs_hba *hba;
9954-
9955-
hba = shost_priv(sdev->host);
9953+
struct ufs_hba *hba = shost_priv(sdev->host);
99569954

99579955
down(&hba->host_sem);
99589956
hba->shutting_down = true;
@@ -9967,27 +9965,16 @@ static void ufshcd_wl_shutdown(struct device *dev)
99679965
scsi_device_quiesce(sdev);
99689966
}
99699967
__ufshcd_wl_suspend(hba, UFS_SHUTDOWN_PM);
9970-
}
99719968

9972-
/**
9973-
* ufshcd_shutdown - shutdown routine
9974-
* @hba: per adapter instance
9975-
*
9976-
* This function would turn off both UFS device and UFS hba
9977-
* regulators. It would also disable clocks.
9978-
*
9979-
* Returns 0 always to allow force shutdown even in case of errors.
9980-
*/
9981-
int ufshcd_shutdown(struct ufs_hba *hba)
9982-
{
9969+
/*
9970+
* Next, turn off the UFS controller and the UFS regulators. Disable
9971+
* clocks.
9972+
*/
99839973
if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba))
99849974
ufshcd_suspend(hba);
99859975

99869976
hba->is_powered = false;
9987-
/* allow force shutdown even in case of errors */
9988-
return 0;
99899977
}
9990-
EXPORT_SYMBOL(ufshcd_shutdown);
99919978

99929979
/**
99939980
* ufshcd_remove - de-allocate SCSI host and host memory space

drivers/ufs/host/cdns-pltfrm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ static const struct dev_pm_ops cdns_ufs_dev_pm_ops = {
328328
static struct platform_driver cdns_ufs_pltfrm_driver = {
329329
.probe = cdns_ufs_pltfrm_probe,
330330
.remove = cdns_ufs_pltfrm_remove,
331-
.shutdown = ufshcd_pltfrm_shutdown,
332331
.driver = {
333332
.name = "cdns-ufshcd",
334333
.pm = &cdns_ufs_dev_pm_ops,

drivers/ufs/host/tc-dwc-g210-pci.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,6 @@ static struct ufs_hba_variant_ops tc_dwc_g210_pci_hba_vops = {
3232
.link_startup_notify = ufshcd_dwc_link_startup_notify,
3333
};
3434

35-
/**
36-
* tc_dwc_g210_pci_shutdown - main function to put the controller in reset state
37-
* @pdev: pointer to PCI device handle
38-
*/
39-
static void tc_dwc_g210_pci_shutdown(struct pci_dev *pdev)
40-
{
41-
ufshcd_shutdown((struct ufs_hba *)pci_get_drvdata(pdev));
42-
}
43-
4435
/**
4536
* tc_dwc_g210_pci_remove - de-allocate PCI/SCSI host and host memory space
4637
* data structure memory
@@ -137,7 +128,6 @@ static struct pci_driver tc_dwc_g210_pci_driver = {
137128
.id_table = tc_dwc_g210_pci_tbl,
138129
.probe = tc_dwc_g210_pci_probe,
139130
.remove = tc_dwc_g210_pci_remove,
140-
.shutdown = tc_dwc_g210_pci_shutdown,
141131
.driver = {
142132
.pm = &tc_dwc_g210_pci_pm_ops
143133
},

drivers/ufs/host/tc-dwc-g210-pltfrm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ static const struct dev_pm_ops tc_dwc_g210_pltfm_pm_ops = {
9292
static struct platform_driver tc_dwc_g210_pltfm_driver = {
9393
.probe = tc_dwc_g210_pltfm_probe,
9494
.remove = tc_dwc_g210_pltfm_remove,
95-
.shutdown = ufshcd_pltfrm_shutdown,
9695
.driver = {
9796
.name = "tc-dwc-g210-pltfm",
9897
.pm = &tc_dwc_g210_pltfm_pm_ops,

drivers/ufs/host/ufs-exynos.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1757,7 +1757,6 @@ static const struct dev_pm_ops exynos_ufs_pm_ops = {
17571757
static struct platform_driver exynos_ufs_pltform = {
17581758
.probe = exynos_ufs_probe,
17591759
.remove = exynos_ufs_remove,
1760-
.shutdown = ufshcd_pltfrm_shutdown,
17611760
.driver = {
17621761
.name = "exynos-ufshc",
17631762
.pm = &exynos_ufs_pm_ops,

drivers/ufs/host/ufs-hisi.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,6 @@ static const struct dev_pm_ops ufs_hisi_pm_ops = {
593593
static struct platform_driver ufs_hisi_pltform = {
594594
.probe = ufs_hisi_probe,
595595
.remove = ufs_hisi_remove,
596-
.shutdown = ufshcd_pltfrm_shutdown,
597596
.driver = {
598597
.name = "ufshcd-hisi",
599598
.pm = &ufs_hisi_pm_ops,

drivers/ufs/host/ufs-mediatek.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1650,7 +1650,6 @@ static const struct dev_pm_ops ufs_mtk_pm_ops = {
16501650
static struct platform_driver ufs_mtk_pltform = {
16511651
.probe = ufs_mtk_probe,
16521652
.remove = ufs_mtk_remove,
1653-
.shutdown = ufshcd_pltfrm_shutdown,
16541653
.driver = {
16551654
.name = "ufshcd-mtk",
16561655
.pm = &ufs_mtk_pm_ops,

drivers/ufs/host/ufs-qcom.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1723,7 +1723,6 @@ static const struct dev_pm_ops ufs_qcom_pm_ops = {
17231723
static struct platform_driver ufs_qcom_pltform = {
17241724
.probe = ufs_qcom_probe,
17251725
.remove = ufs_qcom_remove,
1726-
.shutdown = ufshcd_pltfrm_shutdown,
17271726
.driver = {
17281727
.name = "ufshcd-qcom",
17291728
.pm = &ufs_qcom_pm_ops,

drivers/ufs/host/ufs-sprd.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,6 @@ static const struct dev_pm_ops ufs_sprd_pm_ops = {
444444
static struct platform_driver ufs_sprd_pltform = {
445445
.probe = ufs_sprd_probe,
446446
.remove = ufs_sprd_remove,
447-
.shutdown = ufshcd_pltfrm_shutdown,
448447
.driver = {
449448
.name = "ufshcd-sprd",
450449
.pm = &ufs_sprd_pm_ops,

drivers/ufs/host/ufshcd-pci.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -504,15 +504,6 @@ static int ufshcd_pci_restore(struct device *dev)
504504
}
505505
#endif
506506

507-
/**
508-
* ufshcd_pci_shutdown - main function to put the controller in reset state
509-
* @pdev: pointer to PCI device handle
510-
*/
511-
static void ufshcd_pci_shutdown(struct pci_dev *pdev)
512-
{
513-
ufshcd_shutdown((struct ufs_hba *)pci_get_drvdata(pdev));
514-
}
515-
516507
/**
517508
* ufshcd_pci_remove - de-allocate PCI/SCSI host and host memory space
518509
* data structure memory
@@ -618,7 +609,6 @@ static struct pci_driver ufshcd_pci_driver = {
618609
.id_table = ufshcd_pci_tbl,
619610
.probe = ufshcd_pci_probe,
620611
.remove = ufshcd_pci_remove,
621-
.shutdown = ufshcd_pci_shutdown,
622612
.driver = {
623613
.pm = &ufshcd_pci_pm_ops
624614
},

0 commit comments

Comments
 (0)