summaryrefslogtreecommitdiff
path: root/v4l/i2c-compat.h
diff options
context:
space:
mode:
authorGerd Knorr <devnull@localhost>2004-02-22 01:59:34 +0000
committerGerd Knorr <devnull@localhost>2004-02-22 01:59:34 +0000
commit229b130306c830b9f1c410ccd6060b65aa68dcec (patch)
tree0ad687a6c45ad1481a208419b017f2c7cf6c520c /v4l/i2c-compat.h
parent0f99a89ea0a04d80bd283fdfd2c8141a763e2de3 (diff)
downloadmediapointer-dvb-s2-229b130306c830b9f1c410ccd6060b65aa68dcec.tar.gz
mediapointer-dvb-s2-229b130306c830b9f1c410ccd6060b65aa68dcec.tar.bz2
Initial revision
Diffstat (limited to 'v4l/i2c-compat.h')
-rw-r--r--v4l/i2c-compat.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/v4l/i2c-compat.h b/v4l/i2c-compat.h
new file mode 100644
index 000000000..4e93d6ea0
--- /dev/null
+++ b/v4l/i2c-compat.h
@@ -0,0 +1,55 @@
+/*
+ * some i2c layer compatibility stuff -- to avoid cluttering up the
+ * i2c modules with tons of #ifdefs
+ */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,66)
+
+static inline void *i2c_get_adapdata(struct i2c_adapter *dev)
+{
+ return dev->data;
+}
+
+static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data)
+{
+ dev->data = data;
+}
+
+static inline void *i2c_get_clientdata(struct i2c_client *dev)
+{
+ return dev->data;
+}
+
+static inline void i2c_set_clientdata(struct i2c_client *dev, void *data)
+{
+ dev->data = data;
+}
+
+#define I2C_DEVNAME(str) .name = str
+
+static inline char *i2c_clientname(struct i2c_client *c)
+{
+ return c->name;
+}
+
+static inline void i2c_clients_command(struct i2c_adapter *adap,
+ unsigned int cmd, void *arg)
+{
+ int i;
+
+ for (i = 0; i < I2C_CLIENT_MAX; i++) {
+ if (NULL == adap->clients[i])
+ continue;
+ if (NULL == adap->clients[i]->driver->command)
+ continue;
+ adap->clients[i]->driver->command(adap->clients[i],cmd,arg);
+ }
+}
+
+#endif
+
+/*
+ * Local variables:
+ * c-basic-offset: 8
+ * End:
+ */