]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/tuner-i2c.h
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394...
[linux-2.6-omap-h63xx.git] / drivers / media / video / tuner-i2c.h
index 159019ec337391365d69c4fc4bc3a8578aee24e4..de52e8ffd347df1dcd2060c2e6c406b0a58933c2 100644 (file)
@@ -46,25 +46,42 @@ static inline int tuner_i2c_xfer_recv(struct tuner_i2c_props *props, char *buf,
        return (ret == 1) ? len : ret;
 }
 
-#ifndef __TUNER_DRIVER_H__
-#define tuner_warn(fmt, arg...) do {\
-       printk(KERN_WARNING PREFIX "%d-%04x: " fmt, \
-                       i2c_adapter_id(priv->i2c_props.adap), priv->i2c_props.addr , ##arg); } while (0)
-#define tuner_info(fmt, arg...) do {\
-       printk(KERN_INFO PREFIX "%d-%04x: " fmt, \
-                       i2c_adapter_id(priv->i2c_props.adap), priv->i2c_props.addr , ##arg); } while (0)
-#define tuner_dbg(fmt, arg...) do {\
-       if ((debug)) \
-               printk(KERN_DEBUG PREFIX "%d-%04x: " fmt, \
-                       i2c_adapter_id(priv->i2c_props.adap), priv->i2c_props.addr , ##arg); } while (0)
-#endif /* __TUNER_DRIVER_H__ */
+static inline int tuner_i2c_xfer_send_recv(struct tuner_i2c_props *props,
+                                          char *obuf, int olen,
+                                          char *ibuf, int ilen)
+{
+       struct i2c_msg msg[2] = { { .addr = props->addr, .flags = 0,
+                                   .buf = obuf, .len = olen },
+                                 { .addr = props->addr, .flags = I2C_M_RD,
+                                   .buf = ibuf, .len = ilen } };
+       int ret = i2c_transfer(props->adap, msg, 2);
 
-#endif /* __TUNER_I2C_H__ */
+       return (ret == 2) ? ilen : ret;
+}
 
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-basic-offset: 8
- * End:
- */
+#define tuner_warn(fmt, arg...) do {                                   \
+       printk(KERN_WARNING "%s %d-%04x: " fmt, PREFIX,                 \
+                       i2c_adapter_id(priv->i2c_props.adap),           \
+                       priv->i2c_props.addr, ##arg);                   \
+        } while (0)
+
+#define tuner_info(fmt, arg...) do {                                   \
+       printk(KERN_INFO "%s %d-%04x: " fmt, PREFIX,                    \
+                       i2c_adapter_id(priv->i2c_props.adap),           \
+                       priv->i2c_props.addr , ##arg);                  \
+       } while (0)
+
+#define tuner_err(fmt, arg...) do {                                    \
+       printk(KERN_ERR "%s %d-%04x: " fmt, PREFIX,                     \
+                       i2c_adapter_id(priv->i2c_props.adap),           \
+                       priv->i2c_props.addr , ##arg);                  \
+       } while (0)
+
+#define tuner_dbg(fmt, arg...) do {                                    \
+       if ((debug))                                                    \
+               printk(KERN_DEBUG "%s %d-%04x: " fmt, PREFIX,           \
+                       i2c_adapter_id(priv->i2c_props.adap),           \
+                       priv->i2c_props.addr , ##arg);                  \
+       } while (0)
+
+#endif /* __TUNER_I2C_H__ */