Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1679225

Re: [PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng implementation

From Sebastian Reichel <sre@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng implementation
Date 2017-07-01 02:50 +0200
Message-ID <tYeLL-47C-1@gated-at.bofh.it> (permalink)
References <tXGAp-7t8-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng implementation Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2017-06-29 14:20 +0200
  Re: [PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng implementation Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-29 16:30 +0200
    Re: [PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng implementation "Rafael J. Wysocki" <rafael@kernel.org> - 2017-06-29 22:30 +0200
      Re: [PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng implementation Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2017-06-30 17:30 +0200
        Re: [PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng implementation Hans de Goede <hdegoede@redhat.com> - 2017-06-30 17:50 +0200
    Re: [PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng implementation Hans de Goede <hdegoede@redhat.com> - 2017-06-30 15:00 +0200
      Re: [PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng implementation Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2017-06-30 17:30 +0200
        Re: [PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng implementation Hans de Goede <hdegoede@redhat.com> - 2017-06-30 17:50 +0200
    Re: [PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng implementation Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2017-06-30 18:00 +0200
      Re: [PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng implementation Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-30 18:40 +0200
        Re: [PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng implementation Hans de Goede <hdegoede@redhat.com> - 2017-06-30 19:40 +0200
          Re: [PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng implementation Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-30 19:50 +0200
            Re: [PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng implementation Hans de Goede <hdegoede@redhat.com> - 2017-06-30 19:50 +0200
              Re: [PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng implementation Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-30 20:00 +0200
                Re: [PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng implementation Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-30 20:00 +0200
  Re: [PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng implementation Sebastian Reichel <sre@kernel.org> - 2017-07-01 02:50 +0200
    Re: [PATCH v2] ACPI: surface3_power: MSHW0011 rev-eng  implementation Julia Lawall <julia.lawall@lip6.fr> - 2017-07-01 22:00 +0200

csiph-web