aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pci/pci.c12
-rw-r--r--include/linux/pci.h11
2 files changed, 15 insertions, 8 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 53302cbdb94c..d6e5b8ea9194 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -830,7 +830,7 @@ static int pci_save_pcie_state(struct pci_dev *dev)
830 dev_err(&dev->dev, "buffer not found in %s\n", __func__); 830 dev_err(&dev->dev, "buffer not found in %s\n", __func__);
831 return -ENOMEM; 831 return -ENOMEM;
832 } 832 }
833 cap = (u16 *)&save_state->data[0]; 833 cap = (u16 *)&save_state->cap.data[0];
834 834
835 pci_read_config_word(dev, pos + PCI_EXP_FLAGS, &flags); 835 pci_read_config_word(dev, pos + PCI_EXP_FLAGS, &flags);
836 836
@@ -863,7 +863,7 @@ static void pci_restore_pcie_state(struct pci_dev *dev)
863 pos = pci_find_capability(dev, PCI_CAP_ID_EXP); 863 pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
864 if (!save_state || pos <= 0) 864 if (!save_state || pos <= 0)
865 return; 865 return;
866 cap = (u16 *)&save_state->data[0]; 866 cap = (u16 *)&save_state->cap.data[0];
867 867
868 pci_read_config_word(dev, pos + PCI_EXP_FLAGS, &flags); 868 pci_read_config_word(dev, pos + PCI_EXP_FLAGS, &flags);
869 869
@@ -899,7 +899,8 @@ static int pci_save_pcix_state(struct pci_dev *dev)
899 return -ENOMEM; 899 return -ENOMEM;
900 } 900 }
901 901
902 pci_read_config_word(dev, pos + PCI_X_CMD, (u16 *)save_state->data); 902 pci_read_config_word(dev, pos + PCI_X_CMD,
903 (u16 *)save_state->cap.data);
903 904
904 return 0; 905 return 0;
905} 906}
@@ -914,7 +915,7 @@ static void pci_restore_pcix_state(struct pci_dev *dev)
914 pos = pci_find_capability(dev, PCI_CAP_ID_PCIX); 915 pos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
915 if (!save_state || pos <= 0) 916 if (!save_state || pos <= 0)
916 return; 917 return;
917 cap = (u16 *)&save_state->data[0]; 918 cap = (u16 *)&save_state->cap.data[0];
918 919
919 pci_write_config_word(dev, pos + PCI_X_CMD, cap[i++]); 920 pci_write_config_word(dev, pos + PCI_X_CMD, cap[i++]);
920} 921}
@@ -1771,7 +1772,8 @@ static int pci_add_cap_save_buffer(
1771 if (!save_state) 1772 if (!save_state)
1772 return -ENOMEM; 1773 return -ENOMEM;
1773 1774
1774 save_state->cap_nr = cap; 1775 save_state->cap.cap_nr = cap;
1776 save_state->cap.size = size;
1775 pci_add_saved_cap(dev, save_state); 1777 pci_add_saved_cap(dev, save_state);
1776 1778
1777 return 0; 1779 return 0;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index df4d69b82144..61ef8f2f9b19 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -214,12 +214,17 @@ enum pci_bus_speed {
214 PCI_SPEED_UNKNOWN = 0xff, 214 PCI_SPEED_UNKNOWN = 0xff,
215}; 215};
216 216
217struct pci_cap_saved_state { 217struct pci_cap_saved_data {
218 struct hlist_node next;
219 char cap_nr; 218 char cap_nr;
219 unsigned int size;
220 u32 data[0]; 220 u32 data[0];
221}; 221};
222 222
223struct pci_cap_saved_state {
224 struct hlist_node next;
225 struct pci_cap_saved_data cap;
226};
227
223struct pcie_link_state; 228struct pcie_link_state;
224struct pci_vpd; 229struct pci_vpd;
225struct pci_sriov; 230struct pci_sriov;
@@ -366,7 +371,7 @@ static inline struct pci_cap_saved_state *pci_find_saved_cap(
366 struct hlist_node *pos; 371 struct hlist_node *pos;
367 372
368 hlist_for_each_entry(tmp, pos, &pci_dev->saved_cap_space, next) { 373 hlist_for_each_entry(tmp, pos, &pci_dev->saved_cap_space, next) {
369 if (tmp->cap_nr == cap) 374 if (tmp->cap.cap_nr == cap)
370 return tmp; 375 return tmp;
371 } 376 }
372 return NULL; 377 return NULL;