What endianness is word in i2c_smbus_data?

From: Andy Lutomirski
Date: Tue Jul 16 2013 - 21:57:57 EST


I'm rather confused here. In SMBUS, the "read word" operation returns
two bytes. Just to be confusing, the SMBUS spec calls the first byte
"Data Byte Low" and the second byte "Data Byte High". But they really
are the first and second bytes -- Read Word will return whatever Read
Byte would have as its first byte. Let's call these bytes B1 and B2
for first and second.

The eeprom and at24 drivers expect data->word to be (B2 << 8) | B1.
That is, data->word is the cpu representation of the value on the bus
if that value is treated as little-endian. Is that indeed the correct
interpretation? If so, should it be documented somewhere?

--Andy

--
Andy Lutomirski
AMA Capital Management, LLC
--
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/