soundwire: Use min() to improve code
Use min() to reduce the code in qcom_swrm_xfer_msg() and improve its readability. Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com> Link: https://lore.kernel.org/r/20250814142428.282639-1-rongqianfeng@vivo.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
committed by
Vinod Koul
parent
969bf687c1
commit
88f5d2a477
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user