aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/hibernate.c
diff options
context:
space:
mode:
authorChen Gang <gang.chen.5i5j@gmail.com>2014-04-24 20:44:59 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-04-28 07:02:12 -0400
commit4881f603d7b82df2bc15efd2a272f973a3bf8df1 (patch)
tree8bbe70d82d020e1203059d16936de6ca9b191f32 /kernel/power/hibernate.c
parentd1db0eea852497762cab43b905b879dfcd3b8987 (diff)
PM / hibernate: use unsigned local variables in swsusp_show_speed()
do_div() needs 'u64' type, or it reports warning. And negative number is meaningless for "speed", so change all signed to unsigned within swsusp_show_speed(). The related warning (with allmodconfig for unicore32): CC kernel/power/hibernate.o kernel/power/hibernate.c: In function ‘swsusp_show_speed’: kernel/power/hibernate.c:237: warning: comparison of distinct pointer types lacks a cast Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> [rjw: Subject] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'kernel/power/hibernate.c')
-rw-r--r--kernel/power/hibernate.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index f4f2073711d3..de4b989cc8fd 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -228,19 +228,23 @@ static void platform_recover(int platform_mode)
228void swsusp_show_speed(struct timeval *start, struct timeval *stop, 228void swsusp_show_speed(struct timeval *start, struct timeval *stop,
229 unsigned nr_pages, char *msg) 229 unsigned nr_pages, char *msg)
230{ 230{
231 s64 elapsed_centisecs64; 231 u64 elapsed_centisecs64;
232 int centisecs; 232 unsigned int centisecs;
233 int k; 233 unsigned int k;
234 int kps; 234 unsigned int kps;
235 235
236 elapsed_centisecs64 = timeval_to_ns(stop) - timeval_to_ns(start); 236 elapsed_centisecs64 = timeval_to_ns(stop) - timeval_to_ns(start);
237 /*
238 * If "(s64)elapsed_centisecs64 < 0", it will print long elapsed time,
239 * it is obvious enough for what went wrong.
240 */
237 do_div(elapsed_centisecs64, NSEC_PER_SEC / 100); 241 do_div(elapsed_centisecs64, NSEC_PER_SEC / 100);
238 centisecs = elapsed_centisecs64; 242 centisecs = elapsed_centisecs64;
239 if (centisecs == 0) 243 if (centisecs == 0)
240 centisecs = 1; /* avoid div-by-zero */ 244 centisecs = 1; /* avoid div-by-zero */
241 k = nr_pages * (PAGE_SIZE / 1024); 245 k = nr_pages * (PAGE_SIZE / 1024);
242 kps = (k * 100) / centisecs; 246 kps = (k * 100) / centisecs;
243 printk(KERN_INFO "PM: %s %d kbytes in %d.%02d seconds (%d.%02d MB/s)\n", 247 printk(KERN_INFO "PM: %s %u kbytes in %u.%02u seconds (%u.%02u MB/s)\n",
244 msg, k, 248 msg, k,
245 centisecs / 100, centisecs % 100, 249 centisecs / 100, centisecs % 100,
246 kps / 1000, (kps % 1000) / 10); 250 kps / 1000, (kps % 1000) / 10);