Re: [PATCH v4 2/7] drm/xe/sysctrl: Return error codes from sysctrl_wait_bit_set()

Michal Wajdeczko <[email protected]>
Newsgroups org.freedesktop.lists.intel-xe
Message-ID <[email protected]>

On 8/20/2026 12:16 PM, Mallesh Koujalagi wrote:
> Make sysctrl_wait_bit_set() return an error code rather than a bool.
> and update callers to use xe_log_err() with the propagated error code.
> 
> Signed-off-by: Mallesh Koujalagi <[email protected]>

with nits below fixed,

Reviewed-by: Michal Wajdeczko <[email protected]>

> ---
>  drivers/gpu/drm/xe/xe_sysctrl_mailbox.c | 17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c b/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
> index ef847f0a8f2c..3523651b467b 100644
> --- a/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
> +++ b/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
> @@ -42,15 +42,11 @@ static int sysctrl_wait_bit_clear(struct xe_sysctrl *sc, u32 bit_mask,
>  				 timeout_ms * 1000, NULL, false);
>  }
>  
> -static bool sysctrl_wait_bit_set(struct xe_sysctrl *sc, u32 bit_mask,
> -				 unsigned int timeout_ms)
> +static int sysctrl_wait_bit_set(struct xe_sysctrl *sc, u32 bit_mask,
> +				unsigned int timeout_ms)
>  {
> -	int ret;
> -
> -	ret = xe_mmio_wait32(sc->mmio, SYSCTRL_MB_CTRL, bit_mask, bit_mask,
> +	return xe_mmio_wait32(sc->mmio, SYSCTRL_MB_CTRL, bit_mask, bit_mask,
>  			     timeout_ms * 1000, NULL, false);

is this correctly aligned?

> -
> -	return ret == 0;
>  }
>  
>  static int sysctrl_write_frame(struct xe_sysctrl *sc, const void *frame,
> @@ -193,9 +189,10 @@ static int sysctrl_process_frame(struct xe_sysctrl *sc, void *out,
>  	struct xe_device *xe = sc_to_xe(sc);
>  	int ret;
>  
> -	if (!sysctrl_wait_bit_set(sc, SYSCTRL_MB_CTRL_RUN_BUSY_OUT, timeout_ms)) {
> -		xe_err(xe, "sysctrl: Response frame timeout\n");
> -		return -ETIMEDOUT;
> +	ret = sysctrl_wait_bit_set(sc, SYSCTRL_MB_CTRL_RUN_BUSY_OUT, timeout_ms);
> +	if (ret) {
> +		xe_log_err(xe, SYSCTRL, ret,  "Response frame timeout\n");
                                            ^^
double space

> +		return ret;
>  	}
>  
>  	ctrl_reg = xe_mmio_read32(sc->mmio, SYSCTRL_MB_CTRL);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.