mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] i3c: dw: Use more common code in dw_i3c_master_i2c_xfers()
@ 2026-02-27 10:20 Markus Elfring
  2026-02-27 15:58 ` Frank Li
  2026-02-27 16:04 ` Nuno Sá
  0 siblings, 2 replies; 3+ messages in thread
From: Markus Elfring @ 2026-02-27 10:20 UTC (permalink / raw)
  To: linux-i3c, Adrian Ng Ho Yin, Alexandre Belloni, Frank Li,
	Fredrik Markstrom, Ivar Holmqvist, Jorge Marques,
	Manikanta Guntupalli, Sakari Ailus, Wolfram Sang, Zilin Guan
  Cc: LKML, Aniket, Jianhao Xu

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 27 Feb 2026 10:16:50 +0100

Use an additional label so that a bit of common code can be better reused
at the end of this function implementation.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/i3c/master/dw-i3c-master.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index d87bde3f7700..beb40d947e6e 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -1113,8 +1113,7 @@ static int dw_i3c_master_i2c_xfers(struct i2c_dev_desc *dev,
 		dev_err(master->dev,
 			"<%s> cannot resume i3c bus master, err: %d\n",
 			__func__, ret);
-		dw_i3c_master_free_xfer(xfer);
-		return ret;
+		goto free_xfer;
 	}
 
 	for (i = 0; i < i2c_nxfers; i++) {
@@ -1144,10 +1143,10 @@ static int dw_i3c_master_i2c_xfers(struct i2c_dev_desc *dev,
 	if (!wait_for_completion_timeout(&xfer->comp, m->i2c.timeout))
 		dw_i3c_master_dequeue_xfer(master, xfer);
 
+	pm_runtime_put_autosuspend(master->dev);
 	ret = xfer->ret;
+free_xfer:
 	dw_i3c_master_free_xfer(xfer);
-
-	pm_runtime_put_autosuspend(master->dev);
 	return ret;
 }
 
-- 
2.53.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] i3c: dw: Use more common code in dw_i3c_master_i2c_xfers()
  2026-02-27 10:20 [PATCH] i3c: dw: Use more common code in dw_i3c_master_i2c_xfers() Markus Elfring
@ 2026-02-27 15:58 ` Frank Li
  2026-02-27 16:04 ` Nuno Sá
  1 sibling, 0 replies; 3+ messages in thread
From: Frank Li @ 2026-02-27 15:58 UTC (permalink / raw)
  To: Markus Elfring
  Cc: linux-i3c, Adrian Ng Ho Yin, Alexandre Belloni,
	Fredrik Markstrom, Ivar Holmqvist, Jorge Marques,
	Manikanta Guntupalli, Sakari Ailus, Wolfram Sang, Zilin Guan,
	LKML, Aniket, Jianhao Xu

On Fri, Feb 27, 2026 at 11:20:59AM +0100, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 27 Feb 2026 10:16:50 +0100
>
> Use an additional label so that a bit of common code can be better reused
> at the end of this function implementation.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
>  drivers/i3c/master/dw-i3c-master.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> index d87bde3f7700..beb40d947e6e 100644
> --- a/drivers/i3c/master/dw-i3c-master.c
> +++ b/drivers/i3c/master/dw-i3c-master.c
> @@ -1113,8 +1113,7 @@ static int dw_i3c_master_i2c_xfers(struct i2c_dev_desc *dev,
>  		dev_err(master->dev,
>  			"<%s> cannot resume i3c bus master, err: %d\n",
>  			__func__, ret);
> -		dw_i3c_master_free_xfer(xfer);
> -		return ret;
> +		goto free_xfer;
>  	}
>
>  	for (i = 0; i < i2c_nxfers; i++) {
> @@ -1144,10 +1143,10 @@ static int dw_i3c_master_i2c_xfers(struct i2c_dev_desc *dev,
>  	if (!wait_for_completion_timeout(&xfer->comp, m->i2c.timeout))
>  		dw_i3c_master_dequeue_xfer(master, xfer);
>
> +	pm_runtime_put_autosuspend(master->dev);
>  	ret = xfer->ret;
> +free_xfer:
>  	dw_i3c_master_free_xfer(xfer);
> -
> -	pm_runtime_put_autosuspend(master->dev);
>  	return ret;
>  }
>
> --
> 2.53.0
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] i3c: dw: Use more common code in dw_i3c_master_i2c_xfers()
  2026-02-27 10:20 [PATCH] i3c: dw: Use more common code in dw_i3c_master_i2c_xfers() Markus Elfring
  2026-02-27 15:58 ` Frank Li
@ 2026-02-27 16:04 ` Nuno Sá
  1 sibling, 0 replies; 3+ messages in thread
From: Nuno Sá @ 2026-02-27 16:04 UTC (permalink / raw)
  To: Markus Elfring, linux-i3c, Adrian Ng Ho Yin, Alexandre Belloni,
	Frank Li, Fredrik Markstrom, Ivar Holmqvist, Jorge Marques,
	Manikanta Guntupalli, Sakari Ailus, Wolfram Sang, Zilin Guan
  Cc: LKML, Aniket, Jianhao Xu

On Fri, 2026-02-27 at 11:20 +0100, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 27 Feb 2026 10:16:50 +0100
> 
> Use an additional label so that a bit of common code can be better reused
> at the end of this function implementation.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---

This actually looks like a fix to me. It's not just reusing common code.

- Nuno Sá

>  drivers/i3c/master/dw-i3c-master.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> index d87bde3f7700..beb40d947e6e 100644
> --- a/drivers/i3c/master/dw-i3c-master.c
> +++ b/drivers/i3c/master/dw-i3c-master.c
> @@ -1113,8 +1113,7 @@ static int dw_i3c_master_i2c_xfers(struct i2c_dev_desc *dev,
>  		dev_err(master->dev,
>  			"<%s> cannot resume i3c bus master, err: %d\n",
>  			__func__, ret);
> -		dw_i3c_master_free_xfer(xfer);
> -		return ret;
> +		goto free_xfer;
>  	}
>  
>  	for (i = 0; i < i2c_nxfers; i++) {
> @@ -1144,10 +1143,10 @@ static int dw_i3c_master_i2c_xfers(struct i2c_dev_desc *dev,
>  	if (!wait_for_completion_timeout(&xfer->comp, m->i2c.timeout))
>  		dw_i3c_master_dequeue_xfer(master, xfer);
>  
> +	pm_runtime_put_autosuspend(master->dev);
>  	ret = xfer->ret;
> +free_xfer:
>  	dw_i3c_master_free_xfer(xfer);
> -
> -	pm_runtime_put_autosuspend(master->dev);
>  	return ret;
>  }
>  
> -- 
> 2.53.0
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-02-27 16:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-27 10:20 [PATCH] i3c: dw: Use more common code in dw_i3c_master_i2c_xfers() Markus Elfring
2026-02-27 15:58 ` Frank Li
2026-02-27 16:04 ` Nuno Sá

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®