ext3: Update MAINTAINERS for ext3 and JBD
[linux/fpc-iii.git] / drivers / media / dvb / dvb-core / dvbdev.h
blob895e2efca8a974a3c2996b51b5b86ef8a644b76a
1 /*
2 * dvbdev.h
4 * Copyright (C) 2000 Ralph Metzler & Marcus Metzler
5 * for convergence integrated media GmbH
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Lesser Public License
9 * as published by the Free Software Foundation; either version 2.1
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 #ifndef _DVBDEV_H_
24 #define _DVBDEV_H_
26 #include <linux/types.h>
27 #include <linux/poll.h>
28 #include <linux/fs.h>
29 #include <linux/list.h>
31 #define DVB_MAJOR 212
33 #if defined(CONFIG_DVB_MAX_ADAPTERS) && CONFIG_DVB_MAX_ADAPTERS > 0
34 #define DVB_MAX_ADAPTERS CONFIG_DVB_MAX_ADAPTERS
35 #else
36 #warning invalid CONFIG_DVB_MAX_ADAPTERS value
37 #define DVB_MAX_ADAPTERS 8
38 #endif
40 #define DVB_UNSET (-1)
42 #define DVB_DEVICE_VIDEO 0
43 #define DVB_DEVICE_AUDIO 1
44 #define DVB_DEVICE_SEC 2
45 #define DVB_DEVICE_FRONTEND 3
46 #define DVB_DEVICE_DEMUX 4
47 #define DVB_DEVICE_DVR 5
48 #define DVB_DEVICE_CA 6
49 #define DVB_DEVICE_NET 7
50 #define DVB_DEVICE_OSD 8
52 #define DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr) \
53 static short adapter_nr[] = \
54 {[0 ... (DVB_MAX_ADAPTERS - 1)] = DVB_UNSET }; \
55 module_param_array(adapter_nr, short, NULL, 0444); \
56 MODULE_PARM_DESC(adapter_nr, "DVB adapter numbers")
58 struct dvb_adapter {
59 int num;
60 struct list_head list_head;
61 struct list_head device_list;
62 const char *name;
63 u8 proposed_mac [6];
64 void* priv;
66 struct device *device;
68 struct module *module;
70 int mfe_shared; /* indicates mutually exclusive frontends */
71 struct dvb_device *mfe_dvbdev; /* frontend device in use */
72 struct mutex mfe_lock; /* access lock for thread creation */
76 struct dvb_device {
77 struct list_head list_head;
78 const struct file_operations *fops;
79 struct dvb_adapter *adapter;
80 int type;
81 int minor;
82 u32 id;
84 /* in theory, 'users' can vanish now,
85 but I don't want to change too much now... */
86 int readers;
87 int writers;
88 int users;
90 wait_queue_head_t wait_queue;
91 /* don't really need those !? -- FIXME: use video_usercopy */
92 int (*kernel_ioctl)(struct inode *inode, struct file *file,
93 unsigned int cmd, void *arg);
95 void *priv;
99 extern int dvb_register_adapter(struct dvb_adapter *adap, const char *name,
100 struct module *module, struct device *device,
101 short *adapter_nums);
102 extern int dvb_unregister_adapter (struct dvb_adapter *adap);
104 extern int dvb_register_device (struct dvb_adapter *adap,
105 struct dvb_device **pdvbdev,
106 const struct dvb_device *template,
107 void *priv,
108 int type);
110 extern void dvb_unregister_device (struct dvb_device *dvbdev);
112 extern int dvb_generic_open (struct inode *inode, struct file *file);
113 extern int dvb_generic_release (struct inode *inode, struct file *file);
114 extern int dvb_generic_ioctl (struct inode *inode, struct file *file,
115 unsigned int cmd, unsigned long arg);
117 /* we don't mess with video_usercopy() any more,
118 we simply define out own dvb_usercopy(), which will hopefully become
119 generic_usercopy() someday... */
121 extern int dvb_usercopy(struct inode *inode, struct file *file,
122 unsigned int cmd, unsigned long arg,
123 int (*func)(struct inode *inode, struct file *file,
124 unsigned int cmd, void *arg));
126 /** generic DVB attach function. */
127 #ifdef CONFIG_MEDIA_ATTACH
128 #define dvb_attach(FUNCTION, ARGS...) ({ \
129 void *__r = NULL; \
130 typeof(&FUNCTION) __a = symbol_request(FUNCTION); \
131 if (__a) { \
132 __r = (void *) __a(ARGS); \
133 if (__r == NULL) \
134 symbol_put(FUNCTION); \
135 } else { \
136 printk(KERN_ERR "DVB: Unable to find symbol "#FUNCTION"()\n"); \
138 __r; \
141 #else
142 #define dvb_attach(FUNCTION, ARGS...) ({ \
143 FUNCTION(ARGS); \
146 #endif
148 #endif /* #ifndef _DVBDEV_H_ */