OpenVZ Forum


Home » Mailing lists » Devel » [PATCH 2/5] fixing errors handling during pci_driver resume stage [ata]
[PATCH 2/5] fixing errors handling during pci_driver resume stage [ata] [message #9537] Tue, 09 January 2007 09:01 Go to next message
Dmitriy Monakhov is currently offline  Dmitriy Monakhov
Messages: 52
Registered: October 2006
Member
ata pci drivers have to return correct error code during resume stage in
case of errors.
Signed-off-by: Dmitriy Monakhov <dmonakhov@openvz.org>
-----

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index b517d24..0656334 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1372,7 +1372,9 @@ static int ahci_pci_device_resume(struct
void __iomem *mmio = host->mmio_base;
int rc;

- ata_pci_device_do_resume(pdev);
+ rc = ata_pci_device_do_resume(pdev);
+ if (rc)
+ return rc;

if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) {
rc = ahci_reset_controller(mmio, pdev);
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 0d51d13..3d6729d 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6221,12 +6221,19 @@ void ata_pci_device_do_suspend(struct pc
}
}

-void ata_pci_device_do_resume(struct pci_dev *pdev)
+int ata_pci_device_do_resume(struct pci_dev *pdev)
{
+ int ret = 0;
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
- pci_enable_device(pdev);
+ ret = pci_enable_device(pdev);
+ if (ret) {
+ dev_err(&pdev->dev, "Cannot enable PCI device, aborting.\n");
+ return ret;
+ }
+
pci_set_master(pdev);
+ return ret;
}

int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
@@ -6246,8 +6253,10 @@ int ata_pci_device_suspend(struct pci_de
int ata_pci_device_resume(struct pci_dev *pdev)
{
struct ata_host *host = dev_get_drvdata(&pdev->dev);
+ int err;

- ata_pci_device_do_resume(pdev);
+ if ((err = ata_pci_device_do_resume(pdev)))
+ return err;
ata_host_resume(host);
return 0;
}
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index 7808d03..8451143 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -710,8 +710,12 @@ err_out:
static int sil_pci_device_resume(struct pci_dev *pdev)
{
struct ata_host *host = dev_get_drvdata(&pdev->dev);
+ int err;
+
+ err = ata_pci_device_do_resume(pdev);
+ if (err)
+ return err;

- ata_pci_device_do_resume(pdev);
sil_init_controller(pdev, host->n_ports, host->ports[0]->flags,
host->mmio_base);
ata_host_resume(host);
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 5aa288d..be6971a 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -1200,8 +1200,11 @@ static int sil24_pci_device_resume(struc
{
struct ata_host *host = dev_get_drvdata(&pdev->dev);
struct sil24_host_priv *hpriv = host->private_data;
+ int err;

- ata_pci_device_do_resume(pdev);
+ err = ata_pci_device_do_resume(pdev);
+ if (err)
+ return err;

if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND)
writel(HOST_CTRL_GLOBAL_RST, hpriv->host_base + HOST_CTRL);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index ab27548..283ca72 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -719,7 +719,7 @@ extern int ata_pci_init_one (struct pci_
unsigned int n_ports);
extern void ata_pci_remove_one (struct pci_dev *pdev);
extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg);
-extern void ata_pci_device_do_resume(struct pci_dev *pdev);
+extern int ata_pci_device_do_resume(struct pci_dev *pdev);
extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
extern int ata_pci_device_resume(struct pci_dev *pdev);
extern int ata_pci_clear_simplex(struct pci_dev *pdev);
Re: [PATCH 2/5] fixing errors handling during pci_driver resume stage [ata] [message #9617 is a reply to message #9537] Fri, 12 January 2007 23:50 Go to previous message
Grant Grundler is currently offline  Grant Grundler
Messages: 1
Registered: January 2007
Junior Member
On Tue, Jan 09, 2007 at 12:01:28PM +0300, Dmitriy Monakhov wrote:
> ata pci drivers have to return correct error code during resume stage in
> case of errors.
...
> @@ -6246,8 +6253,10 @@ int ata_pci_device_suspend(struct pci_de
> int ata_pci_device_resume(struct pci_dev *pdev)
> {
> struct ata_host *host = dev_get_drvdata(&pdev->dev);
> + int err;
>
> - ata_pci_device_do_resume(pdev);
> + if ((err = ata_pci_device_do_resume(pdev)))
> + return err;

nit: in every other case I looked at you did:
err = foo()
if (err) ...

Can you make that consistent here too?

thanks,
grant
Previous Topic: + remove-find_attach_pid.patch added to -mm tree
Next Topic: [RFC][PATCH] Use task_pgrp(), task_session() in copy_process()
Goto Forum:
  


Current Time: Wed Jul 23 23:37:24 GMT 2025

Total time taken to generate the page: 0.16232 seconds