2018-08-09 22:35:15

by Leonardo Brás

[permalink] [raw]
Subject: [PATCH v3 0/3] Style changes

Some style changes to help readability.

Leonardo Brás (3):
staging: fbtft: Includes description to mutex and spinlock - Style
staging: fbtft: Replaces (1 << n) for macro BIT(n) - Style
staging: fbtft: Corrects long index line - Style

drivers/staging/fbtft/fbtft-sysfs.c | 5 ++-
drivers/staging/fbtft/fbtft.h | 60 ++++++++++++++---------------
2 files changed, 34 insertions(+), 31 deletions(-)

--
2.18.0



2018-08-09 22:35:36

by Leonardo Brás

[permalink] [raw]
Subject: [PATCH v3 1/3] staging: fbtft: Includes description to mutex and spinlock - Style

Adds comments explaining what are the spinlock and mutex used for.

Signed-off-by: Leonardo Brás <[email protected]>
---
drivers/staging/fbtft/fbtft.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
index 798a8fe98e95..958835da433c 100644
--- a/drivers/staging/fbtft/fbtft.h
+++ b/drivers/staging/fbtft/fbtft.h
@@ -203,7 +203,7 @@ struct fbtft_par {
u8 *buf;
u8 startbyte;
struct fbtft_ops fbtftops;
- spinlock_t dirty_lock;
+ spinlock_t dirty_lock; /* Protects dirty_lines_{start,end} */
unsigned int dirty_lines_start;
unsigned int dirty_lines_end;
struct {
@@ -219,7 +219,7 @@ struct fbtft_par {
} gpio;
const s16 *init_sequence;
struct {
- struct mutex lock;
+ struct mutex lock; /* Mutex for Gamma curve locking */
u32 *curves;
int num_values;
int num_curves;
--
2.18.0


2018-08-09 22:36:47

by Leonardo Brás

[permalink] [raw]
Subject: [PATCH v3 3/3] staging: fbtft: Corrects long index line - Style

Reduces the index size to keep the code more readable.

Signed-off-by: Leonardo Brás <[email protected]>
---
drivers/staging/fbtft/fbtft-sysfs.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/fbtft/fbtft-sysfs.c b/drivers/staging/fbtft/fbtft-sysfs.c
index 2a5c630dab87..404046d3999a 100644
--- a/drivers/staging/fbtft/fbtft-sysfs.c
+++ b/drivers/staging/fbtft/fbtft-sysfs.c
@@ -25,6 +25,7 @@ int fbtft_gamma_parse_str(struct fbtft_par *par, u32 *curves,
unsigned long val = 0;
int ret = 0;
int curve_counter, value_counter;
+ unsigned long idx;

fbtft_par_dbg(DEBUG_SYSFS, par, "%s() str=\n", __func__);

@@ -68,7 +69,9 @@ int fbtft_gamma_parse_str(struct fbtft_par *par, u32 *curves,
ret = get_next_ulong(&curve_p, &val, " ", 16);
if (ret)
goto out;
- curves[curve_counter * par->gamma.num_values + value_counter] = val;
+ idx = curve_counter * par->gamma.num_values +
+ value_counter;
+ curves[idx] = val;
value_counter++;
}
if (value_counter != par->gamma.num_values) {
--
2.18.0


2018-08-09 22:37:00

by Leonardo Brás

[permalink] [raw]
Subject: [PATCH v3 2/3] staging: fbtft: Replaces (1 << n) for macro BIT(n) - Style

Use of default macro BIT(n) instead of (1 << n). Helps readability.

Signed-off-by: Leonardo Brás <[email protected]>
---
drivers/staging/fbtft/fbtft.h | 56 +++++++++++++++++------------------
1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
index 958835da433c..efdad47ccd26 100644
--- a/drivers/staging/fbtft/fbtft.h
+++ b/drivers/staging/fbtft/fbtft.h
@@ -355,39 +355,39 @@ module_exit(fbtft_driver_module_exit);
#define DEBUG_LEVEL_6 (DEBUG_LEVEL_4 | DEBUG_LEVEL_5)
#define DEBUG_LEVEL_7 0xFFFFFFFF

-#define DEBUG_DRIVER_INIT_FUNCTIONS (1<<3)
-#define DEBUG_TIME_FIRST_UPDATE (1<<4)
-#define DEBUG_TIME_EACH_UPDATE (1<<5)
-#define DEBUG_DEFERRED_IO (1<<6)
-#define DEBUG_FBTFT_INIT_FUNCTIONS (1<<7)
+#define DEBUG_DRIVER_INIT_FUNCTIONS BIT(3)
+#define DEBUG_TIME_FIRST_UPDATE BIT(4)
+#define DEBUG_TIME_EACH_UPDATE BIT(5)
+#define DEBUG_DEFERRED_IO BIT(6)
+#define DEBUG_FBTFT_INIT_FUNCTIONS BIT(7)

/* fbops */
-#define DEBUG_FB_READ (1<<8)
-#define DEBUG_FB_WRITE (1<<9)
-#define DEBUG_FB_FILLRECT (1<<10)
-#define DEBUG_FB_COPYAREA (1<<11)
-#define DEBUG_FB_IMAGEBLIT (1<<12)
-#define DEBUG_FB_SETCOLREG (1<<13)
-#define DEBUG_FB_BLANK (1<<14)
+#define DEBUG_FB_READ BIT(8)
+#define DEBUG_FB_WRITE BIT(9)
+#define DEBUG_FB_FILLRECT BIT(10)
+#define DEBUG_FB_COPYAREA BIT(11)
+#define DEBUG_FB_IMAGEBLIT BIT(12)
+#define DEBUG_FB_SETCOLREG BIT(13)
+#define DEBUG_FB_BLANK BIT(14)

-#define DEBUG_SYSFS (1<<16)
+#define DEBUG_SYSFS BIT(16)

/* fbtftops */
-#define DEBUG_BACKLIGHT (1<<17)
-#define DEBUG_READ (1<<18)
-#define DEBUG_WRITE (1<<19)
-#define DEBUG_WRITE_VMEM (1<<20)
-#define DEBUG_WRITE_REGISTER (1<<21)
-#define DEBUG_SET_ADDR_WIN (1<<22)
-#define DEBUG_RESET (1<<23)
-#define DEBUG_MKDIRTY (1<<24)
-#define DEBUG_UPDATE_DISPLAY (1<<25)
-#define DEBUG_INIT_DISPLAY (1<<26)
-#define DEBUG_BLANK (1<<27)
-#define DEBUG_REQUEST_GPIOS (1<<28)
-#define DEBUG_FREE_GPIOS (1<<29)
-#define DEBUG_REQUEST_GPIOS_MATCH (1<<30)
-#define DEBUG_VERIFY_GPIOS (1<<31)
+#define DEBUG_BACKLIGHT BIT(17)
+#define DEBUG_READ BIT(18)
+#define DEBUG_WRITE BIT(19)
+#define DEBUG_WRITE_VMEM BIT(20)
+#define DEBUG_WRITE_REGISTER BIT(21)
+#define DEBUG_SET_ADDR_WIN BIT(22)
+#define DEBUG_RESET BIT(23)
+#define DEBUG_MKDIRTY BIT(24)
+#define DEBUG_UPDATE_DISPLAY BIT(25)
+#define DEBUG_INIT_DISPLAY BIT(26)
+#define DEBUG_BLANK BIT(27)
+#define DEBUG_REQUEST_GPIOS BIT(28)
+#define DEBUG_FREE_GPIOS BIT(29)
+#define DEBUG_REQUEST_GPIOS_MATCH BIT(30)
+#define DEBUG_VERIFY_GPIOS BIT(31)

#define fbtft_init_dbg(dev, format, arg...) \
do { \
--
2.18.0