staging: fbtft: Puts macro arguments in parenthesis to avoid precedence issues - Style

Puts macro arguments in parenthesis to avoid precedence issues.
Some large lines were broken to fit the 80-char limit.

Signed-off-by: Leonardo Brás <leobras.c@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Leonardo Brás 2018-08-07 21:28:16 -03:00 committed by Greg Kroah-Hartman
parent 243638bc1c
commit 0b1533c6c6
10 changed files with 22 additions and 15 deletions

View File

@ -92,7 +92,7 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
* VRP0 VRP1 VRP2 VRP3 VRP4 VRP5 PRP0 PRP1 PKP0 PKP1 PKP2 PKP3 PKP4 CGM
* VRN0 VRN1 VRN2 VRN3 VRN4 VRN5 PRN0 PRN1 PKN0 PKN1 PKN2 PKN3 PKN4 CGM
*/
#define CURVE(num, idx) curves[num * par->gamma.num_values + idx]
#define CURVE(num, idx) curves[(num) * par->gamma.num_values + (idx)]
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
unsigned long mask[] = {

View File

@ -192,7 +192,7 @@ static int set_var(struct fbtft_par *par)
}
#ifdef GAMMA_ADJ
#define CURVE(num, idx) curves[num * par->gamma.num_values + idx]
#define CURVE(num, idx) curves[(num) * par->gamma.num_values + (idx)]
static int gamma_adj(struct fbtft_par *par, u32 *curves)
{
unsigned long mask[] = {

View File

@ -211,7 +211,7 @@ static int set_var(struct fbtft_par *par)
* VRP0 VRP1 RP0 RP1 KP0 KP1 KP2 KP3 KP4 KP5
* VRN0 VRN1 RN0 RN1 KN0 KN1 KN2 KN3 KN4 KN5
*/
#define CURVE(num, idx) curves[num * par->gamma.num_values + idx]
#define CURVE(num, idx) curves[(num) * par->gamma.num_values + (idx)]
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
unsigned long mask[] = {

View File

@ -205,7 +205,7 @@ static int set_var(struct fbtft_par *par)
* VRP0 VRP1 RP0 RP1 KP0 KP1 KP2 KP3 KP4 KP5
* VRN0 VRN1 RN0 RN1 KN0 KN1 KN2 KN3 KN4 KN5
*/
#define CURVE(num, idx) curves[num * par->gamma.num_values + idx]
#define CURVE(num, idx) curves[(num) * par->gamma.num_values + (idx)]
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
unsigned long mask[] = {

View File

@ -111,7 +111,7 @@ static int set_var(struct fbtft_par *par)
* Positive: Par1 Par2 [...] Par15
* Negative: Par1 Par2 [...] Par15
*/
#define CURVE(num, idx) curves[num * par->gamma.num_values + idx]
#define CURVE(num, idx) curves[(num) * par->gamma.num_values + (idx)]
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
int i;

View File

@ -120,7 +120,7 @@ static int set_var(struct fbtft_par *par)
* PKP0 PKP1 PKP2 PKP3 PKP4 PKP5 PKP6 PKP7 PKP8 PKP9 PKP10 PKP11 VRP0 VRP1
* PKN0 PKN1 PKN2 PKN3 PKN4 PKN5 PKN6 PKN7 PRN8 PRN9 PRN10 PRN11 VRN0 VRN1
*/
#define CURVE(num, idx) curves[num * par->gamma.num_values + idx]
#define CURVE(num, idx) curves[(num) * par->gamma.num_values + (idx)]
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
unsigned long mask[] = {

View File

@ -126,7 +126,7 @@ static int set_var(struct fbtft_par *par)
* VRP0 VRP1 PRP0 PRP1 PKP0 PKP1 PKP2 PKP3 PKP4 PKP5
* VRN0 VRN1 PRN0 PRN1 PKN0 PKN1 PKN2 PKN3 PKN4 PKN5
*/
#define CURVE(num, idx) curves[num * par->gamma.num_values + idx]
#define CURVE(num, idx) curves[(num) * par->gamma.num_values + (idx)]
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
unsigned long mask[] = {

View File

@ -133,7 +133,7 @@ static int set_var(struct fbtft_par *par)
* VRF0P VOS0P PK0P PK1P PK2P PK3P PK4P PK5P PK6P PK7P PK8P PK9P SELV0P SELV1P SELV62P SELV63P
* VRF0N VOS0N PK0N PK1N PK2N PK3N PK4N PK5N PK6N PK7N PK8N PK9N SELV0N SELV1N SELV62N SELV63N
*/
#define CURVE(num, idx) curves[num * par->gamma.num_values + idx]
#define CURVE(num, idx) curves[(num) * par->gamma.num_values + (idx)]
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
int i, j;

View File

@ -89,9 +89,15 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
return 0;
}
#define RGB565toRGB323(c) (((c&0xE000)>>8) | ((c&0600)>>6) | ((c&0x001C)>>2))
#define RGB565toRGB332(c) (((c&0xE000)>>8) | ((c&0700)>>6) | ((c&0x0018)>>3))
#define RGB565toRGB233(c) (((c&0xC000)>>8) | ((c&0700)>>5) | ((c&0x001C)>>2))
#define RGB565toRGB323(c) ((((c) & 0xE000) >> 8) |\
(((c) & 000600) >> 6) |\
(((c) & 0x001C) >> 2))
#define RGB565toRGB332(c) ((((c) & 0xE000) >> 8) |\
(((c) & 000700) >> 6) |\
(((c) & 0x0018) >> 3))
#define RGB565toRGB233(c) ((((c) & 0xC000) >> 8) |\
(((c) & 000700) >> 5) |\
(((c) & 0x001C) >> 2))
static int write_vmem_8bit(struct fbtft_par *par, size_t offset, size_t len)
{

View File

@ -234,8 +234,8 @@ struct fbtft_par {
#define NUMARGS(...) (sizeof((int[]){__VA_ARGS__})/sizeof(int))
#define write_reg(par, ...) \
par->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__)
#define write_reg(par, ...) \
((par)->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__))
/* fbtft-core.c */
int fbtft_write_buf_dc(struct fbtft_par *par, void *buf, size_t len, int dc);
@ -404,8 +404,9 @@ do { \
#define fbtft_par_dbg_hex(level, par, dev, type, buf, num, format, arg...) \
do { \
if (unlikely(par->debug & level)) \
fbtft_dbg_hex(dev, sizeof(type), buf, num * sizeof(type), format, ##arg); \
if (unlikely((par)->debug & (level))) \
fbtft_dbg_hex(dev, sizeof(type), buf,\
(num) * sizeof(type), format, ##arg); \
} while (0)
#endif /* __LINUX_FBTFT_H */