summaryrefslogtreecommitdiffstats
path: root/drivers/staging/fbtft
diff options
context:
space:
mode:
authorBhagyashri Dighole <digholebhagyashri@gmail.com>2019-03-08 21:01:28 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-03-18 07:05:22 +0100
commitdfa5fbb9dbced2808e12207942426868c67c046a (patch)
tree737af3866caf2306e6d33a2de85a4ed61cbbf61f /drivers/staging/fbtft
parentd8b2f7cfe4d40e771376bfa4e399f26fa9ef49e4 (diff)
downloadlinux-dfa5fbb9dbced2808e12207942426868c67c046a.tar.gz
linux-dfa5fbb9dbced2808e12207942426868c67c046a.tar.bz2
linux-dfa5fbb9dbced2808e12207942426868c67c046a.zip
staging: fbtft: convert a macro to a function.
Convert a macro to an inline function to improve type safety and make the code simpler. Signed-off-by: Bhagyashri Dighole <digholebhagyashri@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/fbtft')
-rw-r--r--drivers/staging/fbtft/fb_watterott.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/staging/fbtft/fb_watterott.c b/drivers/staging/fbtft/fb_watterott.c
index 502d67f3a743..27cc8eabcbe9 100644
--- a/drivers/staging/fbtft/fb_watterott.c
+++ b/drivers/staging/fbtft/fb_watterott.c
@@ -90,9 +90,10 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
return 0;
}
-#define RGB565toRGB332(c) ((((c) & 0xE000) >> 8) |\
- (((c) & 000700) >> 6) |\
- (((c) & 0x0018) >> 3))
+static inline int rgb565_to_rgb332(u16 c)
+{
+ return ((c & 0xE000) >> 8) | ((c & 000700) >> 6) | ((c & 0x0018) >> 3);
+}
static int write_vmem_8bit(struct fbtft_par *par, size_t offset, size_t len)
{
@@ -116,7 +117,7 @@ static int write_vmem_8bit(struct fbtft_par *par, size_t offset, size_t len)
for (i = start_line; i <= end_line; i++) {
pos[1] = cpu_to_be16(i);
for (j = 0; j < par->info->var.xres; j++) {
- buf8[j] = RGB565toRGB332(*vmem16);
+ buf8[j] = rgb565_to_rgb332(*vmem16);
vmem16++;
}
ret = par->fbtftops.write(par,