upstream: [media] em28xx-i2c: Fix error code for I2C error transfers
authorMauro Carvalho Chehab <m.chehab@samsung.com>
Sat, 4 Jan 2014 08:42:11 +0000 (05:42 -0300)
committerChanho Park <chanho61.park@samsung.com>
Tue, 18 Nov 2014 02:54:26 +0000 (11:54 +0900)
commitb329e154ec7bea088b0d5cb6b2f968c4f1dadf01
tree6405d6515c0f79ca43ea32c223817e8ee6592251
parent09e4a3bbdac45a97f7f496a8f6b436bd8e82d6cf
upstream: [media] em28xx-i2c: Fix error code for I2C error transfers

Follow the error codes for I2C as described at Documentation/i2c/fault-codes.

In the case of the I2C status register (0x05), this is mapped into:

- ENXIO - when reg 05 returns 0x10
- ETIMEDOUT - when the device is not temporarily not responding
      (e. g. reg 05 returning something not 0x10 or 0x00)
- EIO - for generic I/O errors that don't fit into the above.

In the specific case of 0-byte reads, used only during I2C device
probing, it keeps returning -ENODEV.

TODO: return EBUSY when reg 05 returns 0x20 on em2874 and upper.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/usb/em28xx/em28xx-i2c.c