* [PATCH 0/3] staging/fbtft: Minor cleanups.
@ 2026-07-14 19:09 Panagiotis Gravias
2026-07-14 19:09 ` [PATCH 1/3] staging/fbtft: Remove prohibited space before close parenthesis Panagiotis Gravias
` (4 more replies)
0 siblings, 5 replies; 11+ messages in thread
From: Panagiotis Gravias @ 2026-07-14 19:09 UTC (permalink / raw)
To: andy, gregkh
Cc: namcao, tomasz.unger, dri-devel, linux-fbdev, linux-staging,
linux-kernel, Panagiotis Gravias
Solved some style errors,
parenthesis spacing, aligning arguments, replacing udelay() with
usleep_range().
I hope this makes future checks with the style script cleaner and more
helpfull.
Panagiotis Gravias (3):
staging/fbtft: Remove prohibited space before close parenthesis
staging/fbtft: Align arguments to match open parenthesis
staging: fbtft: Replace udelay with usleep_range
drivers/staging/fbtft/fb_ra8875.c | 4 ++--
drivers/staging/fbtft/fb_tinylcd.c | 2 +-
drivers/staging/fbtft/fb_upd161704.c | 18 +++++++++---------
drivers/staging/fbtft/fbtft-bus.c | 4 ++--
4 files changed, 14 insertions(+), 14 deletions(-)
--
2.55.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/3] staging/fbtft: Remove prohibited space before close parenthesis
2026-07-14 19:09 [PATCH 0/3] staging/fbtft: Minor cleanups Panagiotis Gravias
@ 2026-07-14 19:09 ` Panagiotis Gravias
2026-07-14 19:16 ` Andy Shevchenko
2026-07-14 19:33 ` sashiko-bot
2026-07-14 19:09 ` [PATCH 2/3] staging/fbtft: Align arguments to match open parenthesis Panagiotis Gravias
` (3 subsequent siblings)
4 siblings, 2 replies; 11+ messages in thread
From: Panagiotis Gravias @ 2026-07-14 19:09 UTC (permalink / raw)
To: andy, gregkh
Cc: namcao, tomasz.unger, dri-devel, linux-fbdev, linux-staging,
linux-kernel, Panagiotis Gravias
Fix checkpatch error: "space prohibited before that close parenthesis"
in the define_fbtft_write_reg macro.
Signed-off-by: Panagiotis Gravias <graviaspanagiotis1@gmail.com>
---
drivers/staging/fbtft/fbtft-bus.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/fbtft/fbtft-bus.c b/drivers/staging/fbtft/fbtft-bus.c
index 30e436ff19e4..38697992f5e1 100644
--- a/drivers/staging/fbtft/fbtft-bus.c
+++ b/drivers/staging/fbtft/fbtft-bus.c
@@ -62,9 +62,9 @@ out: \
} \
EXPORT_SYMBOL(func);
-define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, )
+define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8,)
define_fbtft_write_reg(fbtft_write_reg16_bus8, __be16, u16, cpu_to_be16)
-define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16, )
+define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16,)
void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...)
{
--
2.55.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/3] staging/fbtft: Align arguments to match open parenthesis
2026-07-14 19:09 [PATCH 0/3] staging/fbtft: Minor cleanups Panagiotis Gravias
2026-07-14 19:09 ` [PATCH 1/3] staging/fbtft: Remove prohibited space before close parenthesis Panagiotis Gravias
@ 2026-07-14 19:09 ` Panagiotis Gravias
2026-07-14 19:16 ` Andy Shevchenko
2026-07-14 19:09 ` [PATCH 3/3] staging: fbtft: Replace udelay with usleep_range Panagiotis Gravias
` (2 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Panagiotis Gravias @ 2026-07-14 19:09 UTC (permalink / raw)
To: andy, gregkh
Cc: namcao, tomasz.unger, dri-devel, linux-fbdev, linux-staging,
linux-kernel, Panagiotis Gravias
Fix checkpatch warning for alignment in write_reg() call to match
the open parenthesis, improving code readability.
Signed-off-by: Panagiotis Gravias <graviaspanagiotis1@gmail.com>
---
drivers/staging/fbtft/fb_tinylcd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/fbtft/fb_tinylcd.c b/drivers/staging/fbtft/fb_tinylcd.c
index afa8f1c740c5..d58b1247262b 100644
--- a/drivers/staging/fbtft/fb_tinylcd.c
+++ b/drivers/staging/fbtft/fb_tinylcd.c
@@ -38,7 +38,7 @@ static int init_display(struct fbtft_par *par)
write_reg(par, 0xE5, 0x00);
write_reg(par, 0xF0, 0x36, 0xA5, 0x53);
write_reg(par, 0xE0, 0x00, 0x35, 0x33, 0x00, 0x00, 0x00,
- 0x00, 0x35, 0x33, 0x00, 0x00, 0x00);
+ 0x00, 0x35, 0x33, 0x00, 0x00, 0x00);
write_reg(par, MIPI_DCS_SET_PIXEL_FORMAT, 0x55);
write_reg(par, MIPI_DCS_EXIT_SLEEP_MODE);
fsleep(250);
--
2.55.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/3] staging: fbtft: Replace udelay with usleep_range
2026-07-14 19:09 [PATCH 0/3] staging/fbtft: Minor cleanups Panagiotis Gravias
2026-07-14 19:09 ` [PATCH 1/3] staging/fbtft: Remove prohibited space before close parenthesis Panagiotis Gravias
2026-07-14 19:09 ` [PATCH 2/3] staging/fbtft: Align arguments to match open parenthesis Panagiotis Gravias
@ 2026-07-14 19:09 ` Panagiotis Gravias
2026-07-14 19:17 ` Andy Shevchenko
2026-07-14 19:48 ` sashiko-bot
2026-07-14 19:18 ` [PATCH 0/3] staging/fbtft: Minor cleanups Andy Shevchenko
2026-07-15 7:28 ` Dan Carpenter
4 siblings, 2 replies; 11+ messages in thread
From: Panagiotis Gravias @ 2026-07-14 19:09 UTC (permalink / raw)
To: andy, gregkh
Cc: namcao, tomasz.unger, dri-devel, linux-fbdev, linux-staging,
linux-kernel, Panagiotis Gravias
Fix checkpatch warnings preferring usleep_range over udelay.
Replaced udelay() calls with usleep_range() providing a reasonable
upper bound to allow the scheduler to coalesce timer interrupts.
Signed-off-by: Panagiotis Gravias <graviaspanagiotis1@gmail.com>
---
drivers/staging/fbtft/fb_ra8875.c | 4 ++--
drivers/staging/fbtft/fb_upd161704.c | 18 +++++++++---------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/fbtft/fb_ra8875.c b/drivers/staging/fbtft/fb_ra8875.c
index 0ab1de6647d0..d2400bb44f1c 100644
--- a/drivers/staging/fbtft/fb_ra8875.c
+++ b/drivers/staging/fbtft/fb_ra8875.c
@@ -210,7 +210,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)
}
len--;
- udelay(100);
+ usleep_range(100, 200);
if (len) {
buf = (u8 *)par->buf;
@@ -231,7 +231,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)
/* restore user spi-speed */
par->fbtftops.write = fbtft_write_spi;
- udelay(100);
+ usleep_range(100, 200);
}
static int write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len)
diff --git a/drivers/staging/fbtft/fb_upd161704.c b/drivers/staging/fbtft/fb_upd161704.c
index c680160d6380..e26766f58a50 100644
--- a/drivers/staging/fbtft/fb_upd161704.c
+++ b/drivers/staging/fbtft/fb_upd161704.c
@@ -32,27 +32,27 @@ static int init_display(struct fbtft_par *par)
/* oscillator start */
write_reg(par, 0x003A, 0x0001); /*Oscillator 0: stop, 1: operation */
- udelay(100);
+ usleep_range(100, 200);
/* y-setting */
write_reg(par, 0x0024, 0x007B); /* amplitude setting */
- udelay(10);
+ usleep_range(10, 20);
write_reg(par, 0x0025, 0x003B); /* amplitude setting */
write_reg(par, 0x0026, 0x0034); /* amplitude setting */
- udelay(10);
+ usleep_range(10, 20);
write_reg(par, 0x0027, 0x0004); /* amplitude setting */
write_reg(par, 0x0052, 0x0025); /* circuit setting 1 */
- udelay(10);
+ usleep_range(10, 20);
write_reg(par, 0x0053, 0x0033); /* circuit setting 2 */
write_reg(par, 0x0061, 0x001C); /* adjustment V10 positive polarity */
- udelay(10);
+ usleep_range(10, 20);
write_reg(par, 0x0062, 0x002C); /* adjustment V9 negative polarity */
write_reg(par, 0x0063, 0x0022); /* adjustment V34 positive polarity */
- udelay(10);
+ usleep_range(10, 20);
write_reg(par, 0x0064, 0x0027); /* adjustment V31 negative polarity */
- udelay(10);
+ usleep_range(10, 20);
write_reg(par, 0x0065, 0x0014); /* adjustment V61 negative polarity */
- udelay(10);
+ usleep_range(10, 20);
write_reg(par, 0x0066, 0x0010); /* adjustment V61 negative polarity */
/* Basical clock for 1 line (BASECOUNT[7:0]) number specified */
@@ -60,7 +60,7 @@ static int init_display(struct fbtft_par *par)
/* Power supply setting */
write_reg(par, 0x0019, 0x0000); /* DC/DC output setting */
- udelay(200);
+ usleep_range(200, 300);
write_reg(par, 0x001A, 0x1000); /* DC/DC frequency setting */
write_reg(par, 0x001B, 0x0023); /* DC/DC rising setting */
write_reg(par, 0x001C, 0x0C01); /* Regulator voltage setting */
--
2.55.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] staging/fbtft: Remove prohibited space before close parenthesis
2026-07-14 19:09 ` [PATCH 1/3] staging/fbtft: Remove prohibited space before close parenthesis Panagiotis Gravias
@ 2026-07-14 19:16 ` Andy Shevchenko
2026-07-14 19:33 ` sashiko-bot
1 sibling, 0 replies; 11+ messages in thread
From: Andy Shevchenko @ 2026-07-14 19:16 UTC (permalink / raw)
To: Panagiotis Gravias
Cc: andy, gregkh, namcao, tomasz.unger, dri-devel, linux-fbdev,
linux-staging, linux-kernel
On Tue, Jul 14, 2026 at 10:09:40PM +0300, Panagiotis Gravias wrote:
> Fix checkpatch error: "space prohibited before that close parenthesis"
> in the define_fbtft_write_reg macro.
NAK.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] staging/fbtft: Align arguments to match open parenthesis
2026-07-14 19:09 ` [PATCH 2/3] staging/fbtft: Align arguments to match open parenthesis Panagiotis Gravias
@ 2026-07-14 19:16 ` Andy Shevchenko
0 siblings, 0 replies; 11+ messages in thread
From: Andy Shevchenko @ 2026-07-14 19:16 UTC (permalink / raw)
To: Panagiotis Gravias
Cc: andy, gregkh, namcao, tomasz.unger, dri-devel, linux-fbdev,
linux-staging, linux-kernel
On Tue, Jul 14, 2026 at 10:09:41PM +0300, Panagiotis Gravias wrote:
> Fix checkpatch warning for alignment in write_reg() call to match
> the open parenthesis, improving code readability.
NAK.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/3] staging: fbtft: Replace udelay with usleep_range
2026-07-14 19:09 ` [PATCH 3/3] staging: fbtft: Replace udelay with usleep_range Panagiotis Gravias
@ 2026-07-14 19:17 ` Andy Shevchenko
2026-07-14 19:48 ` sashiko-bot
1 sibling, 0 replies; 11+ messages in thread
From: Andy Shevchenko @ 2026-07-14 19:17 UTC (permalink / raw)
To: Panagiotis Gravias
Cc: andy, gregkh, namcao, tomasz.unger, dri-devel, linux-fbdev,
linux-staging, linux-kernel
On Tue, Jul 14, 2026 at 10:09:42PM +0300, Panagiotis Gravias wrote:
> Fix checkpatch warnings preferring usleep_range over udelay.
> Replaced udelay() calls with usleep_range() providing a reasonable
> upper bound to allow the scheduler to coalesce timer interrupts.
NAK.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/3] staging/fbtft: Minor cleanups.
2026-07-14 19:09 [PATCH 0/3] staging/fbtft: Minor cleanups Panagiotis Gravias
` (2 preceding siblings ...)
2026-07-14 19:09 ` [PATCH 3/3] staging: fbtft: Replace udelay with usleep_range Panagiotis Gravias
@ 2026-07-14 19:18 ` Andy Shevchenko
2026-07-15 7:28 ` Dan Carpenter
4 siblings, 0 replies; 11+ messages in thread
From: Andy Shevchenko @ 2026-07-14 19:18 UTC (permalink / raw)
To: Panagiotis Gravias
Cc: andy, gregkh, namcao, tomasz.unger, dri-devel, linux-fbdev,
linux-staging, linux-kernel
On Tue, Jul 14, 2026 at 10:09:38PM +0300, Panagiotis Gravias wrote:
> Solved some style errors,
> parenthesis spacing, aligning arguments, replacing udelay() with
> usleep_range().
>
> I hope this makes future checks with the style script cleaner and more
> helpfull.
To understand the resolution, read the mailing list archives for
the last ~6-9 months against this driver.
Also read and understand README in the folder of the driver.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] staging/fbtft: Remove prohibited space before close parenthesis
2026-07-14 19:09 ` [PATCH 1/3] staging/fbtft: Remove prohibited space before close parenthesis Panagiotis Gravias
2026-07-14 19:16 ` Andy Shevchenko
@ 2026-07-14 19:33 ` sashiko-bot
1 sibling, 0 replies; 11+ messages in thread
From: sashiko-bot @ 2026-07-14 19:33 UTC (permalink / raw)
To: Panagiotis Gravias; +Cc: dri-devel
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Constructing and dereferencing unaligned 16-bit pointers causes undefined behavior and potential kernel panics on strict-alignment architectures.
- [High] Incorrect SPI buffer size calculation transmits uninitialized memory when multiple parameters are sent with `startbyte` enabled.
--
--- Patch [1]: [PATCH 1/3] staging/fbtft: Remove prohibited space before close parenthesis ---
commit b5aeca6fddf7088401c92f0dfc0d9c7d04fb863a
Author: Panagiotis Gravias <graviaspanagiotis1@gmail.com>
staging/fbtft: Remove prohibited space before close parenthesis
This commit cleans up a checkpatch error by removing a prohibited space
before the close parenthesis in the define_fbtft_write_reg macro
invocations.
> diff --git a/drivers/staging/fbtft/fbtft-bus.c b/drivers/staging/fbtft/fbtft-bus.c
> index 30e436ff19e4c..38697992f5e1b 100644
> --- a/drivers/staging/fbtft/fbtft-bus.c
> +++ b/drivers/staging/fbtft/fbtft-bus.c
> @@ -62,9 +62,9 @@ out: \
> } \
> EXPORT_SYMBOL(func);
>
> -define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, )
> +define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8,)
> define_fbtft_write_reg(fbtft_write_reg16_bus8, __be16, u16, cpu_to_be16)
> -define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16, )
> +define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16,)
[Severity: High]
This is a pre-existing issue, but does expanding this macro for 16-bit
types like fbtft_write_reg16_bus16 create an unaligned pointer dereference?
In the define_fbtft_write_reg() macro definition, when a startbyte is used:
if (par->startbyte) {
*(u8 *)par->buf = par->startbyte;
buf = (buffer_type *)(par->buf + 1);
offset = 1;
}
The pointer is advanced by 1 byte. When buffer_type is a 16-bit type, this
creates an odd-aligned pointer. Later, the macro writes to it:
*buf = modifier((data_type)va_arg(args, unsigned int));
This can cause unaligned memory access faults and lead to kernel panics on
strict-alignment architectures. This same pattern also appears in
fbtft_write_vmem16_bus8() where par->txbuf.buf + 1 is cast to a 16-bit
pointer.
[Severity: High]
This is also a pre-existing issue within the same macro, but could the
SPI buffer size calculation send uninitialized memory?
When sending multiple parameters with a startbyte active, the macro packs
exactly one start byte followed by the parameters. However, the transmission
size is calculated as:
if (len) {
...
fbtft_write_buf_dc(par, par->buf,
len * (sizeof(data_type) + offset), 1);
}
Because offset is 1, if len is greater than 1, this calculates to
len * sizeof(data_type) + len, instead of the actual payload size of
1 + len * sizeof(data_type). Could this force the SPI core to transmit extra
uninitialized out-of-bounds bytes and potentially corrupt the display
controller's initialization state?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260714190958.219437-2-graviaspanagiotis1@gmail.com?part=1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/3] staging: fbtft: Replace udelay with usleep_range
2026-07-14 19:09 ` [PATCH 3/3] staging: fbtft: Replace udelay with usleep_range Panagiotis Gravias
2026-07-14 19:17 ` Andy Shevchenko
@ 2026-07-14 19:48 ` sashiko-bot
1 sibling, 0 replies; 11+ messages in thread
From: sashiko-bot @ 2026-07-14 19:48 UTC (permalink / raw)
To: Panagiotis Gravias; +Cc: dri-devel
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] If a SPI write fails in `write_reg8_bus8`, the function returns early without restoring `par->fbtftops.write` to its original value, permanently downgrading the SPI interface speed.
- [High] The `txbuf16` pointer in `write_vmem16_bus8` is assigned to an odd-aligned address, causing unaligned memory writes that can trigger a kernel panic on strict architectures.
--
--- Patch [3]: [PATCH 3/3] staging: fbtft: Replace udelay with usleep_range ---
commit 7f6e8faf1241a2de5c5b0d51aa0632d9694e2167
Author: Panagiotis Gravias <graviaspanagiotis1@gmail.com>
staging: fbtft: Replace udelay with usleep_range
This commit replaces calls to udelay() with usleep_range() in the fbtft
driver. This addresses checkpatch warnings and provides an upper bound to
allow the scheduler to coalesce timer interrupts.
> diff --git a/drivers/staging/fbtft/fb_ra8875.c b/drivers/staging/fbtft/fb_ra8875.c
> index 0ab1de6647d07..d2400bb44f1c6 100644
> --- a/drivers/staging/fbtft/fb_ra8875.c
> +++ b/drivers/staging/fbtft/fb_ra8875.c
[ ... ]
> @@ -231,7 +231,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)
>
> /* restore user spi-speed */
> par->fbtftops.write = fbtft_write_spi;
> - udelay(100);
> + usleep_range(100, 200);
> }
[Severity: High]
This isn't a bug introduced by this patch, but I noticed something about the
error handling in write_reg8_bus8() related to the SPI speed restore.
When par->fbtftops.write() fails earlier in this function, it returns
immediately:
if (ret < 0) {
va_end(args);
dev_err(par->info->device, "write() failed and returned %dn", ret);
return;
}
Does this leave par->fbtftops.write permanently assigned to the slow
write_spi function? It appears that if a register write fails, the driver
never restores the fast fbtft_write_spi pointer, which might severely impact
the performance of all future bulk video memory writes.
[Severity: High]
This is also a pre-existing issue, but looking at the neighboring
write_vmem16_bus8() function in the same file:
write_vmem16_bus8() {
...
txbuf16 = par->txbuf.buf + 1;
...
for (i = 0; i < to_copy; i++)
txbuf16[i] = cpu_to_be16(vmem16[i]);
}
Is there a risk of an alignment fault here? The txbuf16 pointer is assigned
an odd-aligned address (buf + 1). On architectures that do not support
unaligned memory access in hardware (which is common for systems with SPI
displays), would these 16-bit writes trigger a kernel panic? Should this
be using put_unaligned_be16() instead?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260714190958.219437-2-graviaspanagiotis1@gmail.com?part=3
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/3] staging/fbtft: Minor cleanups.
2026-07-14 19:09 [PATCH 0/3] staging/fbtft: Minor cleanups Panagiotis Gravias
` (3 preceding siblings ...)
2026-07-14 19:18 ` [PATCH 0/3] staging/fbtft: Minor cleanups Andy Shevchenko
@ 2026-07-15 7:28 ` Dan Carpenter
4 siblings, 0 replies; 11+ messages in thread
From: Dan Carpenter @ 2026-07-15 7:28 UTC (permalink / raw)
To: Panagiotis Gravias
Cc: andy, gregkh, namcao, tomasz.unger, dri-devel, linux-fbdev,
linux-staging, linux-kernel
On Tue, Jul 14, 2026 at 10:09:38PM +0300, Panagiotis Gravias wrote:
> Solved some style errors,
> parenthesis spacing, aligning arguments, replacing udelay() with
> usleep_range().
>
> I hope this makes future checks with the style script cleaner and more
> helpfull.
>
With old code you should search lore for why it still exists.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-07-15 7:28 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-14 19:09 [PATCH 0/3] staging/fbtft: Minor cleanups Panagiotis Gravias
2026-07-14 19:09 ` [PATCH 1/3] staging/fbtft: Remove prohibited space before close parenthesis Panagiotis Gravias
2026-07-14 19:16 ` Andy Shevchenko
2026-07-14 19:33 ` sashiko-bot
2026-07-14 19:09 ` [PATCH 2/3] staging/fbtft: Align arguments to match open parenthesis Panagiotis Gravias
2026-07-14 19:16 ` Andy Shevchenko
2026-07-14 19:09 ` [PATCH 3/3] staging: fbtft: Replace udelay with usleep_range Panagiotis Gravias
2026-07-14 19:17 ` Andy Shevchenko
2026-07-14 19:48 ` sashiko-bot
2026-07-14 19:18 ` [PATCH 0/3] staging/fbtft: Minor cleanups Andy Shevchenko
2026-07-15 7:28 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.