EDAC, pci_sysfs: Use for_each_pci_dev to simplify the code

Use for_each_pci_dev to simplify the code.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
[Boris: cleanup comments and drop loop brackets]
Signed-off-by: Borislav Petkov <bp@alien8.de>
This commit is contained in:
Wei Yongjun 2012-12-04 00:01:42 -05:00 committed by Borislav Petkov
parent 2d56b109e3
commit 3bfe5aae8e

View File

@ -645,21 +645,17 @@ typedef void (*pci_parity_check_fn_t) (struct pci_dev *dev);
/* /*
* pci_dev parity list iterator * pci_dev parity list iterator
* Scan the PCI device list for one pass, looking for SERRORs *
* Master Parity ERRORS or Parity ERRORs on primary or secondary devices * Scan the PCI device list looking for SERRORs, Master Parity ERRORS or
* Parity ERRORs on primary or secondary devices.
*/ */
static inline void edac_pci_dev_parity_iterator(pci_parity_check_fn_t fn) static inline void edac_pci_dev_parity_iterator(pci_parity_check_fn_t fn)
{ {
struct pci_dev *dev = NULL; struct pci_dev *dev = NULL;
/* request for kernel access to the next PCI device, if any, for_each_pci_dev(dev)
* and while we are looking at it have its reference count
* bumped until we are done with it
*/
while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
fn(dev); fn(dev);
} }
}
/* /*
* edac_pci_do_parity_check * edac_pci_do_parity_check