aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/iicbus/iiconf.c
diff options
context:
space:
mode:
authorIan Lepore <ian@FreeBSD.org>2015-10-09 23:20:08 +0000
committerIan Lepore <ian@FreeBSD.org>2015-10-09 23:20:08 +0000
commitdf38292a856c1f28f8349024578bce5c5144cedf (patch)
treeeae79388afe6e0f6155788dceed826036b464d7a /sys/dev/iicbus/iiconf.c
parent4b3d93d38a7cde9e7119bd40bc94775de8e4ab8a (diff)
Notes
Diffstat (limited to 'sys/dev/iicbus/iiconf.c')
-rw-r--r--sys/dev/iicbus/iiconf.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/dev/iicbus/iiconf.c b/sys/dev/iicbus/iiconf.c
index 37de02052391..987bbb67441e 100644
--- a/sys/dev/iicbus/iiconf.c
+++ b/sys/dev/iicbus/iiconf.c
@@ -40,6 +40,28 @@ __FBSDID("$FreeBSD$");
#include "iicbus_if.h"
/*
+ * Translate IIC_Exxxxx status values to vaguely-equivelent errno values.
+ */
+int
+iic2errno(int iic_status)
+{
+ switch (iic_status) {
+ case IIC_NOERR: return (0);
+ case IIC_EBUSERR: return (EALREADY);
+ case IIC_ENOACK: return (EIO);
+ case IIC_ETIMEOUT: return (ETIMEDOUT);
+ case IIC_EBUSBSY: return (EWOULDBLOCK);
+ case IIC_ESTATUS: return (EPROTO);
+ case IIC_EUNDERFLOW: return (EIO);
+ case IIC_EOVERFLOW: return (EOVERFLOW);
+ case IIC_ENOTSUPP: return (EOPNOTSUPP);
+ case IIC_ENOADDR: return (EADDRNOTAVAIL);
+ case IIC_ERESOURCE: return (ENOMEM);
+ default: return (EIO);
+ }
+}
+
+/*
* iicbus_intr()
*/
void