if (ret == 0x80 + len - 1)
return len;
if (ret == 0x94 + len - 1) {
- return -ENODEV;
+ return -ENXIO;
}
if (ret < 0) {
em28xx_warn("failed to get i2c transfer status from bridge register (error=%i)\n",
msleep(5);
}
em28xx_warn("write to i2c device at 0x%x timed out\n", addr);
- return -EIO;
+ return -ETIMEDOUT;
}
/*
if (ret == 0x84 + len - 1)
break;
if (ret == 0x94 + len - 1) {
- return -ENODEV;
+ return -ENXIO;
}
if (ret < 0) {
em28xx_warn("failed to get i2c transfer status from bridge register (error=%i)\n",
if (ret == 0) /* success */
return len;
if (ret == 0x10) {
- return -ENODEV;
+ return -ENXIO;
}
if (ret < 0) {
em28xx_warn("failed to get i2c transfer status from bridge register (error=%i)\n",
* (even with high payload) ...
*/
}
-
- em28xx_warn("write to i2c device at 0x%x timed out\n", addr);
- return -EIO;
+ em28xx_warn("write to i2c device at 0x%x timed out (status=%i)\n", addr, ret);
+ return -ETIMEDOUT;
}
/*
* bytes if we are on bus B AND there was no write attempt to the
* specified slave address before AND no device is present at the
* requested slave address.
- * Anyway, the next check will fail with -ENODEV in this case, so avoid
+ * Anyway, the next check will fail with -ENXIO in this case, so avoid
* spamming the system log on device probing and do nothing here.
*/
return ret;
}
if (ret == 0x10)
- return -ENODEV;
+ return -ENXIO;
em28xx_warn("unknown i2c error (status=%i)\n", ret);
- return -EIO;
+ return -ETIMEDOUT;
}
/*
if (!ret)
return len;
else if (ret > 0)
- return -ENODEV;
+ return -ENXIO;
return ret;
/*
* bytes if we are on bus B AND there was no write attempt to the
* specified slave address before AND no device is present at the
* requested slave address.
- * Anyway, the next check will fail with -ENODEV in this case, so avoid
+ * Anyway, the next check will fail with -ENXIO in this case, so avoid
* spamming the system log on device probing and do nothing here.
*/
if (!ret)
return len;
else if (ret > 0)
- return -ENODEV;
+ return -ENXIO;
return ret;
/*
rc = em2800_i2c_check_for_device(dev, addr);
else if (i2c_bus->algo_type == EM28XX_I2C_ALGO_EM25XX_BUS_B)
rc = em25xx_bus_B_check_for_device(dev, addr);
- if (rc == -ENODEV) {
+ if (rc == -ENXIO) {
if (i2c_debug)
printk(" no device\n");
}
(msgs[i].flags & I2C_M_RD) ? "read" : "write",
i == num - 1 ? "stop" : "nonstop",
addr, msgs[i].len);
- if (!msgs[i].len) { /* no len: check only for device presence */
+ if (!msgs[i].len) {
+ /*
+ * no len: check only for device presence
+ * This code is only called during device probe.
+ */
rc = i2c_check_for_device(i2c_bus, addr);
- if (rc == -ENODEV) {
+ if (rc == -ENXIO) {
rt_mutex_unlock(&dev->i2c_bus_lock);
- return rc;
+ return -ENODEV;
}
} else if (msgs[i].flags & I2C_M_RD) {
/* read bytes */