Skip to contentSkip to conversation

lib: add alternatives for GENMASK()

PATCH Alexey Dobriyan 1 participant 1 message Oct 25, 2025

lore
Share & tools
lore
#0 lore raw
Quoted 7 lines

GENMASK(high, low) notation reflects a common pattern to describe hardware registers. However, out of drivers context it's confusing and error-prone.

This series introduces alternatives for GENMASK():

- BITS(low, high);

This is less bad (low bit then high), but in a perfect world high bit should have been exclusive.

Quoted 2 lines

- FIRST_BITS(nbits);
- LAST_BITS(start);

Now it is 200% more confusing.