Optimize the code

With this patch the content of the debugfs file is readen only when the
'refresh' button is hit and at the init of powerdebug.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
diff --git a/display.c b/display.c
index 38596b0..23a4172 100644
--- a/display.c
+++ b/display.c
@@ -111,14 +111,14 @@
 	return 0;
 }
 
-int display_refresh(int win)
+static int display_refresh(int win, bool read)
 {
 	/* we are trying to refresh a window which is not showed */
 	if (win != current_win)
 		return 0;
 
 	if (windata[win].ops && windata[win].ops->display)
-		return windata[win].ops->display();
+		return windata[win].ops->display(read);
 
 	return 0;
 }
@@ -391,13 +391,12 @@
 
 	case 'r':
 	case 'R':
-		/* refresh will be done after */
-		break;
+		return display_refresh(current_win, true);
 	default:
 		return 0;
 	}
 
-	display_refresh(current_win);
+	display_refresh(current_win, false);
 
 	return 0;
 }
@@ -416,7 +415,7 @@
 	if (display_show_footer(current_win, NULL))
 		return -1;
 
-	return display_refresh(current_win);
+	return display_refresh(current_win, false);
 }
 
 static int display_find_keystroke(int fd, void *data)
@@ -547,7 +546,7 @@
 	if (display_show_footer(wdefault, NULL))
 		return -1;
 
-	return display_refresh(wdefault);
+	return display_refresh(wdefault, true);
 }
 
 int display_column_name(const char *line)