]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
i3c: cdns: use parity8 helper instead of open coding it
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Tue, 7 Jan 2025 09:02:03 +0000 (10:02 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Sun, 12 Jan 2025 22:55:50 +0000 (23:55 +0100)
The kernel has now a generic helper for getting parity with easier to
understand semantics. Make use of it.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20250107090204.6593-6-wsa+renesas@sang-engineering.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/i3c/master/i3c-master-cdns.c

index fe4d59833ad5f4e77a32b7f195b8c8e32af895d8..8d69a34986d96c7f4280a084a6df53720b267ee5 100644 (file)
@@ -889,8 +889,7 @@ static u32 prepare_rr0_dev_address(u32 addr)
        ret |= (addr & GENMASK(9, 7)) << 6;
 
        /* RR0[0] = ~XOR(addr[6:0]) */
-       if (!(hweight8(addr & 0x7f) & 1))
-               ret |= 1;
+       ret |= parity8(addr & 0x7f) ? 0 : BIT(0);
 
        return ret;
 }