Hi, On Thu, Jun 29, 2017 at 02:10:09PM +0200, Benjamin Tissoires wrote: > [...] > > + /* get design capacity */ > + ret = i2c_smbus_read_word_data(client, > + MSHW0011_BAT0_REG_DESIGN_CAPACITY); > + if (ret < 0) { > + dev_err(&client->dev, "Error reading design capacity: %d\n", > + ret); > + return ret; > + } > + bix->design_capacity = le16_to_cpu(ret); i2c_smbus_read_word_data() returns native endianess for little-endian bus (it basically has builtin le16_to_cpu). Your conversion actually _breaks_ support on big endian machines by converting it back. That seems to be a common mistake in the kernel and it might be a good idea to add some Coccinelle script for it? -- Sebastian
Attachment:
signature.asc
Description: PGP signature