[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170701004731.e55fbqh76bkmy7hr@earth>
Date: Sat, 1 Jul 2017 02:47:32 +0200
From: Sebastian Reichel <sre@...nel.org>
To: Benjamin Tissoires <benjamin.tissoires@...hat.com>,
Julia Lawall <julia.lawall@...6.fr>
Cc: Bastien Nocera <hadess@...ess.net>,
Stephen Just <stephenjust@...il.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
Len Brown <lenb@...nel.org>,
Robert Moore <robert.moore@...el.com>,
Lv Zheng <lv.zheng@...el.com>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Andy Shevchenko <andy.shevchenko@...il.com>,
linux-acpi@...r.kernel.org, devel@...ica.org,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng implementation
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
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists