summaryrefslogtreecommitdiffstats
path: root/ogp_spi.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 /ogp_spi.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 'ogp_spi.c')
-rw-r--r--ogp_spi.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/ogp_spi.c b/ogp_spi.c
index 0c09d6a..3aed6e8 100644
--- a/ogp_spi.c
+++ b/ogp_spi.c
@@ -97,12 +97,6 @@ static const struct bitbang_spi_master bitbang_spi_master_ogp = {
.half_period = 0,
};
-static int ogp_spi_shutdown(void *data)
-{
- physunmap(ogp_spibar, 4096);
- return 0;
-}
-
int ogp_spi_init(void)
{
struct pci_dev *dev = NULL;
@@ -137,9 +131,8 @@ int ogp_spi_init(void)
return 1;
io_base_addr = pcidev_readbar(dev, PCI_BASE_ADDRESS_0);
- ogp_spibar = physmap("OGP registers", io_base_addr, 4096);
-
- if (register_shutdown(ogp_spi_shutdown, NULL))
+ ogp_spibar = rphysmap("OGP registers", io_base_addr, 4096);
+ if (ogp_spibar == ERROR_PTR)
return 1;
if (bitbang_spi_init(&bitbang_spi_master_ogp))
OpenPOWER on IntegriCloud