Re: Use of swab16() in drivers/hwmon/*.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hallo Roland,

On Fri, 07 Jan 2011 11:37:15 +0100, Roland Stigge wrote:
> 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()?

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.)

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@xxxxxxxxxxxxxx
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors


[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux