mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-01 22:21:16 +02:00
Unify PCI init and let pcidev clean itself up
Previously the internal programmer used its own code to initialize pcilib. This patch extracts the common code from the internal programmer and pcidev_init() into pcidev_init_common(). This fixes the non-existent PCI cleanup of the internal programmer and adds an additional safety by checking for an already existing PCI context. We got a nice shutdown function registration infrastructure, but did not use it very wisely. Instead we added shutdown functions to a myriad of programmers unnecessarily. In this patch we get rid of those that do only call pci_cleanup(pacc) by adding a shutdown function the pcidev.c itself that gets registered by pcidev_init(). Corresponding to flashrom svn r1642. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:
@ -54,7 +54,6 @@ static const struct par_programmer par_programmer_nicrealtek = {
|
||||
static int nicrealtek_shutdown(void *data)
|
||||
{
|
||||
/* FIXME: We forgot to disable software access again. */
|
||||
pci_cleanup(pacc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -63,8 +62,8 @@ int nicrealtek_init(void)
|
||||
if (rget_io_perms())
|
||||
return 1;
|
||||
|
||||
/* No need to check for errors, pcidev_init() will not return in case of errors. */
|
||||
io_base_addr = pcidev_init(PCI_BASE_ADDRESS_0, nics_realtek);
|
||||
|
||||
if (register_shutdown(nicrealtek_shutdown, NULL))
|
||||
return 1;
|
||||
|
||||
|
Reference in New Issue
Block a user