[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v4 3/6] arm64/find_next_bit: Remove ext2_swab()


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Lin Liu <lin.liu@xxxxxxxxxx>
  • Date: Mon, 23 May 2022 05:52:19 -0400
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Lin Liu <lin.liu@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 23 May 2022 09:52:57 +0000
  • Ironport-data: A9a23:rLCqU6jgwGWJxIN78pwa5VTYX161dBAKZh0ujC45NGQN5FlHY01je htvWjuAaf6KY2Kkeoh+aYSw8xlTvZ+ExtM1SgtpryljQXwb9cadCdqndUqhZCn6wu8v7a5EA 2fyTvGacajYm1eF/k/F3oDJ9CU6jefSLlbFILas1hpZHGeIcw98z0M68wIFqtQw24LhXlnW4 YqaT/D3YzdJ5RYlagr41IrbwP9flKyaVOQw5wFWiVhj5TcyplFNZH4tDfjZw0jQG+G4KtWSV efbpIxVy0uCl/sb5nFJpZ6gGqECaua60QFjERO6UYD66vRJjnRaPqrWqJPwwKqY4tmEt4kZ9 TlDiXC/YTcrI/Pdk7QQaDd/GgFvDINGv4D9HkHq5KR/z2WeG5ft6/BnDUVwNowE4OdnR2pJ8 JT0KhhUMErF3bjvhuvmFK883azPL+GyVG8bknVhy3fdDOsOSpHfWaTao9Rf2V/cg+gRQaqCO pNEMVKDajzJahEVFH0VOKsEo970qyfnUg1kkhW88P9fD2/7k1UqjemF3MDuUtaHX9lPl0CU4 GfP5X3kAwoyPcaajzGC9xqEuOjLmi/qXZMII5ex/PVqnV67y3QaDVsdUl7Tifukjk+zXfpPJ kpS/TAhxYAi+UruQtTjUhmQpH+fogVaS9dWC/c96gyG1uzT+QnxLnMfUjdLZdgitck3bT8nz FmEm5XuHzMHjVGOYSvDrPHO92r0YHVLaz9ZDcMZcecby+nhvd8ihULCdfhEGY6kv/P1Xg7K/ Anf+UDSmI4vYd43O7STpA6a2Gj39siSFGbZ9S2MADv7s1oRiJqNItXxtAOFtasowJOxFAHpg ZQSpySJAAni57mpnTfFfugCFarBCx2tYGyF2g4H83XMGl2QF5+fkWN4umgWyL9BaJpsRNMQS Ba7VfltzJFSJmC2SqR8fpi8Dc8npYC5S4m+DKyIMoMUOsEhHONiwM2JTRfNt10BbWB2yf1vU XtlWZjE4Ykm5VRPk2PtGrZ1PU4DzSEi32LDLa0XPDz+uYdykEW9EO9fWHPXN7hRxPrd8G39r ocEX+PXmko3bQELSnSOmWLlBQtSfSZT6FGfg5E/S9Nv1SI9SDB9UKWImOxJlk4Mt/09q9okN 0qVAidwoGcTT1WeQelWQhiPsI/SYKs=
  • Ironport-hdrordr: A9a23:igdNq69rBSGM+tJcG0xuk+DgI+orL9Y04lQ7vn2YSXRuHPBw8P re+sjztCWE8Ar5N0tBpTntAsW9qDbnhPtICOoqTNCftWvdyQiVxehZhOOIqVDd8m/Fh4pgPM 9bAtFD4bbLbGSS4/yU3ODBKadD/OW6
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

ext2 has nothing to do with this logic.  Clean up the code with
xen/byteswap.h which now has an unsigned long helper.

No functional change.

Signed-off-by: Lin Liu <lin.liu@xxxxxxxxxx>
---
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Cc: Julien Grall <julien@xxxxxxx>
Cc: Bertrand Marquis <bertrand.marquis@xxxxxxx>
Cc: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
---
 xen/arch/arm/arm64/lib/find_next_bit.c | 36 +++++---------------------
 1 file changed, 6 insertions(+), 30 deletions(-)

