x86/amd-iommu: Add function to complete a tlb flush
[linux/fpc-iii.git] / drivers / media / dvb / dvb-core / dvbdev.h
blob01fc704847434fb1faa08e61c09053e053ecaff3
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 #define DVB_MAX_ADAPTERS 8
37 #endif
39 #define DVB_UNSET (-1)
41 #define DVB_DEVICE_VIDEO 0
42 #define DVB_DEVICE_AUDIO 1
43 #define DVB_DEVICE_SEC 2
44 #define DVB_DEVICE_FRONTEND 3
45 #define DVB_DEVICE_DEMUX 4
46 #define DVB_DEVICE_DVR 5
47 #define DVB_DEVICE_CA 6
48 #define DVB_DEVICE_NET 7
49 #define DVB_DEVICE_OSD 8
51 #define DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr) \
52 static short adapter_nr[] = \
53 {[0 ... (DVB_MAX_ADAPTERS - 1)] = DVB_UNSET }; \
54 module_param_array(adapter_nr, short, NULL, 0444); \
55 MODULE_PARM_DESC(adapter_nr, "DVB adapter numbers")
57 struct dvb_adapter {
58 int num;
59 struct list_head list_head;
60 struct list_head device_list;
61 const char *name;
62 u8 proposed_mac [6];
63 void* priv;
65 struct device *device;
67 struct module *module;
69 int mfe_shared; /* indicates mutually exclusive frontends */
70 struct dvb_device *mfe_dvbdev; /* frontend device in use */
71 struct mutex mfe_lock; /* access lock for thread creation */
75 struct dvb_device {
76 struct list_head list_head;
77 const struct file_operations *fops;
78 struct dvb_adapter *adapter;
79 int type;
80 int minor;
81 u32 id;
83 /* in theory, 'users' can vanish now,
84 but I don't want to change too much now... */
85 int readers;
86 int writers;
87 int users;
89 wait_queue_head_t wait_queue;
90 /* don't really need those !? -- FIXME: use video_usercopy */
91 int (*kernel_ioctl)(struct inode *inode, struct file *file,
92 unsigned int cmd, void *arg);
94 void *priv;
98 extern int dvb_register_adapter(struct dvb_adapter *adap, const char *name,
99 struct module *module, struct device *device,
100 short *adapter_nums);
101 extern int dvb_unregister_adapter (struct dvb_adapter *adap);
103 extern int dvb_register_device (struct dvb_adapter *adap,
104 struct dvb_device **pdvbdev,
105 const struct dvb_device *template,
106 void *priv,
107 int type);
109 extern void dvb_unregister_device (struct dvb_device *dvbdev);
111 extern int dvb_generic_open (struct inode *inode, struct file *file);
112 extern int dvb_generic_release (struct inode *inode, struct file *file);
113 extern int dvb_generic_ioctl (struct inode *inode, struct file *file,
114 unsigned int cmd, unsigned long arg);
116 /* we don't mess with video_usercopy() any more,
117 we simply define out own dvb_usercopy(), which will hopefully become
118 generic_usercopy() someday... */
120 extern int dvb_usercopy(struct inode *inode, struct file *file,
121 unsigned int cmd, unsigned long arg,
122 int (*func)(struct inode *inode, struct file *file,
123 unsigned int cmd, void *arg));
125 /** generic DVB attach function. */
126 #ifdef CONFIG_MEDIA_ATTACH
127 #define dvb_attach(FUNCTION, ARGS...) ({ \
128 void *__r = NULL; \
129 typeof(&FUNCTION) __a = symbol_request(FUNCTION); \
130 if (__a) { \
131 __r = (void *) __a(ARGS); \
132 if (__r == NULL) \
133 symbol_put(FUNCTION); \
134 } else { \
135 printk(KERN_ERR "DVB: Unable to find symbol "#FUNCTION"()\n"); \
137 __r; \
140 #else
141 #define dvb_attach(FUNCTION, ARGS...) ({ \
142 FUNCTION(ARGS); \
145 #endif
147 #endif /* #ifndef _DVBDEV_H_ */