]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
staging: media: atomisp: Kill OP_std_modadd() macro
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 2 Mar 2026 14:30:40 +0000 (15:30 +0100)
committerSakari Ailus <sakari.ailus@linux.intel.com>
Wed, 20 May 2026 08:29:28 +0000 (11:29 +0300)
The OP_std_modadd() adds no value, kill it and update the users to
perform the necessary operations themselves. No intended functional
changes.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Ethan Tidmore <ethantidmore06@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
drivers/staging/media/atomisp/pci/base/circbuf/interface/ia_css_circbuf.h
drivers/staging/media/atomisp/pci/base/circbuf/interface/ia_css_circbuf_desc.h
drivers/staging/media/atomisp/pci/hive_isp_css_include/math_support.h
drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c

index 148f9f6febfb464e186de22aa0eb519cd7f83356..4732b45b25eeb65154866e4574c2d7ba5d9744fe 100644 (file)
@@ -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);
@@ -150,9 +148,7 @@ static inline uint8_t ia_css_circbuf_get_pos_at_offset(
                offset += cb->desc->size;
 
        /* 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;
 }
 
 /**
index 3d89626a073337b3b186be0dc69c850402c00703..64f754f1d49b3ac0fce20238f0633dac64f5c5e3 100644 (file)
@@ -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);
 
@@ -88,9 +86,7 @@ static inline uint8_t ia_css_circbuf_desc_get_pos_at_offset(
                offset += cb_desc->size;
 
        /* 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;
 }
 
 /**
index 2cb5c986790a8be80d50d36d948310a0c85802b7..72a070d94736067757d1fede194ebb22ecdecc72 100644 (file)
 #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 */
index afe77d4373f8dda6da572a496b4e1c11e59a44f7..d27c6567daeb08897d276271ebc9c543a67ed074 100644 (file)
@@ -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;