From 305e0b999a7d452a845709d5558c17a31afe178c Mon Sep 17 00:00:00 2001 From: Stefan Tauner Date: Wed, 17 Jul 2013 23:46:44 +0000 Subject: Uintptr_t-ify map_flash_region functions Unsigned long is not the right type for manipulating pointer values. Since C99 there are suitable unsigned and signed types available, namely uintptr_t and intptr_t respectively. Use them in functions assigned to programmers' map_flash_region fields and their callers where applicable. This patch also changes the display width of all associated address values in physmap.c to 16/8 hex characters depending on the actual size by introducing a macro PRIxPTR_WIDTH and exploiting printf's * field width specifier. Corresponding to flashrom svn r1701. Signed-off-by: Stefan Tauner Acked-by: Carl-Daniel Hailfinger --- flash.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'flash.h') diff --git a/flash.h b/flash.h index 9e787c0..cba7bd8 100644 --- a/flash.h +++ b/flash.h @@ -43,10 +43,10 @@ /* TODO: check using code for correct usage of types */ typedef uintptr_t chipaddr; +#define PRIxPTR_WIDTH ((int)(sizeof(uintptr_t)*2)) int register_shutdown(int (*function) (void *data), void *data); -void *programmer_map_flash_region(const char *descr, unsigned long phys_addr, - size_t len); +void *programmer_map_flash_region(const char *descr, uintptr_t phys_addr, size_t len); void programmer_unmap_flash_region(void *virt_addr, size_t len); void programmer_delay(int usecs); -- cgit v1.1