[RFC PATCH v2 1/2] staging: media: atomisp: Change name to better follow its behavior

Adrian Barnaś posted 2 patches 4 weeks, 1 day ago
[RFC PATCH v2 1/2] staging: media: atomisp: Change name to better follow its behavior
Posted by Adrian Barnaś 4 weeks, 1 day ago
Change name to clearly states what function does.
Signed-off-by: Adrian Barnaś <abarnas@google.com>
---
 .../atomisp/pci/hive_isp_css_common/host/vmem.c  | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/vmem.c b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/vmem.c
index 547cc480c105..a3fe03216389 100644
--- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/vmem.c
+++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/vmem.c
@@ -22,9 +22,9 @@ subword(unsigned long long w, unsigned int start, unsigned int end)
 	return (w & (((1ULL << (end - 1)) - 1) << 1 | 1)) >> start;
 }
 
-/* inverse subword bits move like this: MSB[xxxx____xxxx]LSB -> MSB[xxxx0000xxxx]LSB */
+/* clears subword bits like this: MSB[xxxx____xxxx]LSB -> MSB[xxxx0000xxxx]LSB */
 static inline unsigned long long
-inv_subword(unsigned long long w, unsigned int start, unsigned int end)
+clear_subword(unsigned long long w, unsigned int start, unsigned int end)
 {
 	return w & (~(((1ULL << (end - 1)) - 1) << 1 | 1) | ((1ULL << start) - 1));
 }
@@ -45,16 +45,16 @@ static void move_subword(unsigned long long *target, unsigned int target_bit,
 
 	if (subword_width + start_bit > uedge_bits) { /* overlap */
 		unsigned long long old_val1;
-		unsigned long long old_val0 = inv_subword(target[start_elem],
-							  start_bit, uedge_bits);
+		unsigned long long old_val0 = clear_subword(target[start_elem],
+							    start_bit, uedge_bits);
 
 		target[start_elem] = old_val0 | (src_subword << start_bit);
-		old_val1 = inv_subword(target[start_elem + 1], 0,
-				       subword_width + start_bit - uedge_bits);
+		old_val1 = clear_subword(target[start_elem + 1], 0,
+					 subword_width + start_bit - uedge_bits);
 		target[start_elem + 1] = old_val1 | (src_subword >> (uedge_bits - start_bit));
 	} else {
-		unsigned long long old_val = inv_subword(target[start_elem], start_bit,
-							 start_bit + subword_width);
+		unsigned long long old_val = clear_subword(target[start_elem], start_bit,
+							   start_bit + subword_width);
 
 		target[start_elem] = old_val | (src_subword << start_bit);
 	}
-- 
2.51.0.355.g5224444f11-goog
Re: [RFC PATCH v2 1/2] staging: media: atomisp: Change name to better follow its behavior
Posted by Andy Shevchenko 4 weeks, 1 day ago
On Wed, Sep 03, 2025 at 09:27:53AM +0000, Adrian Barnaś wrote:
> Change name to clearly states what function does.

The Subject and the body of the commit message should be more specific.

Missing blank line.

> Signed-off-by: Adrian Barnaś <abarnas@google.com>

-- 
With Best Regards,
Andy Shevchenko


Re: [RFC PATCH v2 1/2] staging: media: atomisp: Change name to better follow its behavior
Posted by Adrian Barnaś 4 weeks ago
Hi Andy

Regardless commit message, is the change OK and can post it as a
patch, or similarly to second patch it is not worth the effort as it
will be refactored at some point?

> Change name to clearly states what function does.
Proposed description:

staging: media: atomisp: Rename `inv_subword()` to `clear_subword()`

Function `inv_subword()` does not inverse bits or subword and neither is
inverse operation for `subword()` function. It is used to clear target bits of
move_subword operation (specified by start and end-1 indexes). Name
`clear_subword()` explains the function behavior better.

Best Regards
Adrian Barnaś

On Thu, Sep 4, 2025 at 9:48 AM Andy Shevchenko
<andriy.shevchenko@intel.com> wrote:
>
> On Wed, Sep 03, 2025 at 09:27:53AM +0000, Adrian Barnaś wrote:
> > Change name to clearly states what function does.
>
> The Subject and the body of the commit message should be more specific.
>
> Missing blank line.
>
> > Signed-off-by: Adrian Barnaś <abarnas@google.com>
>
> --
> With Best Regards,
> Andy Shevchenko
>
>