diff options
| author | H. Peter Anvin <hpa@zytor.com> | 2009-05-29 15:10:28 -0700 |
|---|---|---|
| committer | H. Peter Anvin <hpa@zytor.com> | 2009-05-29 15:10:28 -0700 |
| commit | 5981d5a6fa520f54ab6d983317e6ecef01ff1201 (patch) | |
| tree | 7c789edd7f7621152b148cdd8a57db3a31d6bda9 /com32/modules/pcitest.c | |
| parent | dd6e02af5b8fa016fa112044838ef2f8b960fc9e (diff) | |
| download | syslinux-5981d5a6fa520f54ab6d983317e6ecef01ff1201.tar.gz | |
Run Nindent on com32/modules/pcitest.c
Automatically reformat com32/modules/pcitest.c using Nindent.
Do this for all files except HDT, gPXE and externally maintained
libraries (zlib, tinyjpeg, libpng).
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'com32/modules/pcitest.c')
| -rw-r--r-- | com32/modules/pcitest.c | 146 |
1 files changed, 78 insertions, 68 deletions
diff --git a/com32/modules/pcitest.c b/com32/modules/pcitest.c index 8b97fbea..4e483083 100644 --- a/com32/modules/pcitest.c +++ b/com32/modules/pcitest.c @@ -46,7 +46,7 @@ # define dprintf(...) ((void)0) #endif -char display_line=0; +char display_line = 0; #define moreprintf(...) \ do { \ display_line++; \ @@ -59,90 +59,100 @@ char display_line=0; printf ( __VA_ARGS__); \ } while (0); -void display_pci_devices(struct pci_domain *pci_domain) { - struct pci_device *pci_device; - char kernel_modules [LINUX_KERNEL_MODULE_SIZE*MAX_KERNEL_MODULES_PER_PCI_DEVICE]; +void display_pci_devices(struct pci_domain *pci_domain) +{ + struct pci_device *pci_device; + char kernel_modules[LINUX_KERNEL_MODULE_SIZE * + MAX_KERNEL_MODULES_PER_PCI_DEVICE]; - for_each_pci_func(pci_device, pci_domain) { + for_each_pci_func(pci_device, pci_domain) { - memset(kernel_modules,0,sizeof kernel_modules); + memset(kernel_modules, 0, sizeof kernel_modules); /* printf("PCI: found %d kernel modules for %04x:%04x[%04x:%04x]\n", pci_device->dev_info->linux_kernel_module_count, pci_device->vendor, pci_device->product, pci_device->sub_vendor, pci_device->sub_product); */ - for (int i=0; i<pci_device->dev_info->linux_kernel_module_count;i++) { - if (i>0) { - strncat(kernel_modules," | ",3); - } - strncat(kernel_modules, pci_device->dev_info->linux_kernel_module[i],LINUX_KERNEL_MODULE_SIZE-1); + for (int i = 0; i < pci_device->dev_info->linux_kernel_module_count; + i++) { + if (i > 0) { + strncat(kernel_modules, " | ", 3); + } + strncat(kernel_modules, + pci_device->dev_info->linux_kernel_module[i], + LINUX_KERNEL_MODULE_SIZE - 1); } moreprintf("%04x:%04x[%04x:%04x]: %s\n", - pci_device->vendor, pci_device->product, - pci_device->sub_vendor, pci_device->sub_product, - pci_device->dev_info->class_name); - - moreprintf(" Vendor Name : %s\n", pci_device->dev_info->vendor_name); - moreprintf(" Product Name : %s\n", pci_device->dev_info->product_name); - moreprintf(" PCI bus position : %02x:%02x.%01x\n", __pci_bus, __pci_slot, __pci_func); - moreprintf(" Kernel modules : %s\n\n",kernel_modules); - } + pci_device->vendor, pci_device->product, + pci_device->sub_vendor, pci_device->sub_product, + pci_device->dev_info->class_name); + + moreprintf(" Vendor Name : %s\n", + pci_device->dev_info->vendor_name); + moreprintf(" Product Name : %s\n", + pci_device->dev_info->product_name); + moreprintf(" PCI bus position : %02x:%02x.%01x\n", __pci_bus, + __pci_slot, __pci_func); + moreprintf(" Kernel modules : %s\n\n", kernel_modules); + } } int main(int argc, char *argv[]) { - struct pci_domain *pci_domain; - int return_code=0; - int nb_pci_devices=0; + struct pci_domain *pci_domain; + int return_code = 0; + int nb_pci_devices = 0; - openconsole(&dev_stdcon_r, &dev_stdcon_w); + openconsole(&dev_stdcon_r, &dev_stdcon_w); - /* Scanning to detect pci buses and devices */ - printf("PCI: Scanning PCI BUS\n"); - pci_domain = pci_scan(); - if (!pci_domain) { + /* Scanning to detect pci buses and devices */ + printf("PCI: Scanning PCI BUS\n"); + pci_domain = pci_scan(); + if (!pci_domain) { printf("PCI: no devices found!\n"); return 1; - } - - struct pci_device *pci_device; - for_each_pci_func(pci_device, pci_domain) { - nb_pci_devices++; - } - - printf("PCI: %d PCI devices found\n",nb_pci_devices); - - - printf("PCI: Looking for device name\n"); - /* Assigning product & vendor name for each device*/ - return_code=get_name_from_pci_ids(pci_domain,"pci.ids"); - if (return_code == -ENOPCIIDS) { - printf("PCI: ERROR !\n"); - printf("PCI: Unable to open pci.ids in the same directory as pcitest.c32.\n"); - printf("PCI: PCI Device names can't be computed.\n"); - } - - printf("PCI: Resolving class names\n"); - /* Assigning class name for each device*/ - return_code=get_class_name_from_pci_ids(pci_domain,"pci.ids"); - if (return_code == -ENOPCIIDS) { - printf("PCI: ERROR !\n"); - printf("PCI: Unable to open pci.ids in the same directory as pcitest.c32.\n"); - printf("PCI: PCI class names can't be computed.\n"); - } - - printf("PCI: Looking for Kernel modules\n"); - /* Detecting which kernel module should match each device */ - return_code=get_module_name_from_pcimap(pci_domain,"modules.pcimap"); - if (return_code == -ENOMODULESPCIMAP) { - printf("PCI: ERROR !\n"); - printf("PCI: Unable to open modules.pcimap in the same directory as pcitest.c32.\n"); - printf("PCI: Kernel Module names can't be computed.\n"); - } - - /* display the pci devices we found */ - display_pci_devices(pci_domain); - return 0; + } + + struct pci_device *pci_device; + for_each_pci_func(pci_device, pci_domain) { + nb_pci_devices++; + } + + printf("PCI: %d PCI devices found\n", nb_pci_devices); + + printf("PCI: Looking for device name\n"); + /* Assigning product & vendor name for each device */ + return_code = get_name_from_pci_ids(pci_domain, "pci.ids"); + if (return_code == -ENOPCIIDS) { + printf("PCI: ERROR !\n"); + printf + ("PCI: Unable to open pci.ids in the same directory as pcitest.c32.\n"); + printf("PCI: PCI Device names can't be computed.\n"); + } + + printf("PCI: Resolving class names\n"); + /* Assigning class name for each device */ + return_code = get_class_name_from_pci_ids(pci_domain, "pci.ids"); + if (return_code == -ENOPCIIDS) { + printf("PCI: ERROR !\n"); + printf + ("PCI: Unable to open pci.ids in the same directory as pcitest.c32.\n"); + printf("PCI: PCI class names can't be computed.\n"); + } + + printf("PCI: Looking for Kernel modules\n"); + /* Detecting which kernel module should match each device */ + return_code = get_module_name_from_pcimap(pci_domain, "modules.pcimap"); + if (return_code == -ENOMODULESPCIMAP) { + printf("PCI: ERROR !\n"); + printf + ("PCI: Unable to open modules.pcimap in the same directory as pcitest.c32.\n"); + printf("PCI: Kernel Module names can't be computed.\n"); + } + + /* display the pci devices we found */ + display_pci_devices(pci_domain); + return 0; } |
