From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Hans de Goede <hansg@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-staging@lists.linux.dev
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Andy Shevchenko <andy@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: [PATCH v1 1/1] media: atomisp: Kill OP_std_modadd() macro
Date: Mon, 2 Mar 2026 15:30:40 +0100 [thread overview]
Message-ID: <20260302143040.2495464-1-andriy.shevchenko@linux.intel.com> (raw)
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>
---
.../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(-)
diff --git a/drivers/staging/media/atomisp/pci/base/circbuf/interface/ia_css_circbuf.h b/drivers/staging/media/atomisp/pci/base/circbuf/interface/ia_css_circbuf.h
index 86300991d30e..b4d86d1e4a61 100644
--- a/drivers/staging/media/atomisp/pci/base/circbuf/interface/ia_css_circbuf.h
+++ b/drivers/staging/media/atomisp/pci/base/circbuf/interface/ia_css_circbuf.h
@@ -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;
}
/**
diff --git a/drivers/staging/media/atomisp/pci/base/circbuf/interface/ia_css_circbuf_desc.h b/drivers/staging/media/atomisp/pci/base/circbuf/interface/ia_css_circbuf_desc.h
index 5645a7bf493c..5c213fe427d3 100644
--- a/drivers/staging/media/atomisp/pci/base/circbuf/interface/ia_css_circbuf_desc.h
+++ b/drivers/staging/media/atomisp/pci/base/circbuf/interface/ia_css_circbuf_desc.h
@@ -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;
}
/**
diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/math_support.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/math_support.h
index 2cb5c986790a..72a070d94736 100644
--- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/math_support.h
+++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/math_support.h
@@ -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 */
diff --git a/drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c b/drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c
index afe77d4373f8..d27c6567daeb 100644
--- a/drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c
+++ b/drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c
@@ -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;
--
2.50.1
next reply other threads:[~2026-03-02 14:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 14:30 Andy Shevchenko [this message]
2026-03-03 5:55 ` Ethan Tidmore
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260302143040.2495464-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=andy@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®