2
1

devmem2-0001-be-coherent-in-type-usage.patch 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From 6570e7afe1eebd64022b871b9ebd9a76be267f57 Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Sun, 29 Jun 2014 16:27:49 +0200
  4. Subject: [PATCH] Be coherent in type usage
  5. - no need to use off_t because it is read from strtoul()
  6. - print unsigned int type correctly
  7. When built with _FILE_OFFSET_BITS=64, off_t becomes an long long int
  8. and was printed as an unsigned int which lead to a garbled output.
  9. Signed-off-by: Colin Didier <colin.didier@devialet.com>
  10. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  11. ---
  12. devmem2.c | 7 +++----
  13. 1 file changed, 3 insertions(+), 4 deletions(-)
  14. diff --git a/devmem2.c b/devmem2.c
  15. index 7732ecb..7aa5c79 100644
  16. --- a/devmem2.c
  17. +++ b/devmem2.c
  18. @@ -58,8 +58,7 @@
  19. int main(int argc, char **argv) {
  20. int fd;
  21. void *map_base, *virt_addr;
  22. - unsigned long read_result, writeval;
  23. - off_t target;
  24. + unsigned long target, read_result, writeval;
  25. int access_type = 'w';
  26. if(argc < 2) {
  27. @@ -101,7 +100,7 @@ int main(int argc, char **argv) {
  28. fprintf(stderr, "Illegal data type '%c'.\n", access_type);
  29. exit(2);
  30. }
  31. - printf("Value at address 0x%X (%p): 0x%X\n", target, virt_addr, read_result);
  32. + printf("Value at address 0x%lX (%p): 0x%X\n", target, virt_addr, read_result);
  33. fflush(stdout);
  34. if(argc > 3) {
  35. @@ -120,7 +119,7 @@ int main(int argc, char **argv) {
  36. read_result = *((unsigned long *) virt_addr);
  37. break;
  38. }
  39. - printf("Written 0x%X; readback 0x%X\n", writeval, read_result);
  40. + printf("Written 0x%lX; readback 0x%X\n", writeval, read_result);
  41. fflush(stdout);
  42. }
  43. --
  44. 2.0.0