]> git.karo-electronics.de Git - karo-tx-linux.git/commit
viafb: fix i2c_transfer error handling
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>
Fri, 17 Sep 2010 01:16:25 +0000 (01:16 +0000)
committerAndi Kleen <ak@linux.intel.com>
Tue, 14 Dec 2010 22:40:02 +0000 (23:40 +0100)
commita7d67728b4fc6d51d3f3127bc0490cdb5688e2ab
treed2ce8df97f9139ea63d1df4b171ad9a48aea2934
parent93782b496da0239a3decc2d9860a6147598d703e
viafb: fix i2c_transfer error handling

commit 85c5702ac046b14713f776d59768252d8ed8018f upstream.

i2c_transfer returns negative errno on error and number of messages
processed on success. Just returning this value would give a poor
interface as it is not obvious that you must compare with 2 after reading
1 or n bytes and with 1 after writing 1 byte to determine if it was
successful. To avoid this error prone interface convert the error code
of a successful read/write to zero and all other non-negative values to
an negative error code.
This fixes a regression introduced by
via: Rationalize vt1636 detection
which resulted in no longer detecting a VT1636 chip and therefore has
broken the output in configurations which contain this chip.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Cc: Joseph Chan <JosephChan@via.com.tw>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
drivers/video/via/via_i2c.c