* [PATCH v3 1/2] staging: sm750fb: return -ETIMEDOUT on timeout in de_wait functions
2026-04-27 5:46 [PATCH v3 0/2] staging: sm750fb: fix de_wait() return handling Hungyu Lin
@ 2026-04-27 5:46 ` Hungyu Lin
2026-04-27 5:46 ` [PATCH v3 2/2] staging: sm750fb: propagate error codes from de_wait() Hungyu Lin
1 sibling, 0 replies; 3+ messages in thread
From: Hungyu Lin @ 2026-04-27 5:46 UTC (permalink / raw)
To: sudipm.mukherjee, teddy.wang, gregkh
Cc: linux-fbdev, linux-staging, linux-kernel, Hungyu Lin
The hw_sm750le_de_wait() and hw_sm750_de_wait() functions return -1
when a timeout occurs. Replace these with -ETIMEDOUT to use a proper
errno value and better describe the error condition.
All callers check the return value as non-zero, so this change does
not alter existing behavior.
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
drivers/staging/sm750fb/sm750_hw.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c
index a2798d428663..ab3d4a2bf1a6 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -501,8 +501,8 @@ int hw_sm750le_de_wait(void)
(DE_STATE2_DE_FIFO_EMPTY | DE_STATE2_DE_MEM_FIFO_EMPTY))
return 0;
}
- /* timeout error */
- return -1;
+
+ return -ETIMEDOUT;
}
int hw_sm750_de_wait(void)
@@ -519,8 +519,8 @@ int hw_sm750_de_wait(void)
(SYSTEM_CTRL_DE_FIFO_EMPTY | SYSTEM_CTRL_DE_MEM_FIFO_EMPTY))
return 0;
}
- /* timeout error */
- return -1;
+
+ return -ETIMEDOUT;
}
int hw_sm750_pan_display(struct lynxfb_crtc *crtc,
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v3 2/2] staging: sm750fb: propagate error codes from de_wait()
2026-04-27 5:46 [PATCH v3 0/2] staging: sm750fb: fix de_wait() return handling Hungyu Lin
2026-04-27 5:46 ` [PATCH v3 1/2] staging: sm750fb: return -ETIMEDOUT on timeout in de_wait functions Hungyu Lin
@ 2026-04-27 5:46 ` Hungyu Lin
1 sibling, 0 replies; 3+ messages in thread
From: Hungyu Lin @ 2026-04-27 5:46 UTC (permalink / raw)
To: sudipm.mukherjee, teddy.wang, gregkh
Cc: linux-fbdev, linux-staging, linux-kernel, Hungyu Lin
The sm750 acceleration functions currently return -1 when
de_wait() fails, discarding the original error code.
Since de_wait() now returns proper errno values, propagate
the error code instead of returning -1.
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
drivers/staging/sm750fb/sm750_accel.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c
index 0f94d859e91c..d8e91f7a7778 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -90,14 +90,16 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
u32 color, u32 rop)
{
u32 de_ctrl;
+ int ret;
- if (accel->de_wait() != 0) {
+ ret = accel->de_wait();
+ if (ret) {
/*
* int time wait and always busy,seems hardware
* got something error
*/
pr_debug("De engine always busy\n");
- return -1;
+ return ret;
}
write_dpr(accel, DE_WINDOW_DESTINATION_BASE, base); /* dpr40 */
@@ -154,6 +156,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
unsigned int rop2)
{
unsigned int direction, de_ctrl;
+ int ret;
direction = LEFT_TO_RIGHT;
/* Direction of ROP2 operation: 1 = Left to Right, (-1) = Right to Left */
@@ -263,8 +266,9 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
DE_WINDOW_WIDTH_DST_MASK) |
(source_pitch / Bpp & DE_WINDOW_WIDTH_SRC_MASK)); /* dpr3c */
- if (accel->de_wait() != 0)
- return -1;
+ ret = accel->de_wait();
+ if (ret)
+ return ret;
write_dpr(accel, DE_SOURCE,
((sx << DE_SOURCE_X_K1_SHIFT) & DE_SOURCE_X_K1_MASK) |
@@ -326,14 +330,16 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *src_buf,
unsigned int de_ctrl = 0;
unsigned char remain[4];
int i, j;
+ int ret;
start_bit &= 7; /* Just make sure the start bit is within legal range */
bytes_per_scan = (width + start_bit + 7) / 8;
words_per_scan = bytes_per_scan & ~3;
bytes_remain = bytes_per_scan & 3;
- if (accel->de_wait() != 0)
- return -1;
+ ret = accel->de_wait();
+ if (ret)
+ return ret;
/*
* 2D Source Base.
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread