]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
scsi: ufs: core: Simplify driver shutdown
authorBart Van Assche <bvanassche@acm.org>
Wed, 24 May 2023 20:36:22 +0000 (13:36 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 1 Jun 2023 00:35:01 +0000 (20:35 -0400)
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 <adrian.hunter@intel.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230524203659.1394307-5-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
13 files changed:
drivers/ufs/core/ufshcd.c
drivers/ufs/host/cdns-pltfrm.c
drivers/ufs/host/tc-dwc-g210-pci.c
drivers/ufs/host/tc-dwc-g210-pltfrm.c
drivers/ufs/host/ufs-exynos.c
drivers/ufs/host/ufs-hisi.c
drivers/ufs/host/ufs-mediatek.c
drivers/ufs/host/ufs-qcom.c
drivers/ufs/host/ufs-sprd.c
drivers/ufs/host/ufshcd-pci.c
drivers/ufs/host/ufshcd-pltfrm.c
drivers/ufs/host/ufshcd-pltfrm.h
include/ufs/ufshcd.h

index f84af598af3367ffb9deec5ce06f04892adf9b1b..00f730671f4b8c01814abd7a5e8f740bc63e01be 100644 (file)
@@ -9950,9 +9950,7 @@ EXPORT_SYMBOL(ufshcd_runtime_resume);
 static void ufshcd_wl_shutdown(struct device *dev)
 {
        struct scsi_device *sdev = to_scsi_device(dev);
-       struct ufs_hba *hba;
-
-       hba = shost_priv(sdev->host);
+       struct ufs_hba *hba = shost_priv(sdev->host);
 
        down(&hba->host_sem);
        hba->shutting_down = true;
@@ -9967,27 +9965,16 @@ static void ufshcd_wl_shutdown(struct device *dev)
                scsi_device_quiesce(sdev);
        }
        __ufshcd_wl_suspend(hba, UFS_SHUTDOWN_PM);
-}
 
-/**
- * ufshcd_shutdown - shutdown routine
- * @hba: per adapter instance
- *
- * This function would turn off both UFS device and UFS hba
- * regulators. It would also disable clocks.
- *
- * Returns 0 always to allow force shutdown even in case of errors.
- */
-int ufshcd_shutdown(struct ufs_hba *hba)
-{
+       /*
+        * Next, turn off the UFS controller and the UFS regulators. Disable
+        * clocks.
+        */
        if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba))
                ufshcd_suspend(hba);
 
        hba->is_powered = false;
-       /* allow force shutdown even in case of errors */
-       return 0;
 }
