Staging: fbtft: Fix bug in fbtft-core
authorKsenija Stanojevic <ksenija.stanojevic@gmail.com>
Sun, 2 Oct 2016 15:42:35 +0000 (17:42 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 2 Oct 2016 17:51:05 +0000 (19:51 +0200)
Commit 367e8560e8d7a62d96e9b1d644028a3816e04206 introduced a bug
in fbtft-core where fps is always 0, this is because variable
update_time is not assigned correctly.

Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Fixes: 367e8560e8d7 ("Staging: fbtbt: Replace timespec with ktime_t")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fbtft/fbtft-core.c

index d90461627552758c96216cdbf9c98b2e72580007..587f68aa466c2ee41c32e7d2822874eaaae91986 100644 (file)
@@ -391,11 +391,11 @@ static void fbtft_update_display(struct fbtft_par *par, unsigned int start_line,
 
        if (unlikely(timeit)) {
                ts_end = ktime_get();
-               if (ktime_to_ns(par->update_time))
+               if (!ktime_to_ns(par->update_time))
                        par->update_time = ts_start;
 
-               par->update_time = ts_start;
                fps = ktime_us_delta(ts_start, par->update_time);
+               par->update_time = ts_start;
                fps = fps ? 1000000 / fps : 0;
 
                throughput = ktime_us_delta(ts_end, ts_start);