summaryrefslogtreecommitdiffstats
path: root/sys/dev/iicbus/iicbb.c
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2012-03-01 20:58:20 +0000
committerkan <kan@FreeBSD.org>2012-03-01 20:58:20 +0000
commitdaffabc4a9ca22a1776123d0189d7c25a9014a64 (patch)
treed28b86f4549f587ae378f809ce34435819852be2 /sys/dev/iicbus/iicbb.c
parent24261e9a52ac1b10b4e80d6d7ce81f171e7c0a0a (diff)
downloadFreeBSD-src-daffabc4a9ca22a1776123d0189d7c25a9014a64.zip
FreeBSD-src-daffabc4a9ca22a1776123d0189d7c25a9014a64.tar.gz
Provide pre/post transfer method callbacks for icbbb
clients. These are helful when making certain drivers work on both Linux and FreeBSD without changing the code flow too much. Reviewed by: kib, wlosh MFC after: 1 month
Diffstat (limited to 'sys/dev/iicbus/iicbb.c')
-rw-r--r--sys/dev/iicbus/iicbb.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/dev/iicbus/iicbb.c b/sys/dev/iicbus/iicbb.c
index a7eb2a0..44a069f 100644
--- a/sys/dev/iicbus/iicbb.c
+++ b/sys/dev/iicbus/iicbb.c
@@ -76,6 +76,7 @@ static int iicbb_stop(device_t);
static int iicbb_write(device_t, const char *, int, int *, int);
static int iicbb_read(device_t, char *, int, int *, int, int);
static int iicbb_reset(device_t, u_char, u_char, u_char *);
+static int iicbb_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs);
static device_method_t iicbb_methods[] = {
/* device interface */
@@ -95,7 +96,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),
+ DEVMETHOD(iicbus_transfer, iicbb_transfer),
{ 0, 0 }
};
@@ -424,6 +425,21 @@ iicbb_read(device_t dev, char * buf, int len, int *read, int last, int delay)
return (0);
}
+static int
+iicbb_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs)
+{
+ int error;
+
+ error = IICBB_PRE_XFER(device_get_parent(dev));
+ if (error)
+ return (error);
+
+ error = iicbus_transfer_gen(dev, msgs, nmsgs);
+
+ IICBB_POST_XFER(device_get_parent(dev));
+ return (error);
+}
+
DRIVER_MODULE(iicbus, iicbb, iicbus_driver, iicbus_devclass, 0, 0);
MODULE_DEPEND(iicbb, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER);
OpenPOWER on IntegriCloud