diff mbox series

[v1] scsi: isci: Don't use PCI helper functions

Message ID 20201107100420.149521-1-vaibhavgupta40@gmail.com (mailing list archive)
State Accepted
Headers show
Series [v1] scsi: isci: Don't use PCI helper functions | expand

Commit Message

Vaibhav Gupta Nov. 7, 2020, 10:04 a.m. UTC
PCI helper functions such as pci_enable/disable_device(),
pci_save/restore_state(), pci_set_power_state(), etc. were used by the
legacy framework to perform standard operations related to PCI PM.

This driver is using the generic framework and thus calls for those
functions should be dropped as those tasks are now performed by the PCI
core.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
---
 drivers/scsi/isci/init.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

Comments

Vaibhav Gupta Nov. 7, 2020, 10:05 a.m. UTC | #1
On Sat, Nov 07, 2020 at 03:34:19PM +0530, Vaibhav Gupta wrote:
> PCI helper functions such as pci_enable/disable_device(),
> pci_save/restore_state(), pci_set_power_state(), etc. were used by the
> legacy framework to perform standard operations related to PCI PM.
> 
> This driver is using the generic framework and thus calls for those
> functions should be dropped as those tasks are now performed by the PCI
> core.
> 
> Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
> ---
>  drivers/scsi/isci/init.c | 18 +-----------------
>  1 file changed, 1 insertion(+), 17 deletions(-)
> 
> diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
> index 93bc9019667f..c452849e7bb4 100644
> --- a/drivers/scsi/isci/init.c
> +++ b/drivers/scsi/isci/init.c
> @@ -715,10 +715,6 @@ static int isci_suspend(struct device *dev)
>  		isci_host_deinit(ihost);
>  	}
>  
> -	pci_save_state(pdev);
> -	pci_disable_device(pdev);
> -	pci_set_power_state(pdev, PCI_D3hot);
> -
>  	return 0;
>  }
>  
> @@ -726,19 +722,7 @@ static int isci_resume(struct device *dev)
>  {
>  	struct pci_dev *pdev = to_pci_dev(dev);
>  	struct isci_host *ihost;
> -	int rc, i;
> -
> -	pci_set_power_state(pdev, PCI_D0);
> -	pci_restore_state(pdev);
> -
> -	rc = pcim_enable_device(pdev);
> -	if (rc) {
> -		dev_err(&pdev->dev,
> -			"enabling device failure after resume(%d)\n", rc);
> -		return rc;
> -	}
> -
> -	pci_set_master(pdev);
> +	int i;
>  
>  	for_each_isci_host(i, ihost, pdev) {
>  		sas_prep_resume_ha(&ihost->sas_ha);
> -- 
> 2.28.0
> 
The patch is compile-tested only.

--Vaibhav
Artur Paszkiewicz Nov. 9, 2020, 1:38 p.m. UTC | #2
On 11/7/20 11:04 AM, Vaibhav Gupta wrote:
> PCI helper functions such as pci_enable/disable_device(),
> pci_save/restore_state(), pci_set_power_state(), etc. were used by the
> legacy framework to perform standard operations related to PCI PM.
> 
> This driver is using the generic framework and thus calls for those
> functions should be dropped as those tasks are now performed by the PCI
> core.
> 
> Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
> ---

Acked-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Martin K. Petersen Nov. 11, 2020, 4:08 a.m. UTC | #3
Vaibhav,

> PCI helper functions such as pci_enable/disable_device(),
> pci_save/restore_state(), pci_set_power_state(), etc. were used by the
> legacy framework to perform standard operations related to PCI PM.
>
> This driver is using the generic framework and thus calls for those
> functions should be dropped as those tasks are now performed by the PCI
> core.

Applied to 5.11/scsi-staging, thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index 93bc9019667f..c452849e7bb4 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -715,10 +715,6 @@  static int isci_suspend(struct device *dev)
 		isci_host_deinit(ihost);
 	}
 
-	pci_save_state(pdev);
-	pci_disable_device(pdev);
-	pci_set_power_state(pdev, PCI_D3hot);
-
 	return 0;
 }
 
@@ -726,19 +722,7 @@  static int isci_resume(struct device *dev)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
 	struct isci_host *ihost;
-	int rc, i;
-
-	pci_set_power_state(pdev, PCI_D0);
-	pci_restore_state(pdev);
-
-	rc = pcim_enable_device(pdev);
-	if (rc) {
-		dev_err(&pdev->dev,
-			"enabling device failure after resume(%d)\n", rc);
-		return rc;
-	}
-
-	pci_set_master(pdev);
+	int i;
 
 	for_each_isci_host(i, ihost, pdev) {
 		sas_prep_resume_ha(&ihost->sas_ha);