Skip to contentSkip to conversation

drivers/usb/core: use for_each_pci_dev()

PATCH Applied Kulikov Vasiliy 2 participants 2 messages Jul 3, 2010 – Jul 4, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 19/19 drivers/usb/core: use for_each_pci_dev()

Use for_each_pci_dev() to simplify the code.

---
 drivers/usb/core/hcd-pci.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/usb/core/hcd-pci.c +1 -4
index 7e2d527..c1f0bba 100644
@@ -66,10 +66,7 @@ static void companion_common(struct pci_dev *pdev, struct usb_hcd *hcd,
 	 * vice versa.
 	 */
 	companion = NULL;
-	for (;;) {
-		companion = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, companion);
-		if (!companion)
-			break;
+	for_each_pci_dev(companion) {
 		if (companion->bus != pdev->bus ||
 				PCI_SLOT(companion->devfn) != slot)
 			continue;
Signature · 1 line
1.7.0.4
Acked-by on v1 19/19
#1 lore raw
Quoted 13 lines · Kulikov Vasiliy

Use for_each_pci_dev() to simplify the code.

---
 drivers/usb/core/hcd-pci.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/usb/core/hcd-pci.c +0 -0
index 7e2d527..c1f0bba 100644
@@ -66,10 +66,7 @@ static void companion_common(struct pci_dev *pdev, struct usb_hcd *hcd,
 	 * vice versa.

drivers/usb/core/hcd-pci.c static void companion_common(struct pci_dev *pdev, struct usb_hcd *hcd, · line 72

Quoted 10 lines
drivers/usb/core/hcd-pci.c +1 -4
 	 */
 	companion = NULL;
-	for (;;) {
-		companion = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, companion);
-		if (!companion)
-			break;
+	for_each_pci_dev(companion) {
 		if (companion->bus != pdev->bus ||
 				PCI_SLOT(companion->devfn) != slot)
 			continue;