Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3589d3c9 authored by Alison Schofield's avatar Alison Schofield Committed by Greg Kroah-Hartman
Browse files

staging: fbtft: replace ternary operator with min macro



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: default avatarAlison Schofield <amsfield22@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7ce1b3d3
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -277,7 +277,7 @@ static int write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len)
		startbyte_size = 1;
		startbyte_size = 1;


	while (remain) {
	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",
		dev_dbg(par->info->device, "    to_copy=%zu, remain=%zu\n",
			to_copy, remain - to_copy);
			to_copy, remain - to_copy);


+2 −2
Original line number Original line Diff line number Diff line
@@ -157,7 +157,7 @@ int fbtft_write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len)
	}
	}


	while (remain) {
	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",
		dev_dbg(par->info->device, "    to_copy=%zu, remain=%zu\n",
						to_copy, remain - to_copy);
						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;
	tx_array_size = par->txbuf.len / 2;


	while (remain) {
	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",
		dev_dbg(par->info->device, "    to_copy=%zu, remain=%zu\n",
						to_copy, remain - to_copy);
						to_copy, remain - to_copy);