From 03cafbfdfe10d6797740c4456fd3a80c499e1c0b Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Fri, 6 Apr 2007 11:58:03 +0000 Subject: 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. Signed-off-by: Stefan Reinauer Acked-by: Stefan Reinauer git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2585 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- util/flashrom/lbtable.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'util/flashrom/lbtable.c') diff --git a/util/flashrom/lbtable.c b/util/flashrom/lbtable.c index 2adf5c9c36..4409e51d8f 100644 --- a/util/flashrom/lbtable.c +++ b/util/flashrom/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); -- cgit v1.2.3