diff --git a/xen/arch/arm/arm64/lib/find_next_bit.c 
b/xen/arch/arm/arm64/lib/find_next_bit.c
index 8ebf8bfe97..e3b3720ff4 100644
--- a/xen/arch/arm/arm64/lib/find_next_bit.c
+++ b/xen/arch/arm/arm64/lib/find_next_bit.c
@@ -161,30 +161,6 @@ EXPORT_SYMBOL(find_first_zero_bit);
 
 #ifdef __BIG_ENDIAN
 
-/* include/linux/byteorder does not support "unsigned long" type */
-static inline unsigned long ext2_swabp(const unsigned long * x)
-{
-#if BITS_PER_LONG == 64
-       return (unsigned long) __swab64p((u64 *) x);
-#elif BITS_PER_LONG == 32
-       return (unsigned long) __swab32p((u32 *) x);
-#else
-#error BITS_PER_LONG not defined
-#endif
-}
-
-/* include/linux/byteorder doesn't support "unsigned long" type */
-static inline unsigned long ext2_swab(const unsigned long y)
-{
-#if BITS_PER_LONG == 64
-       return (unsigned long) __swab64((u64) y);
-#elif BITS_PER_LONG == 32
-       return (unsigned long) __swab32((u32) y);
-#else
-#error BITS_PER_LONG not defined
-#endif
-}
-
 #ifndef find_next_zero_bit_le
 unsigned long find_next_zero_bit_le(const void *addr, unsigned
                long size, unsigned long offset)
@@ -199,7 +175,7 @@ unsigned long find_next_zero_bit_le(const void *addr, 
unsigned
        size -= result;
        offset &= (BITS_PER_LONG - 1UL);
        if (offset) {
-               tmp = ext2_swabp(p++);
+               tmp = bswap_ul(*p++);
                tmp |= (~0UL >> (BITS_PER_LONG - offset));
                if (size < BITS_PER_LONG)
                        goto found_first;
@@ -217,7 +193,7 @@ unsigned long find_next_zero_bit_le(const void *addr, 
unsigned
        }
        if (!size)
                return result;
-       tmp = ext2_swabp(p);
+       tmp = bswap_ul(*p);
 found_first:
        tmp |= ~0UL << size;
        if (tmp == ~0UL)        /* Are any bits zero? */
@@ -226,7 +202,7 @@ found_middle:
        return result + ffz(tmp);
 
 found_middle_swap:
-       return result + ffz(ext2_swab(tmp));
+       return result + ffz(bswap_ul(tmp));
 }
 EXPORT_SYMBOL(find_next_zero_bit_le);
 #endif
@@ -245,7 +221,7 @@ unsigned long find_next_bit_le(const void *addr, unsigned
        size -= result;
        offset &= (BITS_PER_LONG - 1UL);
        if (offset) {
-               tmp = ext2_swabp(p++);
+               tmp = bswap_ul(*p++);
                tmp &= (~0UL << offset);
                if (size < BITS_PER_LONG)
                        goto found_first;
@@ -264,7 +240,7 @@ unsigned long find_next_bit_le(const void *addr, unsigned
        }
        if (!size)
                return result;
-       tmp = ext2_swabp(p);
+       tmp = bswap_ul(*p);
 found_first:
        tmp &= (~0UL >> (BITS_PER_LONG - size));
        if (tmp == 0UL)         /* Are any bits set? */
@@ -273,7 +249,7 @@ found_middle:
        return result + __ffs(tmp);
 
 found_middle_swap:
-       return result + __ffs(ext2_swab(tmp));
+       return result + __ffs(bswap_ul(tmp));
 }
 EXPORT_SYMBOL(find_next_bit_le);
 #endif
-- 
2.27.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.