diff --git a/sys/dev/i2c/cx24227.c b/sys/dev/i2c/cx24227.c index 74e752cdc737..dffaa60cae5c 100644 --- a/sys/dev/i2c/cx24227.c +++ b/sys/dev/i2c/cx24227.c @@ -1,4 +1,4 @@ -/* $NetBSD: cx24227.c,v 1.5 2011/10/02 19:03:56 jmcneill Exp $ */ +/* $NetBSD: cx24227.c,v 1.6 2012/03/15 16:20:36 bouyer Exp $ */ /* * Copyright (c) 2008, 2011 Jonathan A. Kollasch @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cx24227.c,v 1.5 2011/10/02 19:03:56 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cx24227.c,v 1.6 2012/03/15 16:20:36 bouyer Exp $"); #include #include @@ -128,11 +128,11 @@ cx24227_readreg(struct cx24227 *sc, uint8_t reg, uint16_t *data) int error; uint8_t r[2]; + *data = 0x0000; + if (iic_acquire_bus(sc->tag, I2C_F_POLL) != 0) return -1; - *data = 0x0000; - error = iic_exec(sc->tag, I2C_OP_READ_WITH_STOP, sc->addr, ®, 1, r, 2, I2C_F_POLL);