summaryrefslogtreecommitdiffstats
path: root/lbtable.c
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@coresystems.de>2007-04-06 11:58:03 +0000
committerStefan Reinauer <stefan.reinauer@coreboot.org>2007-04-06 11:58:03 +0000
commit7038564346f660ce043d7942398f3e8a3a2db7ad (patch)
tree2d6573bc465284fa3fc57fe2afaa8f7b1dabd1ad /lbtable.c
parent8e3a600123110d47076926cb8ee7c68195658f20 (diff)
downloadast2050-flashrom-7038564346f660ce043d7942398f3e8a3a2db7ad.zip
ast2050-flashrom-7038564346f660ce043d7942398f3e8a3a2db7ad.tar.gz
Trivial (cosmetic) cleanup
* Only open /dev/mem once and do it early. * Drop extern for function prototypes. * Minimize ts5300 impact in probe_flash() This cleanup will making ICH7 SPI support quite some easier. Corresponding to flashrom svn r100 and coreboot v2 svn r2585. Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Stefan Reinauer <stepan@coresystems.de>
Diffstat (limited to 'lbtable.c')
-rw-r--r--lbtable.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/lbtable.c b/lbtable.c
index 2adf5c9..4409e51 100644
--- a/lbtable.c
+++ b/lbtable.c
@@ -158,14 +158,8 @@ int linuxbios_init(void)
struct lb_header *lb_table;
struct lb_record *rec, *last;
- int fd;
- fd = open(MEM_DEV, O_RDONLY);
- if (fd < 0) {
- fprintf(stderr, "Can not access memory using " MEM_DEV "\n");
- exit(-1);
- }
- low_1MB = mmap(0, 1024*1024, PROT_READ, MAP_SHARED, fd, 0x00000000);
- if (low_1MB == ((void *) -1)) {
+ low_1MB = mmap(0, 1024*1024, PROT_READ, MAP_SHARED, fd_mem, 0x00000000);
+ if (low_1MB == MAP_FAILED) {
fprintf(stderr, "Can not mmap " MEM_DEV " at %08lx errno(%d):%s\n",
0x00000000UL, errno, strerror(errno));
exit(-2);
OpenPOWER on IntegriCloud