> + switch (dev->state) { > + case SC18IS600_STAT_OK: > + break; > + case SC18IS600_STAT_NAK_ADDR: > + return -EIO; > + case SC18IS600_STAT_NAK_DATA: > + return -EREMOTEIO; > + case SC18IS600_STAT_SIZE: > + return -EINVAL; > + case SC18IS600_STAT_TIMEOUT: > + return -ETIMEDOUT; > + case SC18IS600_STAT_TIMEOUT2: > + return -ETIMEDOUT; > + case SC18IS600_STAT_BLOCKED: > + return -ETIMEDOUT; > + default: > + case SC18IS600_STAT_BUSY: > + dev_err(&dev->spi->dev, "device hangup detected, reset!"); > + sc18is600_reset(dev); > + return -EAGAIN; > + } Please have a look at Documentation/i2c/fault-codes. Most look good, but the NAK cases probably need fixing.
Attachment:
signature.asc
Description: PGP signature