* [PATCH] firmware: arm_scmi: base: Simplify protocol list size calculation
@ 2026-02-28 3:37 Peng Fan (OSS)
2026-02-28 10:03 ` Cristian Marussi
2026-03-09 9:12 ` Sudeep Holla
0 siblings, 2 replies; 3+ messages in thread
From: Peng Fan (OSS) @ 2026-02-28 3:37 UTC (permalink / raw)
To: Sudeep Holla, Cristian Marussi
Cc: arm-scmi, linux-arm-kernel, linux-kernel, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Replace the open-coded round-up calculation with the kernel's round_up()
helper function for better readability.
The original expression:
(1 + (loop_num_ret - 1) / sizeof(u32)) * sizeof(u32)
is equivalent to rounding up loop_num_ret to the nearest multiple of
sizeof(u32), which is exactly what round_up() does.
No functional changes.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/firmware/arm_scmi/base.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/arm_scmi/base.c b/drivers/firmware/arm_scmi/base.c
index 22267bbd0f4db9e244480b3b9a3b5669e92d82c4..cd1331c2fc40355b54716d4b4fee69b017d3817e 100644
--- a/drivers/firmware/arm_scmi/base.c
+++ b/drivers/firmware/arm_scmi/base.c
@@ -7,6 +7,7 @@
#define pr_fmt(fmt) "SCMI Notifications BASE - " fmt
+#include <linux/math.h>
#include <linux/module.h>
#include <linux/scmi_protocol.h>
@@ -219,8 +220,7 @@ scmi_base_implementation_list_get(const struct scmi_protocol_handle *ph,
}
real_list_sz = t->rx.len - sizeof(u32);
- calc_list_sz = (1 + (loop_num_ret - 1) / sizeof(u32)) *
- sizeof(u32);
+ calc_list_sz = round_up(loop_num_ret, sizeof(u32));
if (calc_list_sz != real_list_sz) {
dev_warn(dev,
"Malformed reply - real_sz:%zd calc_sz:%u (loop_num_ret:%d)\n",
---
base-commit: 7d6661873f6b54c75195780a40d66bad3d482d8f
change-id: 20260227-scmi-check-515d02b3c288
Best regards,
--
Peng Fan <peng.fan@nxp.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] firmware: arm_scmi: base: Simplify protocol list size calculation
2026-02-28 3:37 [PATCH] firmware: arm_scmi: base: Simplify protocol list size calculation Peng Fan (OSS)
@ 2026-02-28 10:03 ` Cristian Marussi
2026-03-09 9:12 ` Sudeep Holla
1 sibling, 0 replies; 3+ messages in thread
From: Cristian Marussi @ 2026-02-28 10:03 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Sudeep Holla, Cristian Marussi, arm-scmi, linux-arm-kernel,
linux-kernel, Peng Fan
On Sat, Feb 28, 2026 at 11:37:33AM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Replace the open-coded round-up calculation with the kernel's round_up()
> helper function for better readability.
>
> The original expression:
> (1 + (loop_num_ret - 1) / sizeof(u32)) * sizeof(u32)
>
Thanks for this.
LGTM.
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Cristian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] firmware: arm_scmi: base: Simplify protocol list size calculation
2026-02-28 3:37 [PATCH] firmware: arm_scmi: base: Simplify protocol list size calculation Peng Fan (OSS)
2026-02-28 10:03 ` Cristian Marussi
@ 2026-03-09 9:12 ` Sudeep Holla
1 sibling, 0 replies; 3+ messages in thread
From: Sudeep Holla @ 2026-03-09 9:12 UTC (permalink / raw)
To: Cristian Marussi, Peng Fan (OSS)
Cc: Sudeep Holla, arm-scmi, linux-arm-kernel, linux-kernel, Peng Fan
On Sat, 28 Feb 2026 11:37:33 +0800, Peng Fan (OSS) wrote:
> Replace the open-coded round-up calculation with the kernel's round_up()
> helper function for better readability.
>
> The original expression:
> (1 + (loop_num_ret - 1) / sizeof(u32)) * sizeof(u32)
>
> is equivalent to rounding up loop_num_ret to the nearest multiple of
> sizeof(u32), which is exactly what round_up() does.
>
> [...]
Applied to sudeep.holla/linux (for-next/scmi/updates), thanks!
[1/1] firmware: arm_scmi: base: Simplify protocol list size calculation
https://git.kernel.org/sudeep.holla/c/09bb95d63ade
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-09 9:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-28 3:37 [PATCH] firmware: arm_scmi: base: Simplify protocol list size calculation Peng Fan (OSS)
2026-02-28 10:03 ` Cristian Marussi
2026-03-09 9:12 ` Sudeep Holla
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox