diff options
author | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2012-12-27 18:40:36 +0000 |
---|---|---|
committer | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2012-12-27 18:40:36 +0000 |
commit | 841a9973f2d1825203bdee79593a44767b515e26 (patch) | |
tree | b4ba0971a1d5ff2f8e1693ae66b33e8c8cda1843 /print.c | |
parent | 342bb7a0365d0faa8d451344900e4cfd91a63d09 (diff) | |
download | flashrom-841a9973f2d1825203bdee79593a44767b515e26.zip flashrom-841a9973f2d1825203bdee79593a44767b515e26.tar.gz |
Unify usbdev_status and pcidev_status into dev_entry
Once upon a time usbdev_status was created for the ft2232
programmer. Its IDs are semantically different to pcidev_status
because they indicate USB instead of PCI IDs, but apart from that
both data structures are equal. This change makes life easier for
everything involved in handling and printing the status of devices
that is noted in those structures by combining them into dev_entry.
It is still possible to distinguish between PCI and USB devices
indirectly by using the struct programmer's type field.
Also, add a programmer column to the PCI and USB devices lists.
Corresponding to flashrom svn r1632.
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to 'print.c')
-rw-r--r-- | print.c | 31 |
1 files changed, 9 insertions, 22 deletions
@@ -433,29 +433,18 @@ static void print_supported_boards_helper(const struct board_info *boards, } #endif -void print_supported_usbdevs(const struct usbdev_status *devs) +void print_supported_devs(const struct programmer_entry prog, const char *const type) { int i; - msg_pinfo("USB devices:\n"); + const struct dev_entry *const devs = prog.devs.dev; + msg_ginfo("\nSupported %s devices for the %s programmer:\n", type, prog.name); for (i = 0; devs[i].vendor_name != NULL; i++) { msg_pinfo("%s %s [%04x:%04x]%s\n", devs[i].vendor_name, devs[i].device_name, devs[i].vendor_id, devs[i].device_id, (devs[i].status == NT) ? " (untested)" : ""); } } -#if NEED_PCI == 1 -void print_supported_pcidevs(const struct pcidev_status *devs) -{ - int i; - - for (i = 0; devs[i].vendor_name != NULL; i++) { - msg_pinfo("%s %s [%04x:%04x]%s\n", devs[i].vendor_name, devs[i].device_name, devs[i].vendor_id, - devs[i].device_id, (devs[i].status == NT) ? " (untested)" : ""); - } -} -#endif - int print_supported(void) { unsigned int i; @@ -478,20 +467,18 @@ int print_supported(void) const struct programmer_entry prog = programmer_table[i]; switch (prog.type) { case USB: - msg_ginfo("\nSupported USB devices for the %s programmer:\n", prog.name); - print_supported_usbdevs(prog.devs.usb); + print_supported_devs(prog, "USB"); break; #if NEED_PCI == 1 case PCI: - msg_ginfo("\nSupported PCI devices for the %s programmer:\n", prog.name); - print_supported_pcidevs(prog.devs.pci); + print_supported_devs(prog, "PCI"); break; #endif case OTHER: - if (prog.devs.note == NULL) - break; - msg_ginfo("\nSupported devices for the %s programmer:\n", prog.name); - msg_ginfo("%s", prog.devs.note); + if (prog.devs.note != NULL) { + msg_ginfo("\nSupported devices for the %s programmer:\n", prog.name); + msg_ginfo("%s", prog.devs.note); + } break; default: msg_gerr("\n%s: %s: Uninitialized programmer type! Please report a bug at " |