This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/849/ |
src/hardware/LMI_PCIBridgeProvider.c (Diff revision 1) | |||
---|---|---|---|
31 | struct pci_access *acc; |
This could be a shared variable for all hw providers. Initialized when the first provider is instantiated and freed when the last one is cleaned up. Although it would need a mutex as a guard.
src/hardware/LMI_PCIBridgeProvider.c (Diff revision 1) | |||
---|---|---|---|
35 | struct pci_dev *dev; |
||
36 | |||
37 | if (!(acc = pci_alloc())) { |
||
38 | error("Failed to access the PCI bus."); |
||
39 | abort(); |
||
40 | } |
||
41 | |||
42 | pci_init(acc); |
||
43 | pci_scan_bus(acc); |
||
44 | |||
45 | for (dev = acc->devices; dev; dev = dev->next) { |
||
46 | pci_fill_info(dev, |
||
47 | PCI_FILL_IDENT |
||
48 | | PCI_FILL_IRQ |
||
49 | | PCI_FILL_BASES |
||
50 | | PCI_FILL_ROM_BASE |
||
51 | | PCI_FILL_CLASS |
||
52 | | PCI_FILL_CAPS); |
||
53 | } |
Same code in src/hardware/LMI_PCIDeviceProvider.c At least I would move these init functions to some shared module. And preferably make just one taking enum of what needs to be filled.
src/hardware/LMI_PCIBridgeSystemDeviceProvider.c (Diff revision 1) | |||
---|---|---|---|
33 | struct pci_dev *dev; |
||
34 | |||
35 | if (!(acc = pci_alloc())) { |
||
36 | error("Failed to access the PCI bus."); |
||
37 | abort(); |
||
38 | } |
||
39 | |||
40 | pci_init(acc); |
||
41 | pci_scan_bus(acc); |
||
42 | |||
43 | for (dev = acc->devices; dev; dev = dev->next) { |
||
44 | pci_fill_info(dev, PCI_FILL_CLASS); |
||
45 | } |
Same code as in src/hardware/LMI_PCIDeviceSystemDeviceProvider.c
- Michal Minar
On September 10th, 2013, 3:43 p.m. UTC, Peter Schiffer wrote:
Review request for OpenLMI Developers.
By Peter Schiffer.
Updated Sept. 10, 2013, 3:43 p.m.
Repository:
openlmi-providers
Description
Diffs
|