Commit f19234ca authored by Deepak R Varma's avatar Deepak R Varma Committed by Greg Kroah-Hartman

staging: fbtft: simplify array index computation

An array index is being computed by mathematical calculation on the
Lvalue side of the expression. This also further results in the statement
exceeding 80 character statement length.

A local variable can store the value of the array index computation. The
variable can then be used as array index. This improves readability of
the code and also address 80 character warning raised by checkpatch.
Signed-off-by: default avatarDeepak R Varma <mh12gx2825@gmail.com>
Link: https://lore.kernel.org/r/4bf407e1b3e05745f767b2bad6218c9fb836d869.1584314604.git.mh12gx2825@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b32d2fb2
...@@ -25,6 +25,7 @@ int fbtft_gamma_parse_str(struct fbtft_par *par, u32 *curves, ...@@ -25,6 +25,7 @@ int fbtft_gamma_parse_str(struct fbtft_par *par, u32 *curves,
unsigned long val = 0; unsigned long val = 0;
int ret = 0; int ret = 0;
int curve_counter, value_counter; int curve_counter, value_counter;
int _count;
fbtft_par_dbg(DEBUG_SYSFS, par, "%s() str=\n", __func__); fbtft_par_dbg(DEBUG_SYSFS, par, "%s() str=\n", __func__);
...@@ -68,7 +69,10 @@ int fbtft_gamma_parse_str(struct fbtft_par *par, u32 *curves, ...@@ -68,7 +69,10 @@ int fbtft_gamma_parse_str(struct fbtft_par *par, u32 *curves,
ret = get_next_ulong(&curve_p, &val, " ", 16); ret = get_next_ulong(&curve_p, &val, " ", 16);
if (ret) if (ret)
goto out; goto out;
curves[curve_counter * par->gamma.num_values + value_counter] = val;
_count = curve_counter * par->gamma.num_values +
value_counter;
curves[_count] = val;
value_counter++; value_counter++;
} }
if (value_counter != par->gamma.num_values) { if (value_counter != par->gamma.num_values) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment