summaryrefslogtreecommitdiffstats
path: root/drkaiser.c
diff options
context:
space:
mode:
authorStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2013-08-14 15:48:44 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2013-08-14 15:48:44 +0000
commit7fb5aa049bee3c685835dc24c8184c5897e4a6bd (patch)
tree3d193e98d25da24307824ab8d0939f3538ec2e50 /drkaiser.c
parent36e9f4b3595c6e8b13f80f85785a91b65ecad62f (diff)
downloadast2050-flashrom-7fb5aa049bee3c685835dc24c8184c5897e4a6bd.zip
ast2050-flashrom-7fb5aa049bee3c685835dc24c8184c5897e4a6bd.tar.gz
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>
Diffstat (limited to 'drkaiser.c')
-rw-r--r--drkaiser.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/drkaiser.c b/drkaiser.c
index b94d6dd..8c9fb6a 100644
--- a/drkaiser.c
+++ b/drkaiser.c
@@ -56,12 +56,6 @@ static const struct par_programmer par_programmer_drkaiser = {
.chip_writen = fallback_chip_writen,
};
-static int drkaiser_shutdown(void *data)
-{
- physunmap(drkaiser_bar, DRKAISER_MEMMAP_SIZE);
- return 0;
-}
-
int drkaiser_init(void)
{
struct pci_dev *dev = NULL;
@@ -80,10 +74,8 @@ int drkaiser_init(void)
rpci_write_word(dev, PCI_MAGIC_DRKAISER_ADDR, PCI_MAGIC_DRKAISER_VALUE);
/* Map 128kB flash memory window. */
- drkaiser_bar = physmap("Dr. Kaiser PC-Waechter flash memory",
- addr, DRKAISER_MEMMAP_SIZE);
-
- if (register_shutdown(drkaiser_shutdown, NULL))
+ drkaiser_bar = rphysmap("Dr. Kaiser PC-Waechter flash memory", addr, DRKAISER_MEMMAP_SIZE);
+ if (drkaiser_bar == ERROR_PTR)
return 1;
max_rom_decode.parallel = 128 * 1024;
OpenPOWER on IntegriCloud