-EXPORT_SYMBOL(ufshcd_shutdown);
 
 /**
  * ufshcd_remove - de-allocate SCSI host and host memory space
index e05c0ae64eea47e8e1fea3d9aea01b0086acbbf0..26761425a76cae0160424332cc5e621fe64efe70 100644 (file)
@@ -328,7 +328,6 @@ static const struct dev_pm_ops cdns_ufs_dev_pm_ops = {
 static struct platform_driver cdns_ufs_pltfrm_driver = {
        .probe  = cdns_ufs_pltfrm_probe,
        .remove = cdns_ufs_pltfrm_remove,
-       .shutdown = ufshcd_pltfrm_shutdown,
        .driver = {
                .name   = "cdns-ufshcd",
                .pm     = &cdns_ufs_dev_pm_ops,
index 92b8ad4b58febe1bf5289ad4eb31846dc6e71880..f96fe58558417e35810c8ffb8acd1a851932d4cf 100644 (file)
@@ -32,15 +32,6 @@ static struct ufs_hba_variant_ops tc_dwc_g210_pci_hba_vops = {
        .link_startup_notify    = ufshcd_dwc_link_startup_notify,
 };
 
-/**
- * tc_dwc_g210_pci_shutdown - main function to put the controller in reset state
- * @pdev: pointer to PCI device handle
- */
-static void tc_dwc_g210_pci_shutdown(struct pci_dev *pdev)
-{
-       ufshcd_shutdown((struct ufs_hba *)pci_get_drvdata(pdev));
-}
-
 /**
  * tc_dwc_g210_pci_remove - de-allocate PCI/SCSI host and host memory space
  *             data structure memory
@@ -137,7 +128,6 @@ static struct pci_driver tc_dwc_g210_pci_driver = {
        .id_table = tc_dwc_g210_pci_tbl,
        .probe = tc_dwc_g210_pci_probe,
        .remove = tc_dwc_g210_pci_remove,
-       .shutdown = tc_dwc_g210_pci_shutdown,
        .driver = {
                .pm = &tc_dwc_g210_pci_pm_ops
        },
index f15a84d0c176b6edd564de450e7f34a3d0f93ca7..4d5389dd958579e9b9eea44f3478d40942e224e3 100644 (file)
@@ -92,7 +92,6 @@ static const struct dev_pm_ops tc_dwc_g210_pltfm_pm_ops = {
 static struct platform_driver tc_dwc_g210_pltfm_driver = {
        .probe          = tc_dwc_g210_pltfm_probe,
        .remove         = tc_dwc_g210_pltfm_remove,
-       .shutdown = ufshcd_pltfrm_shutdown,
        .driver         = {
                .name   = "tc-dwc-g210-pltfm",
                .pm     = &tc_dwc_g210_pltfm_pm_ops,
index 0bf5390739e1f0200d4b1b8609c86082a0470cc4..f41056f57fd7df93cb577d28615e002fe24b2422 100644 (file)
@@ -1757,7 +1757,6 @@ static const struct dev_pm_ops exynos_ufs_pm_ops = {
 static struct platform_driver exynos_ufs_pltform = {
        .probe  = exynos_ufs_probe,
        .remove = exynos_ufs_remove,
-       .shutdown = ufshcd_pltfrm_shutdown,
        .driver = {
                .name   = "exynos-ufshc",
                .pm     = &exynos_ufs_pm_ops,
index 4c423eba8aa929ec5fd8c156e1862ef68277da76..18b72e2e68c172a6374b11bf3c8e56cc9a4d8053 100644 (file)
@@ -593,7 +593,6 @@ static const struct dev_pm_ops ufs_hisi_pm_ops = {
 static struct platform_driver ufs_hisi_pltform = {
        .probe  = ufs_hisi_probe,
        .remove = ufs_hisi_remove,
-       .shutdown = ufshcd_pltfrm_shutdown,
        .driver = {
                .name   = "ufshcd-hisi",
                .pm     = &ufs_hisi_pm_ops,
index 73e217260390ef5fa75002b1a9d0ba068e2779b2..e89b625d3c5a100163c7cff479057d8fc51e1576 100644 (file)
@@ -1650,7 +1650,6 @@ static const struct dev_pm_ops ufs_mtk_pm_ops = {
 static struct platform_driver ufs_mtk_pltform = {
        .probe      = ufs_mtk_probe,
        .remove     = ufs_mtk_remove,
-       .shutdown   = ufshcd_pltfrm_shutdown,
        .driver = {
                .name   = "ufshcd-mtk",
                .pm     = &ufs_mtk_pm_ops,
index 82d02e7f3b4f31cf48656d90aa98bd628b320146..059de74dfea3b5b91d1923619c3708482998da57 100644 (file)
@@ -1723,7 +1723,6 @@ static const struct dev_pm_ops ufs_qcom_pm_ops = {
 static struct platform_driver ufs_qcom_pltform = {
        .probe  = ufs_qcom_probe,
        .remove = ufs_qcom_remove,
-       .shutdown = ufshcd_pltfrm_shutdown,
        .driver = {
                .name   = "ufshcd-qcom",
                .pm     = &ufs_qcom_pm_ops,
index 051f3f40d92cd8f8f1544355e2251ab53cad7b6b..2bad75dd6d5894fd6928472a592e94154c0189b7 100644 (file)
@@ -444,7 +444,6 @@ static const struct dev_pm_ops ufs_sprd_pm_ops = {
 static struct platform_driver ufs_sprd_pltform = {
        .probe = ufs_sprd_probe,
        .remove = ufs_sprd_remove,
-       .shutdown = ufshcd_pltfrm_shutdown,
        .driver = {
                .name = "ufshcd-sprd",
                .pm = &ufs_sprd_pm_ops,
index 9c911787f84c6fb4b9e318dde7d113098b4b4f1f..38276dac8e525fb0d993817ab9bffa4e13f98efb 100644 (file)
@@ -504,15 +504,6 @@ static int ufshcd_pci_restore(struct device *dev)
 }
 #endif
 
-/**
- * ufshcd_pci_shutdown - main function to put the controller in reset state
- * @pdev: pointer to PCI device handle
- */
-static void ufshcd_pci_shutdown(struct pci_dev *pdev)
-{
-       ufshcd_shutdown((struct ufs_hba *)pci_get_drvdata(pdev));
-}
-
 /**
  * ufshcd_pci_remove - de-allocate PCI/SCSI host and host memory space
  *             data structure memory
@@ -618,7 +609,6 @@ static struct pci_driver ufshcd_pci_driver = {
        .id_table = ufshcd_pci_tbl,
        .probe = ufshcd_pci_probe,
        .remove = ufshcd_pci_remove,
-       .shutdown = ufshcd_pci_shutdown,
        .driver = {
                .pm = &ufshcd_pci_pm_ops
        },
index 5739ff0078287bc6c3ce15fb23219cb7b4398a10..0b7430033047d4ce3afc5b0ccb4fabb627668108 100644 (file)
@@ -190,12 +190,6 @@ out:
        return err;
 }
 
-void ufshcd_pltfrm_shutdown(struct platform_device *pdev)
-{
-       ufshcd_shutdown((struct ufs_hba *)platform_get_drvdata(pdev));
-}
-EXPORT_SYMBOL_GPL(ufshcd_pltfrm_shutdown);
-
 static void ufshcd_init_lanes_per_dir(struct ufs_hba *hba)
 {
        struct device *dev = hba->dev;
index 2e4ba2bfbcada0ba15e740a7d968731c6c76f3a7..2df108f4ac131904b8230a8250f5996a1c041cdc 100644 (file)
@@ -31,7 +31,6 @@ int ufshcd_get_pwr_dev_param(const struct ufs_dev_params *dev_param,
 void ufshcd_init_pwr_dev_param(struct ufs_dev_params *dev_param);
 int ufshcd_pltfrm_init(struct platform_device *pdev,
                       const struct ufs_hba_variant_ops *vops);
-void ufshcd_pltfrm_shutdown(struct platform_device *pdev);
 int ufshcd_populate_vreg(struct device *dev, const char *name,
                         struct ufs_vreg **out_vreg);
 
index f7553293ba98bd0bd6f592216826f99f26ed076a..db2e669985d5398331b6f51ffccb56ae6de2d5dd 100644 (file)
@@ -1277,7 +1277,6 @@ extern int ufshcd_system_freeze(struct device *dev);
 extern int ufshcd_system_thaw(struct device *dev);
 extern int ufshcd_system_restore(struct device *dev);
 #endif
-extern int ufshcd_shutdown(struct ufs_hba *hba);
 
 extern int ufshcd_dme_configure_adapt(struct ufs_hba *hba,
                                      int agreed_gear,