| Recently, I've had the (mis)fortune to work on a driver for an unnamed device. The device in question was little-endian, and as long as the driver was working on Intel platforms (which are little-endian), all was well and good with the world. Except for the usual hardware woes 123, which will be elaborated upon in a separate entry. The day came when we had to port the driver to PowerPC, which is a much nicer architecture in general. Alas, it is also big-endian. This is where the fun starts.
and then used this mask in her code: /* read value from register at offset */ val = val | MASK_FOR_SOME_BIT; /* write it back */ Can you spot the bug here? Think of the endianness of the value read from the card, and the endianness of the mask, and which bit actually gets changed, and enlightenment shall come. --------------------------------------------- 1 Insufficient documentation. 2 Wrong documentation. 3 No way to figure out why the device doesn't like what we write to it, except for the documentation. See 1 and 2. |