i2c: core: ACPI: Make acpi_gsb_i2c_read_bytes() check i2c_transfer return value
authorHans de Goede <hdegoede@redhat.com>
Sun, 12 Aug 2018 10:53:21 +0000 (12:53 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Mon, 20 Aug 2018 12:09:26 +0000 (14:09 +0200)
commit0a30446c0dca3483c384b54a431cc951e15f7e79
tree712f90e320ee992bdc8d8f2a736958c6a7caa3d4
parentc463a158cb6c5d9a85b7d894cd4f8116e8bd6be0
i2c: core: ACPI: Make acpi_gsb_i2c_read_bytes() check i2c_transfer return value

Currently acpi_gsb_i2c_read_bytes() directly returns i2c_transfer's return
value. i2c_transfer returns a value < 0 on error and 2 (for 2 successfully
executed transfers) on success. But the ACPI code expects 0 on success, so
currently acpi_gsb_i2c_read_bytes()'s caller does:

        if (status > 0)
                status = 0;

This commit makes acpi_gsb_i2c_read_bytes() return a value which can be
directly consumed by the ACPI code, mirroring acpi_gsb_i2c_write_bytes(),
this commit also makes acpi_gsb_i2c_read_bytes() explitcly check that
i2c_transfer returns 2, rather then accepting any value > 0.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/i2c-core-acpi.c