diff options
| author | Warner Losh <imp@FreeBSD.org> | 2007-03-23 23:03:54 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2007-03-23 23:03:54 +0000 |
| commit | 99a1402117d8bf0b368b7ee64e894b50a78fca45 (patch) | |
| tree | 9f58af15d6d4c3e1aeefbdf50d1510d2633af4f4 /sys/dev | |
| parent | ee952d0ef6d9b492f3694741208bfd1ea09e73a2 (diff) | |
Notes
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/iicbus/iicbb.c | 2 | ||||
| -rw-r--r-- | sys/dev/iicbus/iiconf.c | 14 |
2 files changed, 11 insertions, 5 deletions
diff --git a/sys/dev/iicbus/iicbb.c b/sys/dev/iicbus/iicbb.c index 7fa80c1825002..ac10ceed28651 100644 --- a/sys/dev/iicbus/iicbb.c +++ b/sys/dev/iicbus/iicbb.c @@ -94,6 +94,7 @@ static device_method_t iicbb_methods[] = { DEVMETHOD(iicbus_write, iicbb_write), DEVMETHOD(iicbus_read, iicbb_read), DEVMETHOD(iicbus_reset, iicbb_reset), + DEVMETHOD(iicbus_transfer, iicbus_transfer_gen), { 0, 0 } }; @@ -421,6 +422,7 @@ DRIVER_MODULE(iicbb, ixpiic, iicbb_driver, iicbb_devclass, 0, 0); DRIVER_MODULE(iicbb, lpbb, iicbb_driver, iicbb_devclass, 0, 0); DRIVER_MODULE(iicbb, viapm, iicbb_driver, iicbb_devclass, 0, 0); DRIVER_MODULE(iicbb, cxm_iic, iicbb_driver, iicbb_devclass, 0, 0); +DRIVER_MODULE(iicbb, at91_bbiic, iicbb_driver, iicbb_devclass, 0, 0); MODULE_DEPEND(iicbb, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); MODULE_VERSION(iicbb, IICBB_MODVER); diff --git a/sys/dev/iicbus/iiconf.c b/sys/dev/iicbus/iiconf.c index c9124af69e956..7401820bdfa39 100644 --- a/sys/dev/iicbus/iiconf.c +++ b/sys/dev/iicbus/iiconf.c @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> +#include <sys/malloc.h> #include <sys/module.h> #include <sys/bus.h> @@ -356,13 +357,16 @@ iicbus_transfer(device_t bus, struct iic_msg *msgs, uint32_t nmsgs) * buffer addresses. */ int -iicbus_transfer_gen(device_t bus, struct iic_msg *msgs, uint32_t nmsgs) +iicbus_transfer_gen(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) { - int i, error, max, lenread, lenwrote; + int i, error, lenread, lenwrote, nkid; + device_t *children, bus; - for (i = 0, max = 0; i < nmsgs; i++) - if (max < msgs[i].len) - max = msgs[i].len; + device_get_children(dev, &children, &nkid); + if (nkid != 1) + return EIO; + bus = children[0]; + free(children, M_TEMP); for (i = 0, error = 0; i < nmsgs && error == 0; i++) { if (msgs[i].flags & IIC_M_RD) error = iicbus_block_read(bus, msgs[i].slave, |
