Skip to contentSkip to conversation

use the macro LOWEST_BIT where appropriate

PATCH Superseded Nicola Vetrini 2 participants 5 messages Oct 12, 2023

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover use the macro LOWEST_BIT where appropriate

This series replaces two instances of the pattern (x & -x) with the macro LOWEST_BIT, introduced by the series [1]. Therefore, these patches should be applied on top of patch 1 from that series.

[1] https://marc.info/?l=xen-devel&m=169712438716424&w=2

Nicola Vetrini (2):
xen/vmap: use LOWEST_BIT to wrap a violation of Rule 10.1 xen/iommu: use LOWEST_BIT to wrap a violation of Rule 10.1

 xen/common/vmap.c               | 2 +-
 xen/drivers/passthrough/iommu.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--
2.34.1

#1 lore raw

PATCH 1/2 xen/vmap: use LOWEST_BIT to wrap a violation of Rule 10.1

No functional change.

---
 xen/common/vmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/common/vmap.c +1 -1
index 4fd6b3067ec1..34e99d780c03 100644
@@ -53,7 +53,7 @@ static void *vm_alloc(unsigned int nr, unsigned int align,
     if ( !align )
         align = 1;
     else if ( align & (align - 1) )
-        align &= -align;
+        align = LOWEST_BIT(align);
 
     ASSERT((t >= VMAP_DEFAULT) && (t < VMAP_REGION_NR));
     if ( !vm_base[t] )
Signature · 1 line
2.34.1
#3 lore raw

PATCH 2/2 xen/iommu: use LOWEST_BIT to wrap a violation of Rule 10.1

In reply to Nicola Vetrini

No functional change.

---
 xen/drivers/passthrough/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/drivers/passthrough/iommu.c +1 -1
index f9a9f53dbd44..558700788d4a 100644
@@ -560,7 +560,7 @@ int __init iommu_setup(void)
         rc = iommu_hardware_setup();
         if ( !rc )
             ops = iommu_get_ops();
-        if ( ops && (ops->page_sizes & -ops->page_sizes) != PAGE_SIZE )
+        if ( ops && (LOWEST_BIT(ops->page_sizes)) != PAGE_SIZE )
         {
             printk(XENLOG_ERR "IOMMU: page size mask %lx unsupported\n",
                    ops->page_sizes);
Signature · 1 line
2.34.1