mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-02 06:23:18 +02:00
Automatically unmap physmap()s
Similarly to the previous PCI self-clean up patch this one allows to get rid of a huge number of programmer shutdown functions and makes introducing bugs harder. It adds a new function rphysmap() that takes care of unmapping at shutdown. Callers are changed where it makes sense. Corresponding to flashrom svn r1714. 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:
11
gfxnvidia.c
11
gfxnvidia.c
@ -77,12 +77,6 @@ static const struct par_programmer par_programmer_gfxnvidia = {
|
||||
.chip_writen = fallback_chip_writen,
|
||||
};
|
||||
|
||||
static int gfxnvidia_shutdown(void *data)
|
||||
{
|
||||
physunmap(nvidia_bar, GFXNVIDIA_MEMMAP_SIZE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gfxnvidia_init(void)
|
||||
{
|
||||
struct pci_dev *dev = NULL;
|
||||
@ -99,9 +93,8 @@ int gfxnvidia_init(void)
|
||||
io_base_addr += 0x300000;
|
||||
msg_pinfo("Detected NVIDIA I/O base address: 0x%x.\n", io_base_addr);
|
||||
|
||||
nvidia_bar = physmap("NVIDIA", io_base_addr, GFXNVIDIA_MEMMAP_SIZE);
|
||||
|
||||
if (register_shutdown(gfxnvidia_shutdown, NULL))
|
||||
nvidia_bar = rphysmap("NVIDIA", io_base_addr, GFXNVIDIA_MEMMAP_SIZE);
|
||||
if (nvidia_bar == ERROR_PTR)
|
||||
return 1;
|
||||
|
||||
/* Allow access to flash interface (will disable screen). */
|
||||
|
Reference in New Issue
Block a user