#define MINORBITS 20 #define MINORMASK ((1U << MINORBITS) - 1) ...snip... #define MINOR(dev) ((unsigned int) ((dev) & MINORMASK))