[PATCH v2] staging: most: dim2: replace ROUND_UP_TO macro with round_up()

Mark Adamenko posted 1 patch 1 month, 1 week ago
drivers/staging/most/dim2/hal.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[PATCH v2] staging: most: dim2: replace ROUND_UP_TO macro with round_up()
Posted by Mark Adamenko 1 month, 1 week ago
The ROUND_UP_TO macro reuses argument 'd', which can cause unintended
side effects. Remove it and replace the macro call with the existing
round_up() function.

Signed-off-by: Mark Adamenko <marusik.adamenko@gmail.com>
---
v2: use existing round_up() instead of a custom inline function
---
 drivers/staging/most/dim2/hal.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/most/dim2/hal.c b/drivers/staging/most/dim2/hal.c
index 6abe3ab2b2cf..ae9006703f23 100644
--- a/drivers/staging/most/dim2/hal.c
+++ b/drivers/staging/most/dim2/hal.c
@@ -45,8 +45,6 @@
 #define DBR_SIZE  (16 * 1024) /* specified by IP */
 #define DBR_BLOCK_SIZE  (DBR_SIZE / 32 / DBR_MAP_SIZE)
 
-#define ROUND_UP_TO(x, d)  (DIV_ROUND_UP(x, (d)) * (d))
-
 /* -------------------------------------------------------------------------- */
 /* generic helper functions and macros */
 
@@ -758,7 +756,7 @@ static u8 init_ctrl_async(struct dim_channel *ch, u8 type, u8 is_tx,
 		return DIM_INIT_ERR_CHANNEL_ADDRESS;
 
 	if (!ch->dbr_size)
-		ch->dbr_size = ROUND_UP_TO(hw_buffer_size, DBR_BLOCK_SIZE);
+		ch->dbr_size = round_up(hw_buffer_size, DBR_BLOCK_SIZE);
 	ch->dbr_addr = alloc_dbr(ch->dbr_size);
 	if (ch->dbr_addr >= DBR_SIZE)
 		return DIM_INIT_ERR_OUT_OF_MEMORY;
-- 
2.53.0
Re: [PATCH v2] staging: most: dim2: replace ROUND_UP_TO macro with round_up()
Posted by Dan Carpenter 1 month, 1 week ago
On Thu, Mar 05, 2026 at 06:19:26PM -0800, Mark Adamenko wrote:
> The ROUND_UP_TO macro reuses argument 'd', which can cause unintended
> side effects. Remove it and replace the macro call with the existing
> round_up() function.
> 
> Signed-off-by: Mark Adamenko <marusik.adamenko@gmail.com>
> ---
> v2: use existing round_up() instead of a custom inline function

Thanks!

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

regards,
dan carpenter