aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-23 16:37:29 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-23 16:37:29 -0700
commit1212663fba7c5e003e05d24f043d5ed57eb18b24 (patch)
treed6d1327b1e852721952e2efc8aabca25e73573f0 /drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
parentaf76bbabbdf5cebea6a3863446f9f74b469c4bdc (diff)
parentaf2709fd0d127cd590e7a77ab50b23cdb9f6f48f (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (39 commits) [SCSI] qla2xxx: Update version number to 8.02.00-k5. [SCSI] qla2xxx: Correct display of ISP serial-number. [SCSI] qla2xxx: Correct residual-count handling discrepancies during UNDERRUN handling. [SCSI] qla2xxx: Make driver (mostly) legacy I/O port free. [SCSI] qla2xxx: Fix issue where final flash-segment updates were falling into the slow-path write handler. [SCSI] qla2xxx: Handle unaligned sector writes during NVRAM/VPD updates. [SCSI] qla2xxx: Defer explicit interrupt-polling processing to init-time scenarios. [SCSI] qla2xxx: Resync with latest HBA SSID specification -- 2.2u. [SCSI] sym53c8xx: Remove sym_xpt_async_sent_bdr [SCSI] sym53c8xx: Remove pci_dev pointer from sym_shcb [SCSI] sym53c8xx: Make interrupt handler capable of returning IRQ_NONE [SCSI] sym53c8xx: Get rid of IRQ_FMT and IRQ_PRM [SCSI] sym53c8xx: Use scmd_printk where appropriate [SCSI] sym53c8xx: Simplify DAC DMA handling [SCSI] sym53c8xx: Remove tag_ctrl module parameter [SCSI] sym53c8xx: Remove io_ws, mmio_ws and ram_ws elements [SCSI] sym53c8xx: Remove ->device_id [SCSI] sym53c8xx: Use pdev->revision [SCSI] sym53c8xx: PCI Error Recovery support [SCSI] sym53c8xx: Stop overriding scsi_done ...
Diffstat (limited to 'drivers/scsi/aic7xxx/aic7xxx_osm_pci.c')
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm_pci.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
index ea5687df732..4488946cff2 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
@@ -49,6 +49,8 @@ static int ahc_linux_pci_reserve_io_region(struct ahc_softc *ahc,
static int ahc_linux_pci_reserve_mem_region(struct ahc_softc *ahc,
u_long *bus_addr,
uint8_t __iomem **maddr);
+static int ahc_linux_pci_dev_suspend(struct pci_dev *pdev, pm_message_t mesg);
+static int ahc_linux_pci_dev_resume(struct pci_dev *pdev);
static void ahc_linux_pci_dev_remove(struct pci_dev *pdev);
/* Define the macro locally since it's different for different class of chips.
@@ -133,10 +135,54 @@ MODULE_DEVICE_TABLE(pci, ahc_linux_pci_id_table);
static struct pci_driver aic7xxx_pci_driver = {
.name = "aic7xxx",
.probe = ahc_linux_pci_dev_probe,
+#ifdef CONFIG_PM
+ .suspend = ahc_linux_pci_dev_suspend,
+ .resume = ahc_linux_pci_dev_resume,
+#endif
.remove = ahc_linux_pci_dev_remove,
.id_table = ahc_linux_pci_id_table
};
+static int
+ahc_linux_pci_dev_suspend(struct pci_dev *pdev, pm_message_t mesg)
+{
+ struct ahc_softc *ahc = pci_get_drvdata(pdev);
+ int rc;
+
+ if ((rc = ahc_suspend(ahc)))
+ return rc;
+
+ pci_save_state(pdev);
+ pci_disable_device(pdev);
+
+ if (mesg.event == PM_EVENT_SUSPEND)
+ pci_set_power_state(pdev, PCI_D3hot);
+
+ return rc;
+}
+
+static int
+ahc_linux_pci_dev_resume(struct pci_dev *pdev)
+{
+ struct ahc_softc *ahc = pci_get_drvdata(pdev);
+ int rc;
+
+ pci_set_power_state(pdev, PCI_D0);
+ pci_restore_state(pdev);
+
+ if ((rc = pci_enable_device(pdev))) {
+ dev_printk(KERN_ERR, &pdev->dev,
+ "failed to enable device after resume (%d)\n", rc);
+ return rc;
+ }
+
+ pci_set_master(pdev);
+
+ ahc_pci_resume(ahc);
+
+ return (ahc_resume(ahc));
+}
+
static void
ahc_linux_pci_dev_remove(struct pci_dev *pdev)
{