Index: sys/dev/iicbus/iic.c =================================================================== --- sys/dev/iicbus/iic.c +++ sys/dev/iicbus/iic.c @@ -265,7 +265,7 @@ (ioflag & O_NONBLOCK) ? IIC_DONTWAIT : (IIC_WAIT | IIC_INTR)); if (error != 0) { IIC_UNLOCK(priv); - return (error); + return (iic2errno(error)); } if (uio->uio_rw == UIO_READ) @@ -278,7 +278,7 @@ { iicbus_release_bus(parent, priv->sc->sc_dev); IIC_UNLOCK(priv); - return (error); + return (iic2errno(error)); } error = iicuio_move(priv, uio, IIC_LAST_READ); @@ -286,7 +286,7 @@ iicbus_stop(parent); iicbus_release_bus(parent, priv->sc->sc_dev); IIC_UNLOCK(priv); - return (error); + return (iic2errno(error)); } static int @@ -303,7 +303,7 @@ error = 0; if (d->nmsgs > IIC_RDRW_MAX_MSGS) - return (EINVAL); + return (errno2iic(EINVAL)); buf = malloc(sizeof(*d->msgs) * d->nmsgs, M_IIC, M_WAITOK); @@ -381,7 +381,7 @@ switch (cmd) { case I2CSTART: if (priv->started) { - error = EINVAL; + error = errno2iic(EINVAL); break; } error = iicbus_request_bus(parent, iicdev, @@ -433,7 +433,7 @@ case I2CWRITE: if (!priv->started) { - error = EINVAL; + error = errno2iic(EINVAL); break; } uvec.iov_base = s->buf; @@ -450,7 +450,7 @@ case I2CREAD: if (!priv->started) { - error = EINVAL; + error = errno2iic(EINVAL); break; } uvec.iov_base = s->buf; @@ -471,7 +471,7 @@ * transactions. Fail if another transaction is in progress. */ if (priv->started) { - error = EINVAL; + error = errno2iic(EINVAL); break; } @@ -481,7 +481,7 @@ case I2CRPTSTART: if (!priv->started) { - error = EINVAL; + error = errno2iic(EINVAL); break; } error = iicbus_repeated_start(parent, s->slave, 0); @@ -492,11 +492,11 @@ break; default: - error = ENOTTY; + error = errno2iic(ENOTTY); } IIC_UNLOCK(priv); - return (error); + return (iic2errno(error)); } DRIVER_MODULE(iic, iicbus, iic_driver, iic_devclass, 0, 0);