From 5561955b1158e8bd29299735abef1e26a5a9cdbc Mon Sep 17 00:00:00 2001 From: Stefan Tauner Date: Fri, 4 Jan 2013 22:24:58 +0000 Subject: 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 Acked-by: Carl-Daniel Hailfinger --- nicintel_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nicintel_spi.c') diff --git a/nicintel_spi.c b/nicintel_spi.c index 325e61cb1..f61c2b1de 100644 --- a/nicintel_spi.c +++ b/nicintel_spi.c @@ -160,7 +160,6 @@ static int nicintel_spi_shutdown(void *data) pci_mmio_writel(tmp, nicintel_spibar + EECD); physunmap(nicintel_spibar, MEMMAP_SIZE); - pci_cleanup(pacc); return 0; } @@ -172,6 +171,7 @@ int nicintel_spi_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_intel_spi); nicintel_spibar = physmap("Intel Gigabit NIC w/ SPI flash", -- cgit v1.2.3