* [PATCH 0/2] staging: sm750fb: improve error handling in de_wait path
@ 2026-04-09 14:41 Hungyu Lin
2026-04-09 14:41 ` [PATCH 1/2] staging: sm750fb: return -ETIMEDOUT on timeout in de_wait functions Hungyu Lin
2026-04-09 14:41 ` [PATCH 2/2] staging: sm750fb: propagate error codes from de_wait() Hungyu Lin
0 siblings, 2 replies; 6+ messages in thread
From: Hungyu Lin @ 2026-04-09 14:41 UTC (permalink / raw)
To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
Cc: linux-fbdev, linux-staging, linux-kernel, Hungyu Lin
This series improves error handling in the sm750fb driver.
The de_wait() helpers currently return -1 on timeout and callers
discard error codes by always returning -1. This series replaces
-1 with -ETIMEDOUT and propagates the error code to improve
error reporting.
Patch 1 replaces -1 with -ETIMEDOUT in de_wait() helpers.
Patch 2 propagates error codes in callers instead of returning -1.
Hungyu Lin (2):
staging: sm750fb: return -ETIMEDOUT on timeout in de_wait functions
staging: sm750fb: propagate error codes from de_wait()
drivers/staging/sm750fb/sm750_accel.c | 22 ++++++++++++----------
drivers/staging/sm750fb/sm750_hw.c | 4 ++--
2 files changed, 14 insertions(+), 12 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] staging: sm750fb: return -ETIMEDOUT on timeout in de_wait functions
2026-04-09 14:41 [PATCH 0/2] staging: sm750fb: improve error handling in de_wait path Hungyu Lin
@ 2026-04-09 14:41 ` Hungyu Lin
2026-04-09 14:41 ` [PATCH 2/2] staging: sm750fb: propagate error codes from de_wait() Hungyu Lin
1 sibling, 0 replies; 6+ messages in thread
From: Hungyu Lin @ 2026-04-09 14:41 UTC (permalink / raw)
To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
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 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c
index a2798d428663..3809401baa3a 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -502,7 +502,7 @@ int hw_sm750le_de_wait(void)
return 0;
}
/* timeout error */
- return -1;
+ return -ETIMEDOUT;
}
int hw_sm750_de_wait(void)
@@ -520,7 +520,7 @@ int hw_sm750_de_wait(void)
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] 6+ messages in thread
* [PATCH 2/2] staging: sm750fb: propagate error codes from de_wait()
2026-04-09 14:41 [PATCH 0/2] staging: sm750fb: improve error handling in de_wait path Hungyu Lin
2026-04-09 14:41 ` [PATCH 1/2] staging: sm750fb: return -ETIMEDOUT on timeout in de_wait functions Hungyu Lin
@ 2026-04-09 14:41 ` Hungyu Lin
2026-04-09 15:05 ` Greg Kroah-Hartman
1 sibling, 1 reply; 6+ messages in thread
From: Hungyu Lin @ 2026-04-09 14:41 UTC (permalink / raw)
To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
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 | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c
index 0f94d859e91c..891d12a5e2cc 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -90,14 +90,12 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
u32 color, u32 rop)
{
u32 de_ctrl;
+ int ret;
- if (accel->de_wait() != 0) {
- /*
- * int time wait and always busy,seems hardware
- * got something error
- */
+ ret = accel->de_wait();
+ if (ret) {
pr_debug("De engine always busy\n");
- return -1;
+ return ret;
}
write_dpr(accel, DE_WINDOW_DESTINATION_BASE, base); /* dpr40 */
@@ -154,6 +152,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 +262,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 +326,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] 6+ messages in thread
* Re: [PATCH 2/2] staging: sm750fb: propagate error codes from de_wait()
2026-04-09 14:41 ` [PATCH 2/2] staging: sm750fb: propagate error codes from de_wait() Hungyu Lin
@ 2026-04-09 15:05 ` Greg Kroah-Hartman
2026-04-09 15:15 ` Denny Lin
0 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2026-04-09 15:05 UTC (permalink / raw)
To: Hungyu Lin
Cc: Sudip Mukherjee, Teddy Wang, linux-fbdev, linux-staging,
linux-kernel
On Thu, Apr 09, 2026 at 02:41:19PM +0000, Hungyu Lin wrote:
> 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 | 22 ++++++++++++----------
> 1 file changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c
> index 0f94d859e91c..891d12a5e2cc 100644
> --- a/drivers/staging/sm750fb/sm750_accel.c
> +++ b/drivers/staging/sm750fb/sm750_accel.c
> @@ -90,14 +90,12 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
> u32 color, u32 rop)
> {
> u32 de_ctrl;
> + int ret;
>
> - if (accel->de_wait() != 0) {
> - /*
> - * int time wait and always busy,seems hardware
> - * got something error
> - */
Why did you delete the comment?
And when did de_wait() start returning correct values?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] staging: sm750fb: propagate error codes from de_wait()
2026-04-09 15:05 ` Greg Kroah-Hartman
@ 2026-04-09 15:15 ` Denny Lin
2026-04-09 15:22 ` Greg Kroah-Hartman
0 siblings, 1 reply; 6+ messages in thread
From: Denny Lin @ 2026-04-09 15:15 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Sudip Mukherjee, Teddy Wang, linux-fbdev, linux-staging,
linux-kernel
Hi Greg,
> Why did you delete the comment?
The comment was removed as part of simplifying the code while
changing the error handling to propagate the return value from
de_wait(). I can restore or update it if needed.
> And when did de_wait() start returning correct values?
de_wait() starts returning a proper errno value in patch 1 of this
series, where the timeout return value is changed from -1 to
-ETIMEDOUT. This patch then propagates that error value.
Thanks,
Hungyu
On Thu, Apr 9, 2026 at 8:05 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Thu, Apr 09, 2026 at 02:41:19PM +0000, Hungyu Lin wrote:
> > 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 | 22 ++++++++++++----------
> > 1 file changed, 12 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c
> > index 0f94d859e91c..891d12a5e2cc 100644
> > --- a/drivers/staging/sm750fb/sm750_accel.c
> > +++ b/drivers/staging/sm750fb/sm750_accel.c
> > @@ -90,14 +90,12 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
> > u32 color, u32 rop)
> > {
> > u32 de_ctrl;
> > + int ret;
> >
> > - if (accel->de_wait() != 0) {
> > - /*
> > - * int time wait and always busy,seems hardware
> > - * got something error
> > - */
>
> Why did you delete the comment?
>
> And when did de_wait() start returning correct values?
>
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] staging: sm750fb: propagate error codes from de_wait()
2026-04-09 15:15 ` Denny Lin
@ 2026-04-09 15:22 ` Greg Kroah-Hartman
0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2026-04-09 15:22 UTC (permalink / raw)
To: Denny Lin
Cc: Sudip Mukherjee, Teddy Wang, linux-fbdev, linux-staging,
linux-kernel
On Thu, Apr 09, 2026 at 08:15:36AM -0700, Denny Lin wrote:
> Hi Greg,
>
Odd email style, try replying inline in the real email, not at the top
please :)
> > Why did you delete the comment?
>
> The comment was removed as part of simplifying the code while
> changing the error handling to propagate the return value from
> de_wait(). I can restore or update it if needed.
Please keep it.
> > And when did de_wait() start returning correct values?
>
> de_wait() starts returning a proper errno value in patch 1 of this
> series, where the timeout return value is changed from -1 to
> -ETIMEDOUT. This patch then propagates that error value.
Ah, that wasn't obvious, sorry.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-04-09 15:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-09 14:41 [PATCH 0/2] staging: sm750fb: improve error handling in de_wait path Hungyu Lin
2026-04-09 14:41 ` [PATCH 1/2] staging: sm750fb: return -ETIMEDOUT on timeout in de_wait functions Hungyu Lin
2026-04-09 14:41 ` [PATCH 2/2] staging: sm750fb: propagate error codes from de_wait() Hungyu Lin
2026-04-09 15:05 ` Greg Kroah-Hartman
2026-04-09 15:15 ` Denny Lin
2026-04-09 15:22 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox