Skip to contentSkip to conversation

media: atomisp: Kill OP_std_modadd() macro

PATCH In review Andy Shevchenko 2 participants 2 messages Mar 2 – Mar 3

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: atomisp: Kill OP_std_modadd() macro

The OP_std_modadd() adds no value, kill it and update the users to perform the necessary operations themselves. No intended functional changes.

---
 .../atomisp/pci/base/circbuf/interface/ia_css_circbuf.h   | 6 +-----
 .../pci/base/circbuf/interface/ia_css_circbuf_desc.h      | 8 ++------
 .../media/atomisp/pci/hive_isp_css_include/math_support.h | 6 ------
 .../staging/media/atomisp/pci/runtime/queue/src/queue.c   | 4 ++--
 4 files changed, 5 insertions(+), 19 deletions(-)
drivers/staging/media/atomisp/pci/base/circbuf/interface/ia_css_circbuf.h +1 -5
index 86300991d30e..b4d86d1e4a61 100644
@@ -139,8 +139,6 @@ static inline uint8_t ia_css_circbuf_get_pos_at_offset(
     u32 base,
     int offset)
 {
-	u8 dest;
-
 	OP___assert(cb);
 	OP___assert(cb->desc);
 	OP___assert(cb->desc->size > 0);
@@ -151,9 +149,7 @@ static inline uint8_t ia_css_circbuf_get_pos_at_offset(
 	}
 
 	/* step 2: shift and round by the upper limit */
-	dest = OP_std_modadd(base, offset, cb->desc->size);
-
-	return dest;
+	return (base + offset) % cb->desc->size;
 }
 
 /**
drivers/staging/media/atomisp/pci/base/circbuf/interface/ia_css_circbuf_desc.h +2 -6
index 5645a7bf493c..5c213fe427d3 100644
@@ -47,7 +47,7 @@ static inline bool ia_css_circbuf_desc_is_full(
     ia_css_circbuf_desc_t *cb_desc)
 {
 	OP___assert(cb_desc);
-	return (OP_std_modadd(cb_desc->end, 1, cb_desc->size) == cb_desc->start);
+	return ((cb_desc->end + 1) % cb_desc->size) == cb_desc->start;
 }
 
 /**
@@ -78,8 +78,6 @@ static inline uint8_t ia_css_circbuf_desc_get_pos_at_offset(
     u32 base,
     int offset)
 {
-	u8 dest;
-
 	OP___assert(cb_desc);
 	OP___assert(cb_desc->size > 0);
 
@@ -89,9 +87,7 @@ static inline uint8_t ia_css_circbuf_desc_get_pos_at_offset(
 	}
 
 	/* step 2: shift and round by the upper limit */
-	dest = OP_std_modadd(base, offset, cb_desc->size);
-
-	return dest;
+	return (base + offset) % cb_desc->size;
 }
 
 /**
drivers/staging/media/atomisp/pci/hive_isp_css_include/math_support.h +0 -6
index 2cb5c986790a..72a070d94736 100644
@@ -14,10 +14,4 @@
 #define CEIL_MUL(a, b)       (CEIL_DIV(a, b) * (b))
 #define CEIL_SHIFT(a, b)     (((a) + (1 << (b)) - 1) >> (b))
 
-/*
- * For SP and ISP, SDK provides the definition of OP_std_modadd.
- * We need it only for host
- */
-#define OP_std_modadd(base, offset, size) ((base + offset) % (size))
-
 #endif /* __MATH_SUPPORT_H */
drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c +2 -2
index afe77d4373f8..d27c6567daeb 100644
@@ -167,7 +167,7 @@ int ia_css_queue_dequeue(ia_css_queue_t *qhandle, uint32_t *item)
 
 		*item = cb_elem.val;
 
-		cb_desc.start = OP_std_modadd(cb_desc.start, 1, cb_desc.size);
+		cb_desc.start = (cb_desc.start + 1) % cb_desc.size;
 
 		/* c. Store the queue object */
 		/* Set only fields requiring update with
@@ -315,7 +315,7 @@ int ia_css_queue_peek(ia_css_queue_t *qhandle, u32 offset, uint32_t *element)
 		if (offset > num_elems)
 			return -EINVAL;
 
-		offset = OP_std_modadd(cb_desc.start, offset, cb_desc.size);
+		offset = (cb_desc.start + offset) % cb_desc.size;
 		error = ia_css_queue_item_load(qhandle, (uint8_t)offset, &cb_elem);
 		if (error != 0)
 			return error;
Signature · 1 line
2.50.1