diff options
author | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-06-10 13:37:16 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-06-11 06:34:30 -0400 |
commit | 82d229cde00f7476b223c3ac5ded0248014cdeb7 (patch) | |
tree | 961a10b881f14d58e27b77741a8db33cb437305a /drivers/media | |
parent | bc5e66bd2591424f0e08d5478a36a8074fe739f5 (diff) |
[media] bdisp-debug: don't try to divide by s64
There are several warnings there, on some architectures, related
to dividing a s32 by a s64 value:
drivers/media/platform/sti/bdisp/bdisp-debug.c:594: warning: comparison of distinct pointer types lacks a cast
drivers/media/platform/sti/bdisp/bdisp-debug.c:594: warning: right shift count >= width of type
drivers/media/platform/sti/bdisp/bdisp-debug.c:594: warning: passing argument 1 of '__div64_32' from incompatible pointer type
drivers/media/platform/sti/bdisp/bdisp-debug.c:595: warning: comparison of distinct pointer types lacks a cast
drivers/media/platform/sti/bdisp/bdisp-debug.c:595: warning: right shift count >= width of type
drivers/media/platform/sti/bdisp/bdisp-debug.c:595: warning: passing argument 1 of '__div64_32' from incompatible pointer type CC [M] drivers/media/tuners/mt2060.o
drivers/media/platform/sti/bdisp/bdisp-debug.c:596: warning: comparison of distinct pointer types lacks a cast
drivers/media/platform/sti/bdisp/bdisp-debug.c:596: warning: right shift count >= width of type
drivers/media/platform/sti/bdisp/bdisp-debug.c:596: warning: passing argument 1 of '__div64_32' from incompatible pointer type
drivers/media/platform/sti/bdisp/bdisp-debug.c:597: warning: comparison of distinct pointer types lacks a cast
drivers/media/platform/sti/bdisp/bdisp-debug.c:597: warning: right shift count >= width of type
drivers/media/platform/sti/bdisp/bdisp-debug.c:597: warning: passing argument 1 of '__div64_32' from incompatible pointer type
That doesn't make much sense. What the driver is actually trying
to do is to divide one second by a value. So, check the range
before dividing. That warrants the right result and will remove
the warnings on non-64 bits archs.
Also fixes this warning:
drivers/media/platform/sti/bdisp/bdisp-debug.c:588: warning: comparison of distinct pointer types lacks a cast
by using div64_s64() instead of calling do_div() directly.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/platform/sti/bdisp/bdisp-debug.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/drivers/media/platform/sti/bdisp/bdisp-debug.c b/drivers/media/platform/sti/bdisp/bdisp-debug.c index 7c3a632746ba..18282a0f80c9 100644 --- a/drivers/media/platform/sti/bdisp/bdisp-debug.c +++ b/drivers/media/platform/sti/bdisp/bdisp-debug.c | |||
@@ -572,6 +572,8 @@ static int bdisp_dbg_regs(struct seq_file *s, void *data) | |||
572 | return 0; | 572 | return 0; |
573 | } | 573 | } |
574 | 574 | ||
575 | #define SECOND 1000000 | ||
576 | |||
575 | static int bdisp_dbg_perf(struct seq_file *s, void *data) | 577 | static int bdisp_dbg_perf(struct seq_file *s, void *data) |
576 | { | 578 | { |
577 | struct bdisp_dev *bdisp = s->private; | 579 | struct bdisp_dev *bdisp = s->private; |
@@ -584,17 +586,26 @@ static int bdisp_dbg_perf(struct seq_file *s, void *data) | |||
584 | return 0; | 586 | return 0; |
585 | } | 587 | } |
586 | 588 | ||
587 | avg_time_us = bdisp->dbg.tot_duration; | 589 | avg_time_us = div64_s64(bdisp->dbg.tot_duration, request->nb_req); |
588 | do_div(avg_time_us, request->nb_req); | 590 | if (avg_time_us > SECOND) |
589 | 591 | avg_fps = 0; | |
590 | avg_fps = 1000000; | 592 | else |
591 | min_fps = 1000000; | 593 | avg_fps = SECOND / (s32)avg_time_us; |
592 | max_fps = 1000000; | 594 | |
593 | last_fps = 1000000; | 595 | if (bdisp->dbg.min_duration > SECOND) |
594 | do_div(avg_fps, avg_time_us); | 596 | min_fps = 0; |
595 | do_div(min_fps, bdisp->dbg.min_duration); | 597 | else |
596 | do_div(max_fps, bdisp->dbg.max_duration); | 598 | min_fps = SECOND / (s32)bdisp->dbg.min_duration; |
597 | do_div(last_fps, bdisp->dbg.last_duration); | 599 | |
600 | if (bdisp->dbg.max_duration > SECOND) | ||
601 | max_fps = 0; | ||
602 | else | ||
603 | max_fps = SECOND / (s32)bdisp->dbg.max_duration; | ||
604 | |||
605 | if (bdisp->dbg.last_duration > SECOND) | ||
606 | last_fps = 0; | ||
607 | else | ||
608 | last_fps = SECOND / (s32)bdisp->dbg.last_duration; | ||
598 | 609 | ||
599 | seq_printf(s, "HW processing (%d requests):\n", request->nb_req); | 610 | seq_printf(s, "HW processing (%d requests):\n", request->nb_req); |
600 | seq_printf(s, " Average: %5lld us (%3d fps)\n", | 611 | seq_printf(s, " Average: %5lld us (%3d fps)\n", |