Anastasia Klimchuk has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/57156 )
Change subject: par_master: Use new API to register shutdown function ......................................................................
par_master: Use new API to register shutdown function
For those programmers that have shutdown function (nic3com and nicrealtek), this allows par masters to register shutdown function in par_master struct, which means there is no need to call register_shutdown in init function, since this call is now a part of register_par_master.
For all the programmers here this patch fixes propagation of register_par_master() return values (potential errors are not ignored anymore.
BUG=b:185191942 TEST=builds and ninja test
Change-Id: Ief7be907f53878b4b6567b52889735e5fff64ead Signed-off-by: Anastasia Klimchuk aklm@chromium.org --- M atahpt.c M atapromise.c M atavia.c M drkaiser.c M gfxnvidia.c M it8212.c M nic3com.c M nicintel.c M nicnatsemi.c M nicrealtek.c M satamv.c M satasii.c 12 files changed, 14 insertions(+), 43 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/56/57156/1
diff --git a/atahpt.c b/atahpt.c index 0da39e0..c627e0b 100644 --- a/atahpt.c +++ b/atahpt.c @@ -85,9 +85,7 @@ reg32 |= (1 << 24); rpci_write_long(dev, REG_FLASH_ACCESS, reg32);
- register_par_master(&par_master_atahpt, BUS_PARALLEL, NULL); - - return 0; + return register_par_master(&par_master_atahpt, BUS_PARALLEL, NULL); }
const struct programmer_entry programmer_atahpt = { diff --git a/atapromise.c b/atapromise.c index 171b22f..e3009e4 100644 --- a/atapromise.c +++ b/atapromise.c @@ -152,14 +152,13 @@ }
max_rom_decode.parallel = rom_size; - register_par_master(&par_master_atapromise, BUS_PARALLEL, NULL);
msg_pwarn("Do not use this device as a generic programmer. It will leave anything outside\n" "the first %zu kB of the flash chip in an undefined state. It works fine for the\n" "purpose of updating the firmware of this device (padding may necessary).\n", rom_size / 1024);
- return 0; + return register_par_master(&par_master_atapromise, BUS_PARALLEL, NULL); }
const struct programmer_entry programmer_atapromise = { diff --git a/atavia.c b/atavia.c index f8b9738..b110d54 100644 --- a/atavia.c +++ b/atavia.c @@ -184,9 +184,7 @@ return 1; }
- register_par_master(&lpc_master_atavia, BUS_LPC, NULL); - - return 0; + return register_par_master(&lpc_master_atavia, BUS_LPC, NULL); }
const struct programmer_entry programmer_atavia = { diff --git a/drkaiser.c b/drkaiser.c index 111bb97..27c15fb 100644 --- a/drkaiser.c +++ b/drkaiser.c @@ -85,9 +85,7 @@ return 1;
max_rom_decode.parallel = 128 * 1024; - register_par_master(&par_master_drkaiser, BUS_PARALLEL, NULL); - - return 0; + return register_par_master(&par_master_drkaiser, BUS_PARALLEL, NULL); }
const struct programmer_entry programmer_drkaiser = { diff --git a/gfxnvidia.c b/gfxnvidia.c index 468fc6c..760b76b 100644 --- a/gfxnvidia.c +++ b/gfxnvidia.c @@ -111,9 +111,7 @@
/* Write/erase doesn't work. */ programmer_may_write = 0; - register_par_master(&par_master_gfxnvidia, BUS_PARALLEL, NULL); - - return 0; + return register_par_master(&par_master_gfxnvidia, BUS_PARALLEL, NULL); }
const struct programmer_entry programmer_gfxnvidia = { diff --git a/it8212.c b/it8212.c index 620a15c..e47f6f8 100644 --- a/it8212.c +++ b/it8212.c @@ -75,8 +75,7 @@ rpci_write_long(dev, PCI_ROM_ADDRESS, io_base_addr | 0x01);
max_rom_decode.parallel = IT8212_MEMMAP_SIZE; - register_par_master(&par_master_it8212, BUS_PARALLEL, NULL); - return 0; + return register_par_master(&par_master_it8212, BUS_PARALLEL, NULL); } const struct programmer_entry programmer_it8212 = { .name = "it8212", diff --git a/nic3com.c b/nic3com.c index dd3d0cb..2af0a52 100644 --- a/nic3com.c +++ b/nic3com.c @@ -99,6 +99,7 @@ .chip_writew = fallback_chip_writew, .chip_writel = fallback_chip_writel, .chip_writen = fallback_chip_writen, + .shutdown = nic3com_shutdown, };
static int nic3com_init(void) @@ -150,13 +151,7 @@
max_rom_decode.parallel = 128 * 1024;
- if (register_shutdown(nic3com_shutdown, data)) { - free(data); - goto init_err_cleanup_exit; - } - register_par_master(&par_master_nic3com, BUS_PARALLEL, data); - - return 0; + return register_par_master(&par_master_nic3com, BUS_PARALLEL, data);
init_err_cleanup_exit: /* 3COM 3C90xB cards need a special fixup. */ diff --git a/nicintel.c b/nicintel.c index ada615e..c5b9012 100644 --- a/nicintel.c +++ b/nicintel.c @@ -107,9 +107,7 @@ pci_rmmio_writew(0x0001, nicintel_control_bar + CSR_FCR);
max_rom_decode.parallel = NICINTEL_MEMMAP_SIZE; - register_par_master(&par_master_nicintel, BUS_PARALLEL, NULL); - - return 0; + return register_par_master(&par_master_nicintel, BUS_PARALLEL, NULL); }
const struct programmer_entry programmer_nicintel = { diff --git a/nicnatsemi.c b/nicnatsemi.c index 17e05c8..b2f381a 100644 --- a/nicnatsemi.c +++ b/nicnatsemi.c @@ -97,9 +97,7 @@ * functions below wants to be 0x0000FFFF. */ max_rom_decode.parallel = 131072; - register_par_master(&par_master_nicnatsemi, BUS_PARALLEL, NULL); - - return 0; + return register_par_master(&par_master_nicnatsemi, BUS_PARALLEL, NULL); }
diff --git a/nicrealtek.c b/nicrealtek.c index b8125f4..ec821b4 100644 --- a/nicrealtek.c +++ b/nicrealtek.c @@ -95,6 +95,7 @@ .chip_writew = fallback_chip_writew, .chip_writel = fallback_chip_writel, .chip_writen = fallback_chip_writen, + .shutdown = nicrealtek_shutdown, };
static int nicrealtek_init(void) @@ -138,14 +139,7 @@ data->bios_rom_addr = bios_rom_addr; data->bios_rom_data = bios_rom_data;
- if (register_shutdown(nicrealtek_shutdown, data)) { - free(data); - return 1; - } - - register_par_master(&par_master_nicrealtek, BUS_PARALLEL, data); - - return 0; + return register_par_master(&par_master_nicrealtek, BUS_PARALLEL, data); }
const struct programmer_entry programmer_nicrealtek = { diff --git a/satamv.c b/satamv.c index 3996a4b..32ac11a 100644 --- a/satamv.c +++ b/satamv.c @@ -179,9 +179,7 @@ /* 512 kByte with two 8-bit latches, and * 4 MByte with additional 3-bit latch. */ max_rom_decode.parallel = 4 * 1024 * 1024; - register_par_master(&par_master_satamv, BUS_PARALLEL, NULL); - - return 0; + return register_par_master(&par_master_satamv, BUS_PARALLEL, NULL); }
const struct programmer_entry programmer_satamv = { diff --git a/satasii.c b/satasii.c index fe7ac15..321ef7f 100644 --- a/satasii.c +++ b/satasii.c @@ -129,9 +129,7 @@ if ((id != 0x0680) && (!(pci_mmio_readl(sii_bar) & (1 << 26)))) msg_pwarn("Warning: Flash seems unconnected.\n");
- register_par_master(&par_master_satasii, BUS_PARALLEL, NULL); - - return 0; + return register_par_master(&par_master_satasii, BUS_PARALLEL, NULL); } const struct programmer_entry programmer_satasii = { .name = "satasii",