On Tue, Jan 16, 2018 at 12:00:31PM +0100, Linus Walleij wrote: > + bit = -1; > + while ((bit = find_next_bit(mask, gc->ngpio, bit + 1)) < gc->ngpio) > readmask |= bgpio_line2mask(gc, bit); Amend include/linux/bitrev.h with a bitrev64() macro. Further amend it with a bitrevul() macro which calls bitrev32() or bitrev(64) depending on the arch's unsigned long size. Then use bitrevul() on mask and the rest is just OR/AND operations (instead of the while loop). Thanks, Lukas -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html