Re: [PATCH v4] staging: panel: change struct bits to a bit array

From: Willy Tarreau
Date: Tue Mar 17 2015 - 02:39:54 EST


On Mon, Mar 16, 2015 at 12:25:31PM +0300, Dan Carpenter wrote:
> Both "bits.e" and "BIT_CHK(bits, LCD_BIT_E_MASK)" are terrible. The new
> one is worse because it takes more words to tell you nothing and because
> it is wrong since E is a flag not a mask.

Yep, I agree. Maybe simply renaming "bits" to "lcd_pin" in the original
code would make it more obvious what the original ones meant.

Isaac BTW, if you only want to shrink the structure, you can do it using
a single bit per pin this way :

struct {
char e:1;
char rw:1;
char rs:1;
char sda:1;
char scl:1;
...
} pins;

Sorry I don't remember exactly the list of pins, but you get the idea.

Willy

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/