]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
staging: fbtft: replace ternary operator with min macro
authorAlison Schofield <amsfield22@gmail.com>
Wed, 24 Feb 2016 17:20:17 +0000 (09:20 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 12 Mar 2016 06:09:09 +0000 (22:09 -0800)
Use macro min() to get the minimum of two values for
brevity and readability.

Found using Coccinelle:
@@ type T; T x; T y; @@
(
- x < y ? x : y
+ min(x,y)
|
- x > y ? x : y
+ max(x,y)
)

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fbtft/fb_ra8875.c
drivers/staging/fbtft/fbtft-bus.c

index b167c50616318a94e98c766c9ef972f05fc60fbc..0585e0bafd7bb1a852b36d75eba6ff702de9a609 100644 (file)
@@ -277,7 +277,7 @@ static int write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len)
                startbyte_size = 1;
 
        while (remain) {
-               to_copy = remain > tx_array_size ? tx_array_size : remain;
+               to_copy = min(tx_array_size, remain);
                dev_dbg(par->info->device, "    to_copy=%zu, remain=%zu\n",
                        to_copy, remain - to_copy);
 
index 58449ad84f46c17f842cc32e04ee5c18cf2b58c0..b31f1114c907ba285cec09612d5b0f4274cf3ca0 100644 (file)
@@ -157,7 +157,7 @@ int fbtft_write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len)
        }
 
        while (remain) {
-               to_copy = remain > tx_array_size ? tx_array_size : remain;
+               to_copy = min(tx_array_size, remain);
                dev_dbg(par->info->device, "    to_copy=%zu, remain=%zu\n",
                                                to_copy, remain - to_copy);
 
@@ -201,7 +201,7 @@ int fbtft_write_vmem16_bus9(struct fbtft_par *par, size_t offset, size_t len)
        tx_array_size = par->txbuf.len / 2;
 
        while (remain) {
-               to_copy = remain > tx_array_size ? tx_array_size : remain;
+               to_copy = min(tx_array_size, remain);
                dev_dbg(par->info->device, "    to_copy=%zu, remain=%zu\n",
                                                to_copy, remain - to_copy);