patch-2.3.37 linux/drivers/macintosh/via-pmu.c

Next file: linux/drivers/net/pcmcia/ray_cs.c
Previous file: linux/drivers/i2o/i2o_pci.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.36/linux/drivers/macintosh/via-pmu.c linux/drivers/macintosh/via-pmu.c
@@ -1047,8 +1047,9 @@
 	struct pci_save *ps;
 
 	npci = 0;
-	for (pd = pci_devices; pd != NULL; pd = pd->next)
+	pci_for_each_dev(pd) {
 		++npci;
+	}
 	n_pbook_pci_saves = npci;
 	if (npci == 0)
 		return;
@@ -1057,13 +1058,12 @@
 	if (ps == NULL)
 		return;
 
-	for (pd = pci_devices; pd != NULL && npci != 0; pd = pd->next) {
+	pci_for_each_dev(pd) {
 		pci_read_config_word(pd, PCI_COMMAND, &ps->command);
 		pci_read_config_word(pd, PCI_CACHE_LINE_SIZE, &ps->cache_lat);
 		pci_read_config_word(pd, PCI_INTERRUPT_LINE, &ps->intr);
 		pci_read_config_dword(pd, PCI_ROM_ADDRESS, &ps->rom_address);
 		++ps;
-		--npci;
 	}
 }
 
@@ -1071,11 +1071,12 @@
 pbook_pci_restore(void)
 {
 	u16 cmd;
-	struct pci_save *ps = pbook_pci_saves;
+	struct pci_save *ps = pbook_pci_saves - 1;
 	struct pci_dev *pd;
 	int j;
 
-	for (pd = pci_devices; pd != NULL; pd = pd->next, ++ps) {
+	pci_for_each_dev(pd) {
+		ps++;
 		if (ps->command == 0)
 			continue;
 		pci_read_config_word(pd, PCI_COMMAND, &cmd);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)