summaryrefslogtreecommitdiff
path: root/drivers/pci/msi.c
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2007-01-25 11:34:08 +0300
committerGreg Kroah-Hartman <gregkh@suse.de>2007-02-08 02:50:07 +0300
commit8fed4b65236c44d090bd62f2d14938ae791e0260 (patch)
tree53b0609ff8e53d9b1410f707f59cd14a555f8c04 /drivers/pci/msi.c
parent0fcfdabbdbedb3bdc63f29209aeeac805df78a92 (diff)
downloadlinux-8fed4b65236c44d090bd62f2d14938ae791e0260.tar.xz
MSI: Combine pci_(save|restore)_msi/msix_state
The PCI save/restore code doesn't need to care about MSI vs MSI-X, all it really wants is to say "save/restore all MSI(-X) info for this device". This is borne out in the code, we call the MSI and MSI-X save routines side by side, and similarly with the restore routines. So combine the MSI/MSI-X routines into pci_save_msi_state() and pci_restore_msi_state(). It is up to those routines to decide what state needs to be saved. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/msi.c')
-rw-r--r--drivers/pci/msi.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 6cfa6be9a6d5..067ae9917fd6 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -295,7 +295,7 @@ static int msi_lookup_irq(struct pci_dev *dev, int type)
}
#ifdef CONFIG_PM
-int pci_save_msi_state(struct pci_dev *dev)
+static int __pci_save_msi_state(struct pci_dev *dev)
{
int pos, i = 0;
u16 control;
@@ -333,7 +333,7 @@ int pci_save_msi_state(struct pci_dev *dev)
return 0;
}
-void pci_restore_msi_state(struct pci_dev *dev)
+static void __pci_restore_msi_state(struct pci_dev *dev)
{
int i = 0, pos;
u16 control;
@@ -361,7 +361,7 @@ void pci_restore_msi_state(struct pci_dev *dev)
kfree(save_state);
}
-int pci_save_msix_state(struct pci_dev *dev)
+static int __pci_save_msix_state(struct pci_dev *dev)
{
int pos;
int temp;
@@ -409,7 +409,20 @@ int pci_save_msix_state(struct pci_dev *dev)
return 0;
}
-void pci_restore_msix_state(struct pci_dev *dev)
+int pci_save_msi_state(struct pci_dev *dev)
+{
+ int rc;
+
+ rc = __pci_save_msi_state(dev);
+ if (rc)
+ return rc;
+
+ rc = __pci_save_msix_state(dev);
+
+ return rc;
+}
+
+static void __pci_restore_msix_state(struct pci_dev *dev)
{
u16 save;
int pos;
@@ -446,6 +459,12 @@ void pci_restore_msix_state(struct pci_dev *dev)
pci_write_config_word(dev, msi_control_reg(pos), save);
enable_msi_mode(dev, pos, PCI_CAP_ID_MSIX);
}
+
+void pci_restore_msi_state(struct pci_dev *dev)
+{
+ __pci_restore_msi_state(dev);
+ __pci_restore_msix_state(dev);
+}
#endif /* CONFIG_PM */
/**