V4L/DVB (4605): Fixes an issue with V4L1 and make headers-install

V4L1 support should be disabled when no CONFIG_VIDEO_V4L1_COMPAT is defined,
to allow checking for broken V4L2 ports. This is very important during the
migration phase for V4L2 API.
However, userspace apps should be capable of using both APIs, since they need
to test at runtime, via VIDIOCGCAP ioctl, if V4L1 is supported. So, when
__KERNEL__ is not defined, those ioctls and corresponding structs should be
visible.
This patch also removes the obsolete defines HAVE_V4L1 and HAVE_V4L2, that
where causing some confusion, and were replaced by CONFIG_VIDEO_V4L1_COMPAT
and CONFIG_VIDEO_V4L2.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>

+18 -20
+1 -1
drivers/media/Kconfig
··· 53 If you are unsure as to whether this is required, answer Y. 54 55 config VIDEO_V4L2 56 - tristate 57 default y 58 59 source "drivers/media/video/Kconfig"
··· 53 If you are unsure as to whether this is required, answer Y. 54 55 config VIDEO_V4L2 56 + bool 57 default y 58 59 source "drivers/media/video/Kconfig"
+1 -1
drivers/media/video/zoran.h
··· 267 }; 268 269 /* whoops, this one is undeclared if !v4l2 */ 270 - #ifndef HAVE_V4L2 271 struct v4l2_jpegcompression { 272 int quality; 273 int APPn;
··· 267 }; 268 269 /* whoops, this one is undeclared if !v4l2 */ 270 + #ifndef CONFIG_VIDEO_V4L2 271 struct v4l2_jpegcompression { 272 int quality; 273 int APPn;
+11 -11
drivers/media/video/zoran_driver.c
··· 86 #include "zoran_device.h" 87 #include "zoran_card.h" 88 89 - #ifdef HAVE_V4L2 90 /* we declare some card type definitions here, they mean 91 * the same as the v4l1 ZORAN_VID_TYPE above, except it's v4l2 */ 92 #define ZORAN_V4L2_VID_FLAGS ( \ ··· 103 { 104 .name = "15-bit RGB", 105 .palette = VIDEO_PALETTE_RGB555, 106 - #ifdef HAVE_V4L2 107 #ifdef __LITTLE_ENDIAN 108 .fourcc = V4L2_PIX_FMT_RGB555, 109 #else ··· 117 }, { 118 .name = "16-bit RGB", 119 .palette = VIDEO_PALETTE_RGB565, 120 - #ifdef HAVE_V4L2 121 #ifdef __LITTLE_ENDIAN 122 .fourcc = V4L2_PIX_FMT_RGB565, 123 #else ··· 131 }, { 132 .name = "24-bit RGB", 133 .palette = VIDEO_PALETTE_RGB24, 134 - #ifdef HAVE_V4L2 135 #ifdef __LITTLE_ENDIAN 136 .fourcc = V4L2_PIX_FMT_BGR24, 137 #else ··· 145 }, { 146 .name = "32-bit RGB", 147 .palette = VIDEO_PALETTE_RGB32, 148 - #ifdef HAVE_V4L2 149 #ifdef __LITTLE_ENDIAN 150 .fourcc = V4L2_PIX_FMT_BGR32, 151 #else ··· 159 }, { 160 .name = "4:2:2, packed, YUYV", 161 .palette = VIDEO_PALETTE_YUV422, 162 - #ifdef HAVE_V4L2 163 .fourcc = V4L2_PIX_FMT_YUYV, 164 .colorspace = V4L2_COLORSPACE_SMPTE170M, 165 #endif ··· 169 }, { 170 .name = "Hardware-encoded Motion-JPEG", 171 .palette = -1, 172 - #ifdef HAVE_V4L2 173 .fourcc = V4L2_PIX_FMT_MJPEG, 174 .colorspace = V4L2_COLORSPACE_SMPTE170M, 175 #endif ··· 210 module_param(lock_norm, int, 0); 211 MODULE_PARM_DESC(lock_norm, "Users can't change norm"); 212 213 - #ifdef HAVE_V4L2 214 /* small helper function for calculating buffersizes for v4l2 215 * we calculate the nearest higher power-of-two, which 216 * will be the recommended buffersize */ ··· 1761 return wait_grab_pending(zr); 1762 } 1763 1764 - #ifdef HAVE_V4L2 1765 /* get the status of a buffer in the clients buffer queue */ 1766 static int 1767 zoran_v4l2_buffer_status (struct file *file, ··· 2676 } 2677 break; 2678 2679 - #ifdef HAVE_V4L2 2680 2681 /* The new video4linux2 capture interface - much nicer than video4linux1, since 2682 * it allows for integrating the JPEG capturing calls inside standard v4l2 ··· 4689 struct video_device zoran_template __devinitdata = { 4690 .name = ZORAN_NAME, 4691 .type = ZORAN_VID_TYPE, 4692 - #ifdef HAVE_V4L2 4693 .type2 = ZORAN_V4L2_VID_FLAGS, 4694 #endif 4695 .hardware = ZORAN_HARDWARE,
··· 86 #include "zoran_device.h" 87 #include "zoran_card.h" 88 89 + #ifdef CONFIG_VIDEO_V4L2 90 /* we declare some card type definitions here, they mean 91 * the same as the v4l1 ZORAN_VID_TYPE above, except it's v4l2 */ 92 #define ZORAN_V4L2_VID_FLAGS ( \ ··· 103 { 104 .name = "15-bit RGB", 105 .palette = VIDEO_PALETTE_RGB555, 106 + #ifdef CONFIG_VIDEO_V4L2 107 #ifdef __LITTLE_ENDIAN 108 .fourcc = V4L2_PIX_FMT_RGB555, 109 #else ··· 117 }, { 118 .name = "16-bit RGB", 119 .palette = VIDEO_PALETTE_RGB565, 120 + #ifdef CONFIG_VIDEO_V4L2 121 #ifdef __LITTLE_ENDIAN 122 .fourcc = V4L2_PIX_FMT_RGB565, 123 #else ··· 131 }, { 132 .name = "24-bit RGB", 133 .palette = VIDEO_PALETTE_RGB24, 134 + #ifdef CONFIG_VIDEO_V4L2 135 #ifdef __LITTLE_ENDIAN 136 .fourcc = V4L2_PIX_FMT_BGR24, 137 #else ··· 145 }, { 146 .name = "32-bit RGB", 147 .palette = VIDEO_PALETTE_RGB32, 148 + #ifdef CONFIG_VIDEO_V4L2 149 #ifdef __LITTLE_ENDIAN 150 .fourcc = V4L2_PIX_FMT_BGR32, 151 #else ··· 159 }, { 160 .name = "4:2:2, packed, YUYV", 161 .palette = VIDEO_PALETTE_YUV422, 162 + #ifdef CONFIG_VIDEO_V4L2 163 .fourcc = V4L2_PIX_FMT_YUYV, 164 .colorspace = V4L2_COLORSPACE_SMPTE170M, 165 #endif ··· 169 }, { 170 .name = "Hardware-encoded Motion-JPEG", 171 .palette = -1, 172 + #ifdef CONFIG_VIDEO_V4L2 173 .fourcc = V4L2_PIX_FMT_MJPEG, 174 .colorspace = V4L2_COLORSPACE_SMPTE170M, 175 #endif ··· 210 module_param(lock_norm, int, 0); 211 MODULE_PARM_DESC(lock_norm, "Users can't change norm"); 212 213 + #ifdef CONFIG_VIDEO_V4L2 214 /* small helper function for calculating buffersizes for v4l2 215 * we calculate the nearest higher power-of-two, which 216 * will be the recommended buffersize */ ··· 1761 return wait_grab_pending(zr); 1762 } 1763 1764 + #ifdef CONFIG_VIDEO_V4L2 1765 /* get the status of a buffer in the clients buffer queue */ 1766 static int 1767 zoran_v4l2_buffer_status (struct file *file, ··· 2676 } 2677 break; 2678 2679 + #ifdef CONFIG_VIDEO_V4L2 2680 2681 /* The new video4linux2 capture interface - much nicer than video4linux1, since 2682 * it allows for integrating the JPEG capturing calls inside standard v4l2 ··· 4689 struct video_device zoran_template __devinitdata = { 4690 .name = ZORAN_NAME, 4691 .type = ZORAN_VID_TYPE, 4692 + #ifdef CONFIG_VIDEO_V4L2 4693 .type2 = ZORAN_V4L2_VID_FLAGS, 4694 #endif 4695 .hardware = ZORAN_HARDWARE,
+1 -2
include/linux/videodev.h
··· 14 15 #include <linux/videodev2.h> 16 17 - #ifdef CONFIG_VIDEO_V4L1_COMPAT 18 - #define HAVE_V4L1 1 19 20 struct video_capability 21 {
··· 14 15 #include <linux/videodev2.h> 16 17 + #if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__) 18 19 struct video_capability 20 {
-2
include/linux/videodev2.h
··· 22 #endif 23 #include <linux/types.h> 24 25 - #define HAVE_V4L2 1 26 - 27 /* 28 * Common stuff for both V4L1 and V4L2 29 * Moved from videodev.h
··· 22 #endif 23 #include <linux/types.h> 24 25 /* 26 * Common stuff for both V4L1 and V4L2 27 * Moved from videodev.h
+4 -3
include/media/v4l2-dev.h
··· 194 195 196 int (*vidioc_overlay) (struct file *file, void *fh, unsigned int i); 197 - #ifdef HAVE_V4L1 198 /* buffer type is struct vidio_mbuf * */ 199 int (*vidiocgmbuf) (struct file *file, void *fh, struct video_mbuf *p); 200 #endif ··· 335 unsigned int cmd, void *arg)); 336 337 338 - #ifdef HAVE_V4L1 339 #include <linux/mm.h> 340 341 extern struct video_device* video_devdata(struct file*); ··· 357 class_device_remove_file(&vfd->class_dev, attr); 358 } 359 360 #ifdef OBSOLETE_OWNER /* to be removed soon */ 361 /* helper functions to access driver private data. */ 362 static inline void *video_get_drvdata(struct video_device *dev) ··· 374 375 extern int video_exclusive_open(struct inode *inode, struct file *file); 376 extern int video_exclusive_release(struct inode *inode, struct file *file); 377 - #endif /* HAVE_V4L1 */ 378 379 #endif /* _V4L2_DEV_H */
··· 194 195 196 int (*vidioc_overlay) (struct file *file, void *fh, unsigned int i); 197 + #ifdef CONFIG_VIDEO_V4L1_COMPAT 198 /* buffer type is struct vidio_mbuf * */ 199 int (*vidiocgmbuf) (struct file *file, void *fh, struct video_mbuf *p); 200 #endif ··· 335 unsigned int cmd, void *arg)); 336 337 338 + #ifdef CONFIG_VIDEO_V4L1_COMPAT 339 #include <linux/mm.h> 340 341 extern struct video_device* video_devdata(struct file*); ··· 357 class_device_remove_file(&vfd->class_dev, attr); 358 } 359 360 + #endif /* CONFIG_VIDEO_V4L1_COMPAT */ 361 + 362 #ifdef OBSOLETE_OWNER /* to be removed soon */ 363 /* helper functions to access driver private data. */ 364 static inline void *video_get_drvdata(struct video_device *dev) ··· 372 373 extern int video_exclusive_open(struct inode *inode, struct file *file); 374 extern int video_exclusive_release(struct inode *inode, struct file *file); 375 376 #endif /* _V4L2_DEV_H */