Use of swab16() in drivers/hwmon/*.c
Hi,
I wonder about a specific use of swab16() in several files in drivers/hwmon/.
Consider ds1621.c: We get big endian words from i2c_smbus_read_word_data(). To use it on a little endian arch, the driver uses swab16() for conversion by swapping bytes unconditionally.
IMHO this is not suitable on a big endian architecture. Shouldn't it be sth. like be16_to_cpu()?
Thanks in advance.
bye,
Roland
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hallo Roland,
Quoted 9 lines · Roland Stigge
I wonder about a specific use of
swab16()in several files indrivers/hwmon/.Consider
ds1621.c: We get big endian words fromi2c_smbus_read_word_data(). To use it on a little endian arch, the driver usesswab16()for conversion by swapping bytes unconditionally.IMHO this is not suitable on a big endian architecture. Shouldn't it be sth. like
be16_to_cpu()?
This has nothing to do with the host's endianess. This has to do with the fact that the SMBus specification says that words are sent low byte first but almost all hardware monitoring devices send the high byte first (because it makes a lot more sense.)
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi,
Quoted 4 lines · Jean Delvare
This has nothing to do with the host's endianess. This has to do with the fact that the SMBus specification says that words are sent low byte first but almost all hardware monitoring devices send the high byte first (because it makes a lot more sense.)
Thanks! I just ignored that the word implementation of Linux' SMBus (I2C_SMBUS_WORD_DATA etc.) already takes care of that.
bye,
Roland
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors