]> git.pld-linux.org Git - packages/kernel.git/blame - 19_videodev25-2.4.22.diff
- fixed for PLD
[packages/kernel.git] / 19_videodev25-2.4.22.diff
CommitLineData
2a761ace
AM
1diff -u linux-2.4.22/drivers/media/video/videodev.c linux/drivers/media/video/videodev.c
2--- linux-2.4.22/drivers/media/video/videodev.c 2003-09-08 17:26:56.000000000 +0200
3+++ linux/drivers/media/video/videodev.c 2003-09-08 17:28:40.000000000 +0200
4@@ -62,6 +62,20 @@
5
6 #endif /* CONFIG_PROC_FS && CONFIG_VIDEO_PROC_FS */
7
8+struct video_device *video_device_alloc(void)
9+{
10+ struct video_device *vfd;
11+ vfd = kmalloc(sizeof(*vfd),GFP_KERNEL);
12+ if (NULL == vfd)
13+ return NULL;
14+ memset(vfd,0,sizeof(*vfd));
15+ return vfd;
16+}
17+
18+void video_device_release(struct video_device *vfd)
19+{
20+ kfree(vfd);
21+}
22
23 /*
24 * Read will do some smarts later on. Buffer pin etc.
25@@ -611,6 +625,8 @@
26 #endif
27
28 devfs_unregister (vfd->devfs_handle);
29+ if (vfd->release)
30+ vfd->release(vfd);
31 video_device[vfd->minor]=NULL;
32 MOD_DEC_USE_COUNT;
33 up(&videodev_lock);
34@@ -661,6 +677,8 @@
35 module_init(videodev_init)
36 module_exit(videodev_exit)
37
38+EXPORT_SYMBOL(video_device_alloc);
39+EXPORT_SYMBOL(video_device_release);
40 EXPORT_SYMBOL(video_register_device);
41 EXPORT_SYMBOL(video_unregister_device);
42 EXPORT_SYMBOL(video_devdata);
43diff -u linux-2.4.22/include/linux/videodev.h linux/include/linux/videodev.h
44--- linux-2.4.22/include/linux/videodev.h 2003-09-08 17:27:56.000000000 +0200
45+++ linux/include/linux/videodev.h 2003-09-08 17:28:40.000000000 +0200
46@@ -4,32 +4,25 @@
47 #include <linux/types.h>
48 #include <linux/version.h>
49
50-#if 0
51-/*
52- * v4l2 is still work-in-progress, integration planed for 2.5.x
53- * v4l2 project homepage: http://www.thedirks.org/v4l2/
54- * patches available from: http://bytesex.org/patches/
55- */
56-# define HAVE_V4L2 1
57-# include <linux/videodev2.h>
58-#else
59-# undef HAVE_V4L2
60-#endif
61-
62 #ifdef __KERNEL__
63
64 #include <linux/poll.h>
65+#include <linux/mm.h>
66 #include <linux/devfs_fs_kernel.h>
67
68 struct video_device
69 {
70- struct module *owner;
71- char name[32];
72- int type; /* v4l1 */
73- int type2; /* v4l2 */
74+ /* device info */
75+ char name[32];
76+ int type; /* v4l1 */
77+ int type2; /* v4l2 */
78 int hardware;
79 int minor;
80
81+ /* device ops + callbacks */
82+ struct file_operations *fops;
83+ void (*release)(struct video_device *vfd);
84+
85 /* old, obsolete interface -- dropped in 2.5.x, don't use it */
86 int (*open)(struct video_device *, int mode);
87 void (*close)(struct video_device *);
88@@ -40,28 +33,50 @@
89 int (*mmap)(struct video_device *, const char *, unsigned long);
90 int (*initialize)(struct video_device *);
91
92- /* new interface -- we will use file_operations directly
93- * like soundcore does. */
94- struct file_operations *fops;
95- void *priv; /* Used to be 'private' but that upsets C++ */
96-
97- /* for videodev.c intenal usage -- don't touch */
98- int users;
99- struct semaphore lock;
100- devfs_handle_t devfs_handle;
101+#if 1 /* to be removed in 2.7.x */
102+ /* obsolete -- fops->owner is used instead */
103+ struct module *owner;
104+ /* dev->driver_data will be used instead some day.
105+ * Use the video_{get|set}_drvdata() helper functions,
106+ * so the switch over will be transparent for you.
107+ * Or use {pci|usb}_{get|set}_drvdata() directly. */
108+ void *priv;
109+#endif
110+
111+ /* for videodev.c intenal usage -- please don't touch */
112+ int users; /* video_exclusive_{open|close} ... */
113+ struct semaphore lock; /* ... helper function uses these */
114+ devfs_handle_t devfs_handle; /* devfs */
115 };
116
117 #define VIDEO_MAJOR 81
118-extern int video_register_device(struct video_device *, int type, int nr);
119
120 #define VFL_TYPE_GRABBER 0
121 #define VFL_TYPE_VBI 1
122 #define VFL_TYPE_RADIO 2
123 #define VFL_TYPE_VTX 3
124
125+extern int video_register_device(struct video_device *, int type, int nr);
126 extern void video_unregister_device(struct video_device *);
127 extern struct video_device* video_devdata(struct file*);
128
129+
130+/* helper functions to alloc / release struct video_device, the
131+ later can be used for video_device->release() */
132+struct video_device *video_device_alloc(void);
133+void video_device_release(struct video_device *vfd);
134+
135+/* helper functions to access driver private data. */
136+static inline void *video_get_drvdata(struct video_device *dev)
137+{
138+ return dev->priv;
139+}
140+
141+static inline void video_set_drvdata(struct video_device *dev, void *data)
142+{
143+ dev->priv = data;
144+}
145+
146 extern int video_exclusive_open(struct inode *inode, struct file *file);
147 extern int video_exclusive_release(struct inode *inode, struct file *file);
148 extern int video_usercopy(struct inode *inode, struct file *file,
149@@ -403,9 +418,8 @@
150 #define VID_HARDWARE_PWC 31 /* Philips webcams */
151 #define VID_HARDWARE_MEYE 32 /* Sony Vaio MotionEye cameras */
152 #define VID_HARDWARE_CPIA2 33
153-#define VID_HARDWARE_VICAM 34 /* ViCam, 3Com Homeconnect */
154+#define VID_HARDWARE_VICAM 34
155 #define VID_HARDWARE_SF16FMR2 35
156-
157 #endif /* __LINUX_VIDEODEV_H */
158
159 /*
This page took 0.114713 seconds and 4 git commands to generate.