linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soundwire: Use min() to improve code
@ 2025-08-14 14:24 Qianfeng Rong
  2025-09-01 17:19 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Qianfeng Rong @ 2025-08-14 14:24 UTC (permalink / raw)
  To: Srinivas Kandagatla, Vinod Koul, Bard Liao, Pierre-Louis Bossart,
	linux-sound, linux-arm-msm, linux-kernel
  Cc: Qianfeng Rong

Use min() to reduce the code in qcom_swrm_xfer_msg() and improve its
readability.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
 drivers/soundwire/qcom.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index bd2b293b44f2..5b3078220189 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -924,10 +924,7 @@ static enum sdw_command_response qcom_swrm_xfer_msg(struct sdw_bus *bus,
 
 	if (msg->flags == SDW_MSG_FLAG_READ) {
 		for (i = 0; i < msg->len;) {
-			if ((msg->len - i) < QCOM_SWRM_MAX_RD_LEN)
-				len = msg->len - i;
-			else
-				len = QCOM_SWRM_MAX_RD_LEN;
+			len = min(msg->len - i, QCOM_SWRM_MAX_RD_LEN);
 
 			ret = qcom_swrm_cmd_fifo_rd_cmd(ctrl, msg->dev_num,
 							msg->addr + i, len,
-- 
2.34.1


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

* Re: [PATCH] soundwire: Use min() to improve code
  2025-08-14 14:24 [PATCH] soundwire: Use min() to improve code Qianfeng Rong
@ 2025-09-01 17:19 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2025-09-01 17:19 UTC (permalink / raw)
  To: Srinivas Kandagatla, Bard Liao, Pierre-Louis Bossart, linux-sound,
	linux-arm-msm, linux-kernel, Qianfeng Rong


On Thu, 14 Aug 2025 22:24:28 +0800, Qianfeng Rong wrote:
> Use min() to reduce the code in qcom_swrm_xfer_msg() and improve its
> readability.
> 
> 

Applied, thanks!

[1/1] soundwire: Use min() to improve code
      commit: 88f5d2a477ec64b12e83b488407490bb4a9298f8

Best regards,
-- 
~Vinod



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

end of thread, other threads:[~2025-09-01 17:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-14 14:24 [PATCH] soundwire: Use min() to improve code Qianfeng Rong
2025-09-01 17:19 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).