1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 22:43:17 +02:00

programmer_table: convert entries to pointers

Allows us to move the individual entries into their respective driver files.

Change-Id: Ifbb0ee4db5a85b1cd2afeafe4dca838579f79878
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/52945
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Thomas Heijligen
2021-03-31 19:09:44 +02:00
committed by Nico Huber
parent 9e09095877
commit dee884ebc5
7 changed files with 572 additions and 410 deletions

20
print.c
View File

@ -425,10 +425,10 @@ static void print_supported_boards_helper(const struct board_info *boards,
}
#endif
static void print_supported_devs(const struct programmer_entry prog, const char *const type)
static void print_supported_devs(const struct programmer_entry *const prog, const char *const type)
{
const struct dev_entry *const devs = prog.devs.dev;
msg_ginfo("\nSupported %s devices for the %s programmer:\n", type, prog.name);
const struct dev_entry *const devs = prog->devs.dev;
msg_ginfo("\nSupported %s devices for the %s programmer:\n", type, prog->name);
unsigned int maxvendorlen = strlen("Vendor") + 1;
unsigned int maxdevlen = strlen("Device") + 1;
@ -475,7 +475,7 @@ int print_supported(void)
msg_ginfo("\n");
#if CONFIG_INTERNAL == 1
msg_ginfo("\nSupported devices for the %s programmer:\n\n",
programmer_table[PROGRAMMER_INTERNAL].name);
programmer_table[PROGRAMMER_INTERNAL]->name);
print_supported_chipsets();
msg_ginfo("\n");
print_supported_boards_helper(boards_known, "mainboards");
@ -483,8 +483,8 @@ int print_supported(void)
print_supported_boards_helper(laptops_known, "mobile devices");
#endif
for (i = 0; i < PROGRAMMER_INVALID; i++) {
const struct programmer_entry prog = programmer_table[i];
switch (prog.type) {
const struct programmer_entry *const prog = programmer_table[i];
switch (prog->type) {
case USB:
print_supported_devs(prog, "USB");
break;
@ -492,14 +492,14 @@ int print_supported(void)
print_supported_devs(prog, "PCI");
break;
case OTHER:
if (prog.devs.note != NULL) {
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 "
"flashrom@flashrom.org\n", __func__, prog.name);
"flashrom@flashrom.org\n", __func__, prog->name);
break;
}
}