summaryrefslogtreecommitdiffstats
path: root/sys/dev/iicbus/iicbb_if.m
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_if.m
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_if.m')
-rw-r--r--sys/dev/iicbus/iicbb_if.m39
1 files changed, 38 insertions, 1 deletions
diff --git a/sys/dev/iicbus/iicbb_if.m b/sys/dev/iicbus/iicbb_if.m
index 7d10fe7..5b4ffec 100644
--- a/sys/dev/iicbus/iicbb_if.m
+++ b/sys/dev/iicbus/iicbb_if.m
@@ -31,13 +31,50 @@
INTERFACE iicbb;
#
+# Default implementation of optional methods
+#
+CODE {
+ static int
+ null_pre_xfer(device_t dev)
+ {
+ return 0;
+ }
+
+ static void
+ null_post_xfer(device_t dev)
+
+ {
+ }
+
+ static int
+ null_callback(device_t dev, int index, caddr_t data)
+ {
+ return 0;
+ }
+};
+
+#
# iicbus callback
#
METHOD int callback {
device_t dev;
int index;
caddr_t data;
-};
+} DEFAULT null_callback;
+
+#
+# Prepare device for I2C transfer
+#
+METHOD int pre_xfer {
+ device_t dev;
+} DEFAULT null_pre_xfer;
+
+#
+# Cleanup device after I2C transfer
+#
+METHOD void post_xfer {
+ device_t dev;
+} DEFAULT null_post_xfer;
#
# Set I2C bus data line
OpenPOWER on IntegriCloud