Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/i2c iic_ioctl_exec: if the i2c controller's "exec" f...



details:   https://anonhg.NetBSD.org/src/rev/2d339e8bd40e
branches:  trunk
changeset: 770111:2d339e8bd40e
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Oct 03 23:53:04 2011 +0000

description:
iic_ioctl_exec: if the i2c controller's "exec" function uses -1 instead of
an error code to report failure, convert it to EIO.

diffstat:

 sys/dev/i2c/i2c.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r 20f5ae6defdd -r 2d339e8bd40e sys/dev/i2c/i2c.c
--- a/sys/dev/i2c/i2c.c Mon Oct 03 23:39:05 2011 +0000
+++ b/sys/dev/i2c/i2c.c Mon Oct 03 23:53:04 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i2c.c,v 1.35 2011/10/03 22:27:23 jmcneill Exp $        */
+/*     $NetBSD: i2c.c,v 1.36 2011/10/03 23:53:04 jmcneill Exp $        */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.35 2011/10/03 22:27:23 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.36 2011/10/03 23:53:04 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -508,6 +508,12 @@
            buf, iie->iie_buflen, 0);
        iic_release_bus(ic, 0);
 
+       /*
+        * Some drivers return error codes on failure, and others return -1.
+        */
+       if (error < 0)
+               error = EIO;
+
        if (cmd)
                kmem_free(cmd, iie->iie_cmdlen);
 



Home | Main Index | Thread Index | Old Index