From: Kulikov Vasiliy Date: Sat, 3 Jul 2010 15:20:47 +0000 (+0400) Subject: Staging: comedi: use for_each_pci_dev() X-Git-Tag: firefly_0821_release~9833^2~1255^2~1^2~267 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=20fb2280815510533cbd7785b53821ca7209345b;p=firefly-linux-kernel-4.4.55.git Staging: comedi: use for_each_pci_dev() Use for_each_pci_dev() to simplify the code. Signed-off-by: Kulikov Vasiliy Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h b/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h index c3284eb0f0ac..8ed19bcbf352 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h @@ -247,16 +247,14 @@ int i_pci_card_data(struct pcilst_struct *amcc, /* build list of amcc cards in this system */ void v_pci_card_list_init(unsigned short pci_vendor, char display) { - struct pci_dev *pcidev; + struct pci_dev *pcidev = NULL; struct pcilst_struct *amcc, *last; int i; int i_Count = 0; amcc_devices = NULL; last = NULL; - for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pcidev != NULL; - pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { + for_each_pci_dev(pcidev) { for (i_Count = 0; i_Count < 2; i_Count++) { pci_vendor = i_ADDIDATADeviceID[i_Count]; if (pcidev->vendor == pci_vendor) { diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 0bc6ac2b6424..073d0242c28e 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -351,12 +351,10 @@ static int pci6208_ao_rinsn(struct comedi_device *dev, static int pci6208_find_device(struct comedi_device *dev, int bus, int slot) { - struct pci_dev *pci_dev; + struct pci_dev *pci_dev = NULL; int i; - for (pci_dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pci_dev != NULL; - pci_dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pci_dev)) { + for_each_pci_dev(pci_dev) { if (pci_dev->vendor == PCI_VENDOR_ID_ADLINK) { for (i = 0; i < ARRAY_SIZE(pci6208_boards); i++) { if (pci6208_boards[i].dev_id == diff --git a/drivers/staging/comedi/drivers/adl_pci7230.c b/drivers/staging/comedi/drivers/adl_pci7230.c index caeb4e11ac59..72a7258b5b92 100644 --- a/drivers/staging/comedi/drivers/adl_pci7230.c +++ b/drivers/staging/comedi/drivers/adl_pci7230.c @@ -90,7 +90,7 @@ static int adl_pci7230_do_insn_bits(struct comedi_device *dev, static int adl_pci7230_attach(struct comedi_device *dev, struct comedi_devconfig *it) { - struct pci_dev *pcidev; + struct pci_dev *pcidev = NULL; struct comedi_subdevice *s; int bus, slot; @@ -106,10 +106,7 @@ static int adl_pci7230_attach(struct comedi_device *dev, if (alloc_subdevices(dev, 2) < 0) return -ENOMEM; - for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pcidev != NULL; - pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { - + for_each_pci_dev(pcidev) { if (pcidev->vendor == PCI_VENDOR_ID_ADLINK && pcidev->device == PCI_DEVICE_ID_PCI7230) { if (bus || slot) { diff --git a/drivers/staging/comedi/drivers/adl_pci7296.c b/drivers/staging/comedi/drivers/adl_pci7296.c index 947fae5adb94..f28fe6bec050 100644 --- a/drivers/staging/comedi/drivers/adl_pci7296.c +++ b/drivers/staging/comedi/drivers/adl_pci7296.c @@ -77,7 +77,7 @@ static struct comedi_driver driver_adl_pci7296 = { static int adl_pci7296_attach(struct comedi_device *dev, struct comedi_devconfig *it) { - struct pci_dev *pcidev; + struct pci_dev *pcidev = NULL; struct comedi_subdevice *s; int bus, slot; int ret; @@ -94,10 +94,7 @@ static int adl_pci7296_attach(struct comedi_device *dev, if (alloc_subdevices(dev, 4) < 0) return -ENOMEM; - for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pcidev != NULL; - pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { - + for_each_pci_dev(pcidev) { if (pcidev->vendor == PCI_VENDOR_ID_ADLINK && pcidev->device == PCI_DEVICE_ID_PCI7296) { if (bus || slot) { diff --git a/drivers/staging/comedi/drivers/adl_pci7432.c b/drivers/staging/comedi/drivers/adl_pci7432.c index 3b2f8e3fccd2..262da7b29b28 100644 --- a/drivers/staging/comedi/drivers/adl_pci7432.c +++ b/drivers/staging/comedi/drivers/adl_pci7432.c @@ -86,7 +86,7 @@ static int adl_pci7432_do_insn_bits(struct comedi_device *dev, static int adl_pci7432_attach(struct comedi_device *dev, struct comedi_devconfig *it) { - struct pci_dev *pcidev; + struct pci_dev *pcidev = NULL; struct comedi_subdevice *s; int bus, slot; @@ -102,10 +102,7 @@ static int adl_pci7432_attach(struct comedi_device *dev, if (alloc_subdevices(dev, 2) < 0) return -ENOMEM; - for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pcidev != NULL; - pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { - + for_each_pci_dev(pcidev) { if (pcidev->vendor == PCI_VENDOR_ID_ADLINK && pcidev->device == PCI_DEVICE_ID_PCI7432) { if (bus || slot) { diff --git a/drivers/staging/comedi/drivers/adl_pci8164.c b/drivers/staging/comedi/drivers/adl_pci8164.c index 1b7155e4895e..767a594935c7 100644 --- a/drivers/staging/comedi/drivers/adl_pci8164.c +++ b/drivers/staging/comedi/drivers/adl_pci8164.c @@ -125,7 +125,7 @@ static int adl_pci8164_insn_write_buf1(struct comedi_device *dev, static int adl_pci8164_attach(struct comedi_device *dev, struct comedi_devconfig *it) { - struct pci_dev *pcidev; + struct pci_dev *pcidev = NULL; struct comedi_subdevice *s; int bus, slot; @@ -142,10 +142,7 @@ static int adl_pci8164_attach(struct comedi_device *dev, if (alloc_subdevices(dev, 4) < 0) return -ENOMEM; - for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pcidev != NULL; - pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { - + for_each_pci_dev(pcidev) { if (pcidev->vendor == PCI_VENDOR_ID_ADLINK && pcidev->device == PCI_DEVICE_ID_PCI8164) { if (bus || slot) { diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c index 38a5752bc4fc..43b84534b78f 100644 --- a/drivers/staging/comedi/drivers/adl_pci9111.c +++ b/drivers/staging/comedi/drivers/adl_pci9111.c @@ -1262,7 +1262,7 @@ static int pci9111_attach(struct comedi_device *dev, { struct comedi_subdevice *subdevice; unsigned long io_base, io_range, lcr_io_base, lcr_io_range; - struct pci_dev *pci_device; + struct pci_dev *pci_device = NULL; int error, i; const struct pci9111_board *board; @@ -1272,9 +1272,7 @@ static int pci9111_attach(struct comedi_device *dev, printk("comedi%d: " PCI9111_DRIVER_NAME " driver\n", dev->minor); - for (pci_device = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pci_device != NULL; - pci_device = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pci_device)) { + for_each_pci_dev(pci_device) { if (pci_device->vendor == PCI_VENDOR_ID_ADLINK) { for (i = 0; i < pci9111_board_nbr; i++) { if (pci9111_boards[i].device_id == diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 31a63887ab0d..d018bb4e2890 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -1104,7 +1104,7 @@ static int pci_dio_attach(struct comedi_device *dev, struct comedi_subdevice *s; int ret, subdev, n_subdevices, i, j; unsigned long iobase; - struct pci_dev *pcidev; + struct pci_dev *pcidev = NULL; printk("comedi%d: adv_pci_dio: ", dev->minor); @@ -1114,9 +1114,7 @@ static int pci_dio_attach(struct comedi_device *dev, return -ENOMEM; } - for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pcidev != NULL; - pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { + for_each_pci_dev(pcidev) { /* loop through cards supported by this driver */ for (i = 0; i < n_boardtypes; ++i) { if (boardtypes[i].vendor_id != pcidev->vendor) diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index b572df718f21..5d064577b2f1 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -764,7 +764,7 @@ static int pci230_attach(struct comedi_device *dev, struct comedi_devconfig *it) struct comedi_subdevice *s; unsigned long iobase1, iobase2; /* PCI230's I/O spaces 1 and 2 respectively. */ - struct pci_dev *pci_dev; + struct pci_dev *pci_dev = NULL; int i = 0, irq_hdl, rc; printk("comedi%d: amplc_pci230: attach %s %d,%d\n", dev->minor, @@ -780,9 +780,7 @@ static int pci230_attach(struct comedi_device *dev, struct comedi_devconfig *it) spin_lock_init(&devpriv->ai_stop_spinlock); spin_lock_init(&devpriv->ao_stop_spinlock); /* Find card */ - for (pci_dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pci_dev != NULL; - pci_dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pci_dev)) { + for_each_pci_dev(pci_dev) { if (it->options[0] || it->options[1]) { /* Match against bus/slot options. */ if (it->options[0] != pci_dev->bus->number || diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 2d9ad537793e..6530b6c9d98b 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -533,7 +533,7 @@ static int cb_pcidas_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; - struct pci_dev *pcidev; + struct pci_dev *pcidev = NULL; int index; int i; @@ -550,9 +550,7 @@ static int cb_pcidas_attach(struct comedi_device *dev, */ printk("\n"); - for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pcidev != NULL; - pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { + for_each_pci_dev(pcidev) { /* is it not a computer boards card? */ if (pcidev->vendor != PCI_VENDOR_ID_CB) continue; diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index ba7c48ab6d92..53e7015869fc 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -1754,7 +1754,7 @@ static inline void warn_external_queue(struct comedi_device *dev) */ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) { - struct pci_dev *pcidev; + struct pci_dev *pcidev = NULL; int index; uint32_t local_range, local_decode; int retval; @@ -1771,9 +1771,7 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) * Probe the device to determine what device in the series it is. */ - for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pcidev != NULL; - pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { + for_each_pci_dev(pcidev) { /* is it not a computer boards card? */ if (pcidev->vendor != PCI_VENDOR_ID_COMPUTERBOARDS) continue; diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c index 349c7a61763a..2f2997fd926f 100644 --- a/drivers/staging/comedi/drivers/cb_pcidda.c +++ b/drivers/staging/comedi/drivers/cb_pcidda.c @@ -281,7 +281,7 @@ static int cb_pcidda_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; - struct pci_dev *pcidev; + struct pci_dev *pcidev = NULL; int index; printk("comedi%d: cb_pcidda: ", dev->minor); @@ -297,9 +297,7 @@ static int cb_pcidda_attach(struct comedi_device *dev, */ printk("\n"); - for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pcidev != NULL; - pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { + for_each_pci_dev(pcidev) { if (pcidev->vendor == PCI_VENDOR_ID_CB) { if (it->options[0] || it->options[1]) { if (pcidev->bus->number != it->options[0] || diff --git a/drivers/staging/comedi/drivers/cb_pcidio.c b/drivers/staging/comedi/drivers/cb_pcidio.c index a9d902f418a1..c1693c91a6d0 100644 --- a/drivers/staging/comedi/drivers/cb_pcidio.c +++ b/drivers/staging/comedi/drivers/cb_pcidio.c @@ -202,9 +202,7 @@ static int pcidio_attach(struct comedi_device *dev, struct comedi_devconfig *it) * Probe the device to determine what device in the series it is. */ - for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pcidev != NULL; - pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { + for_each_pci_dev(pcidev) { /* is it not a computer boards card? */ if (pcidev->vendor != PCI_VENDOR_ID_CB) continue; diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index e50b8c259e2c..ced346a7cae3 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -210,7 +210,7 @@ static int cb_pcimdas_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; - struct pci_dev *pcidev; + struct pci_dev *pcidev = NULL; int index; /* int i; */ @@ -227,9 +227,7 @@ static int cb_pcimdas_attach(struct comedi_device *dev, */ printk("\n"); - for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pcidev != NULL; - pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { + for_each_pci_dev(pcidev) { /* is it not a computer boards card? */ if (pcidev->vendor != PCI_VENDOR_ID_COMPUTERBOARDS) continue; diff --git a/drivers/staging/comedi/drivers/cb_pcimdda.c b/drivers/staging/comedi/drivers/cb_pcimdda.c index 3160330b1d9e..8c981a89ab63 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdda.c +++ b/drivers/staging/comedi/drivers/cb_pcimdda.c @@ -464,13 +464,11 @@ static int ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, */ static int probe(struct comedi_device *dev, const struct comedi_devconfig *it) { - struct pci_dev *pcidev; + struct pci_dev *pcidev = NULL; int index; unsigned long registers; - for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pcidev != NULL; - pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { + for_each_pci_dev(pcidev) { /* is it not a computer boards card? */ if (pcidev->vendor != PCI_VENDOR_ID_COMPUTERBOARDS) continue; diff --git a/drivers/staging/comedi/drivers/contec_pci_dio.c b/drivers/staging/comedi/drivers/contec_pci_dio.c index 24ac10ce0bae..871f109bcfa3 100644 --- a/drivers/staging/comedi/drivers/contec_pci_dio.c +++ b/drivers/staging/comedi/drivers/contec_pci_dio.c @@ -103,7 +103,7 @@ static int contec_ns_to_timer(unsigned int *ns, int round); static int contec_attach(struct comedi_device *dev, struct comedi_devconfig *it) { - struct pci_dev *pcidev; + struct pci_dev *pcidev = NULL; struct comedi_subdevice *s; printk("comedi%d: contec: ", dev->minor); @@ -116,10 +116,7 @@ static int contec_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (alloc_subdevices(dev, 2) < 0) return -ENOMEM; - for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pcidev != NULL; - pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { - + for_each_pci_dev(pcidev) { if (pcidev->vendor == PCI_VENDOR_ID_CONTEC && pcidev->device == PCI_DEVICE_ID_PIO1616L) { if (it->options[0] || it->options[1]) { diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index ad18572a1224..3141dc80fe74 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -980,7 +980,7 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) unsigned long iobase; #ifdef CONFIG_COMEDI_PCI unsigned long pci_iobase = 0; - struct pci_dev *pdev; + struct pci_dev *pdev = NULL; #endif ret = alloc_private(dev, sizeof(struct das08_private_struct)); @@ -997,9 +997,7 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) } printk("\n"); /* find card */ - for (pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pdev != NULL; - pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) { + for_each_pci_dev(pdev) { if (pdev->vendor == PCI_VENDOR_ID_COMPUTERBOARDS && pdev->device == PCI_DEVICE_ID_PCIDAS08) { if (it->options[0] || it->options[1]) { diff --git a/drivers/staging/comedi/drivers/icp_multi.h b/drivers/staging/comedi/drivers/icp_multi.h index 2bb96b1d21e7..68acefe16888 100644 --- a/drivers/staging/comedi/drivers/icp_multi.h +++ b/drivers/staging/comedi/drivers/icp_multi.h @@ -62,16 +62,14 @@ static int pci_card_data(struct pcilst_struct *amcc, /* build list of Inova cards in this system */ static void pci_card_list_init(unsigned short pci_vendor, char display) { - struct pci_dev *pcidev; + struct pci_dev *pcidev = NULL; struct pcilst_struct *inova, *last; int i; inova_devices = NULL; last = NULL; - for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pcidev != NULL; - pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { + for_each_pci_dev(pcidev) { if (pcidev->vendor == pci_vendor) { inova = kzalloc(sizeof(*inova), GFP_KERNEL); if (!inova) { diff --git a/drivers/staging/comedi/drivers/ke_counter.c b/drivers/staging/comedi/drivers/ke_counter.c index e30aa0123692..286093bca3fb 100644 --- a/drivers/staging/comedi/drivers/ke_counter.c +++ b/drivers/staging/comedi/drivers/ke_counter.c @@ -188,7 +188,7 @@ static int cnt_rinsn(struct comedi_device *dev, static int cnt_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *subdevice; - struct pci_dev *pci_device; + struct pci_dev *pci_device = NULL; struct cnt_board_struct *board; unsigned long io_base; int error, i; @@ -199,9 +199,7 @@ static int cnt_attach(struct comedi_device *dev, struct comedi_devconfig *it) return error; /* Probe the device to determine what device in the series it is. */ - for (pci_device = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pci_device != NULL; - pci_device = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pci_device)) { + for_each_pci_dev(pci_device) { if (pci_device->vendor == PCI_VENDOR_ID_KOLTER) { for (i = 0; i < cnt_board_nbr; i++) { if (cnt_boards[i].device_id == diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 56c9279c700e..14713849564d 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -389,7 +389,7 @@ static int me4000_attach(struct comedi_device *dev, struct comedi_devconfig *it) static int me4000_probe(struct comedi_device *dev, struct comedi_devconfig *it) { - struct pci_dev *pci_device; + struct pci_dev *pci_device = NULL; int result, i; struct me4000_board *board; @@ -402,9 +402,7 @@ static int me4000_probe(struct comedi_device *dev, struct comedi_devconfig *it) /* * Probe the device to determine what device in the series it is. */ - for (pci_device = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pci_device != NULL; - pci_device = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pci_device)) { + for_each_pci_dev(pci_device) { if (pci_device->vendor == PCI_VENDOR_ID_MEILHAUS) { for (i = 0; i < ME4000_BOARD_VERSIONS; i++) { if (me4000_boards[i].device_id == diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c index 579e6a571800..cda4b224b30f 100644 --- a/drivers/staging/comedi/drivers/me_daq.c +++ b/drivers/staging/comedi/drivers/me_daq.c @@ -680,7 +680,7 @@ static int me_reset(struct comedi_device *dev) */ static int me_attach(struct comedi_device *dev, struct comedi_devconfig *it) { - struct pci_dev *pci_device; + struct pci_dev *pci_device = NULL; struct comedi_subdevice *subdevice; struct me_board *board; resource_size_t plx_regbase_tmp; @@ -697,9 +697,7 @@ static int me_attach(struct comedi_device *dev, struct comedi_devconfig *it) return -ENOMEM; /* Probe the device to determine what device in the series it is. */ - for (pci_device = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pci_device != NULL; - pci_device = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pci_device)) { + for_each_pci_dev(pci_device) { if (pci_device->vendor == PCI_VENDOR_ID_MEILHAUS) { for (i = 0; i < me_board_nbr; i++) { if (me_boards[i].device_id == diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c index 4b7d207ab14d..cd25b241cc1f 100644 --- a/drivers/staging/comedi/drivers/mite.c +++ b/drivers/staging/comedi/drivers/mite.c @@ -70,12 +70,10 @@ EXPORT_SYMBOL(mite_devices); void mite_init(void) { - struct pci_dev *pcidev; + struct pci_dev *pcidev = NULL; struct mite_struct *mite; - for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); - pcidev != NULL; - pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { + for_each_pci_dev(pcidev) { if (pcidev->vendor == PCI_VENDOR_ID_NI) { unsigned i;