Linux Power Management development
 help / color / mirror / Atom feed
From: Sebastian Reichel <sre@kernel.org>
To: Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	Julia Lawall <julia.lawall@lip6.fr>
Cc: Bastien Nocera <hadess@hadess.net>,
	Stephen Just <stephenjust@gmail.com>,
	"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	Len Brown <lenb@kernel.org>,
	Robert Moore <robert.moore@intel.com>,
	Lv Zheng <lv.zheng@intel.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	linux-acpi@vger.kernel.org, devel@acpica.org,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng implementation
Date: Sat, 1 Jul 2017 02:47:32 +0200	[thread overview]
Message-ID: <20170701004731.e55fbqh76bkmy7hr@earth> (raw)
In-Reply-To: <20170629121009.30234-1-benjamin.tissoires@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 703 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2017-07-01  0:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-29 12:10 [PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng implementation Benjamin Tissoires
2017-06-29 14:22 ` Andy Shevchenko
2017-06-29 20:22   ` Rafael J. Wysocki
2017-06-30 15:24     ` Benjamin Tissoires
2017-06-30 15:42       ` Hans de Goede
2017-06-30 12:49   ` Hans de Goede
2017-06-30 15:26     ` Benjamin Tissoires
2017-06-30 15:43       ` Hans de Goede
2017-06-30 15:57   ` Benjamin Tissoires
2017-06-30 16:37     ` Andy Shevchenko
2017-06-30 17:37       ` Hans de Goede
2017-06-30 17:40         ` Andy Shevchenko
2017-06-30 17:42           ` Hans de Goede
2017-06-30 17:55             ` Andy Shevchenko
2017-06-30 17:58               ` Andy Shevchenko
2018-08-31 14:54       ` Benjamin Tissoires
2018-09-06 14:43         ` Moore, Robert
2017-07-01  0:47 ` Sebastian Reichel [this message]
2017-07-01 19:53   ` Julia Lawall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170701004731.e55fbqh76bkmy7hr@earth \
    --to=sre@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=devel@acpica.org \
    --cc=hadess@hadess.net \
    --cc=julia.lawall@lip6.fr \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lv.zheng@intel.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=robert.moore@intel.com \
    --cc=stephenjust@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox