aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2006-01-09 12:32:40 -0500
committerMauro Carvalho Chehab <mchehab@brturbo.com.br>2006-01-09 12:32:40 -0500
commit7e8b09ea1636e360a8fabebeaeb91c17f64e01b5 (patch)
treeac850285b7fe128cc3a2a821a8b73bdf550a7f79 /include
parent53b0a1c60bcc167534b31f56adfbbe2919e6f80b (diff)
V4L/DVB (3276): Added new diagnositics macros, convert msp3400 to the new macros.
- Added new v4l_err, v4l_warn, v4l_info and v4l_dbg macros to v4l2-common.h for use in v4l-dvb i2c drivers. This ensures a unique prefix for each device instance. - At a later stage these macros may be reimplemented using the device-generic macros from device.h. - Converted the msp3400 driver to the new macros. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Diffstat (limited to 'include')
-rw-r--r--include/media/v4l2-common.h63
1 files changed, 51 insertions, 12 deletions
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 9ee616261d66..c5ca993679ec 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -26,6 +26,57 @@
26#ifndef V4L2_COMMON_H_ 26#ifndef V4L2_COMMON_H_
27#define V4L2_COMMON_H_ 27#define V4L2_COMMON_H_
28 28
29/* v4l debugging and diagnostics */
30
31/* Common printk constucts for v4l-i2c drivers. These macros create a unique
32 prefix consisting of the driver name, the adapter number and the i2c
33 address. */
34#define v4l_printk(level, name, adapter, addr, fmt, arg...) \
35 printk(level "%s %d-%04x: " fmt, name, i2c_adapter_id(adapter), addr , ## arg)
36
37#define v4l_client_printk(level, client, fmt, arg...) \
38 v4l_printk(level, (client)->driver->driver.name, (client)->adapter, \
39 (client)->addr, fmt , ## arg)
40
41#define v4l_err(client, fmt, arg...) \
42 v4l_client_printk(KERN_ERR, client, fmt , ## arg)
43
44#define v4l_warn(client, fmt, arg...) \
45 v4l_client_printk(KERN_WARNING, client, fmt , ## arg)
46
47#define v4l_info(client, fmt, arg...) \
48 v4l_client_printk(KERN_INFO, client, fmt , ## arg)
49
50/* These three macros assume that the debug level is set with a module
51 parameter called 'debug'. */
52#define v4l_dbg(level, client, fmt, arg...) \
53 do { \
54 if (debug >= (level)) \
55 v4l_client_printk(KERN_DEBUG, client, fmt , ## arg); \
56 } while (0)
57
58/* Prints the ioctl in a human-readable format */
59extern void v4l_printk_ioctl(unsigned int cmd);
60
61/* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */
62#define v4l_print_ioctl(name, cmd) \
63 do { \
64 printk(KERN_DEBUG "%s: ", name); \
65 v4l_printk_ioctl(cmd); \
66 } while (0)
67
68/* Use this macro in I2C drivers where 'client' is the struct i2c_client
69 pointer */
70#define v4l_i2c_print_ioctl(client, cmd) \
71 do { \
72 v4l_client_printk(KERN_DEBUG, client, ""); \
73 v4l_printk_ioctl(cmd); \
74 } while (0)
75
76/* ------------------------------------------------------------------------- */
77
78/* Internal ioctls */
79
29/* VIDIOC_INT_G_REGISTER and VIDIOC_INT_S_REGISTER */ 80/* VIDIOC_INT_G_REGISTER and VIDIOC_INT_S_REGISTER */
30struct v4l2_register { 81struct v4l2_register {
31 u32 i2c_id; /* I2C driver ID of the I2C chip. 0 for the I2C adapter. */ 82 u32 i2c_id; /* I2C driver ID of the I2C chip. 0 for the I2C adapter. */
@@ -122,16 +173,4 @@ enum v4l2_chip_ident {
122 If the frequency is not supported, then -EINVAL is returned. */ 173 If the frequency is not supported, then -EINVAL is returned. */
123#define VIDIOC_INT_I2S_CLOCK_FREQ _IOW ('d', 108, u32) 174#define VIDIOC_INT_I2S_CLOCK_FREQ _IOW ('d', 108, u32)
124 175
125/* Prints used ioctl */
126extern void v4l_printk_ioctl(unsigned int cmd);
127
128#define v4l_print_ioctl(name,cmd) do {\
129 printk(KERN_DEBUG "%s: ", name); \
130 v4l_printk_ioctl(cmd); } while (0)
131
132#define v4l_i2c_print_ioctl(client,cmd) do {\
133 printk(KERN_DEBUG "%s %d-%04x: ", (client)->driver->name, \
134 i2c_adapter_id((client)->adapter),(client)->addr); \
135 v4l_printk_ioctl(cmd); } while (0)
136
137#endif /* V4L2_COMMON_H_ */ 176#endif /* V4L2_COMMON_H_ */