On Thursday 08 March 2007 22:14, Ivo van Doorn wrote: > Cleanup code, make gcc happy, make sparse happy. What a happy patch ;) > This cleans up the code used to check the validity of the register fields, > this will also reduce the required memory usage while working with sparse. > This patch was inspired on the codesuggestions from Linus. Please cancel this 4th patch, the previous 3 were correct but this one is terribly wrong. > +#define is_power_of_two(x) ( !((x) & ((x)-1)) ) > +#define low_bit_mask(x) ( ((x)-1) & ~(x) ) > +#define is_valid_mask(x) is_power_of_two(1 + (x) + low_bit_mask(x)) > + > +#define FIELD16(__mask) \ > +({ \ > + BUILD_BUG_ON(!__mask || !is_valid_mask(__mask));\ > + (struct rt2x00_field16) { \ > + (__scanbit((__mask), 16) - 1), (__mask) \ > + }; \ > +}) > + > +#define FIELD32(__mask) \ > +({ \ > + BUILD_BUG_ON(!__mask || !is_valid_mask(__mask));\ > + (struct rt2x00_field32) { \ > + (__scanbit((__mask), 32) - 1), (__mask) \ > + }; \ > +}) The problem is here, I have used __scanbit to determine the first bit that is set. __scanbit was used since this doesn't require a pointer to the value while the other functions do require the pointer (and the macro receives the direct value hence the reason for the __scanbit choice). Unfortunately I did not check if __scanbit was available on all arches, and this one seems to only excist for x86_64.. :S I'll try to fix this asap and come with a new patch. Ivo - To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html