diff options
author | Dwaine Garden <DwaineGarden@rogers.com> | 2006-12-27 07:23:28 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-12-27 11:19:21 -0500 |
commit | ed00b41dc8bc286682d31ad64060ccc70513e90b (patch) | |
tree | 1752888ba5267d342f4b8c2fa29e86c0e569c307 /drivers/media | |
parent | 5ef35be42dfaa155e02718a9bd34cc341f327883 (diff) |
V4L/DVB (4979): Fixes compilation when CONFIG_V4L1_COMPAT is not selected
- SYSFS: Replaced all to_video_device(cd), video_device_create_file,
video_device_remove_file and add the proper checks at create_file
- Converted old norm values to V4L2 ones.
- Robustness on sysfs hue/contrast/saturation queries.
Additional check in order to return 0 if the driver is not opened.
- Whitespace cleanups in usbvision-cards.c
This patch merges two fixes by Thierry MERLE and Mauro Chehab, and adds
additional checks.
Signed-off-by: Dwaine Garden<DwaineGarden@rogers.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/usbvision/usbvision-cards.c | 11 | ||||
-rw-r--r-- | drivers/media/video/usbvision/usbvision-video.c | 134 |
2 files changed, 94 insertions, 51 deletions
diff --git a/drivers/media/video/usbvision/usbvision-cards.c b/drivers/media/video/usbvision/usbvision-cards.c index 134eb9865df6..a40e5838515b 100644 --- a/drivers/media/video/usbvision/usbvision-cards.c +++ b/drivers/media/video/usbvision/usbvision-cards.c | |||
@@ -39,8 +39,8 @@ struct usbvision_device_data_st usbvision_device_data[] = { | |||
39 | {0x0573, 0x0400, -1, CODEC_SAA7113, 4, V4L2_STD_NTSC, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "D-Link V100"}, | 39 | {0x0573, 0x0400, -1, CODEC_SAA7113, 4, V4L2_STD_NTSC, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "D-Link V100"}, |
40 | {0x0573, 0x2000, -1, CODEC_SAA7111, 2, V4L2_STD_NTSC, 1, 0, 1, 0, 0, -1, -1, -1, -1, -1, "X10 USB Camera"}, | 40 | {0x0573, 0x2000, -1, CODEC_SAA7111, 2, V4L2_STD_NTSC, 1, 0, 1, 0, 0, -1, -1, -1, -1, -1, "X10 USB Camera"}, |
41 | {0x0573, 0x2d00, -1, CODEC_SAA7111, 2, V4L2_STD_PAL, 1, 0, 1, 0, 0, -1, -1, -1, 3, 7, "Osprey 50"}, | 41 | {0x0573, 0x2d00, -1, CODEC_SAA7111, 2, V4L2_STD_PAL, 1, 0, 1, 0, 0, -1, -1, -1, 3, 7, "Osprey 50"}, |
42 | {0x0573, 0x2d01, -1, CODEC_SAA7113, 2, V4L2_STD_NTSC, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Hauppauge USB-Live Model 600"}, | 42 | {0x0573, 0x2d01, -1, CODEC_SAA7113, 2, V4L2_STD_NTSC, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Hauppauge USB-Live Model 600"}, |
43 | {0x0573, 0x2101, -1, CODEC_SAA7113, 2, V4L2_STD_PAL, 2, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Zoran Co. PMD (Nogatech) AV-grabber Manhattan"}, | 43 | {0x0573, 0x2101, -1, CODEC_SAA7113, 2, V4L2_STD_PAL, 2, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Zoran Co. PMD (Nogatech) AV-grabber Manhattan"}, |
44 | {0x0573, 0x4100, -1, CODEC_SAA7111, 3, V4L2_STD_NTSC, 1, 1, 1, 1, TUNER_PHILIPS_NTSC_M, -1, -1, -1, 20, -1, "Nogatech USB-TV (NTSC) FM"}, | 44 | {0x0573, 0x4100, -1, CODEC_SAA7111, 3, V4L2_STD_NTSC, 1, 1, 1, 1, TUNER_PHILIPS_NTSC_M, -1, -1, -1, 20, -1, "Nogatech USB-TV (NTSC) FM"}, |
45 | {0x0573, 0x4110, -1, CODEC_SAA7111, 3, V4L2_STD_NTSC, 1, 1, 1, 1, TUNER_PHILIPS_NTSC_M, -1, -1, -1, 20, -1, "PNY USB-TV (NTSC) FM"}, | 45 | {0x0573, 0x4110, -1, CODEC_SAA7111, 3, V4L2_STD_NTSC, 1, 1, 1, 1, TUNER_PHILIPS_NTSC_M, -1, -1, -1, 20, -1, "PNY USB-TV (NTSC) FM"}, |
46 | {0x0573, 0x4450, 0, CODEC_SAA7113, 3, V4L2_STD_PAL, 1, 1, 1, 1, TUNER_PHILIPS_PAL, -1, -1, 0, 3, 7, "PixelView PlayTv-USB PRO (PAL) FM"}, | 46 | {0x0573, 0x4450, 0, CODEC_SAA7113, 3, V4L2_STD_PAL, 1, 1, 1, 1, TUNER_PHILIPS_PAL, -1, -1, 0, 3, 7, "PixelView PlayTv-USB PRO (PAL) FM"}, |
@@ -71,10 +71,10 @@ struct usbvision_device_data_st usbvision_device_data[] = { | |||
71 | {0x0573, 0x4d37, 0, CODEC_SAA7113, 3, V4L2_STD_PAL, 1, 1, 1, 1, TUNER_PHILIPS_FM1216ME_MK3, -1, -1, 0, 3, 7, "Hauppauge WinTV USB device Model 40219 Rev E189"}, | 71 | {0x0573, 0x4d37, 0, CODEC_SAA7113, 3, V4L2_STD_PAL, 1, 1, 1, 1, TUNER_PHILIPS_FM1216ME_MK3, -1, -1, 0, 3, 7, "Hauppauge WinTV USB device Model 40219 Rev E189"}, |
72 | {0x0768, 0x0006, -1, CODEC_SAA7113, 3, V4L2_STD_NTSC, 1, 1, 1, 1, TUNER_PHILIPS_NTSC_M, -1, -1, 5, 5, -1, "Camtel Technology USB TV Genie Pro FM Model TVB330"}, | 72 | {0x0768, 0x0006, -1, CODEC_SAA7113, 3, V4L2_STD_NTSC, 1, 1, 1, 1, TUNER_PHILIPS_NTSC_M, -1, -1, 5, 5, -1, "Camtel Technology USB TV Genie Pro FM Model TVB330"}, |
73 | {0x07d0, 0x0001, -1, CODEC_SAA7113, 2, V4L2_STD_PAL, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Digital Video Creator I"}, | 73 | {0x07d0, 0x0001, -1, CODEC_SAA7113, 2, V4L2_STD_PAL, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Digital Video Creator I"}, |
74 | {0x07d0, 0x0002, -1, CODEC_SAA7111, 2, V4L2_STD_NTSC, 0, 0, 1, 0, 0, -1, -1, 82, 20, 7, "Global Village GV-007 (NTSC)"}, | 74 | {0x07d0, 0x0002, -1, CODEC_SAA7111, 2, V4L2_STD_NTSC, 0, 0, 1, 0, 0, -1, -1, 82, 20, 7, "Global Village GV-007 (NTSC)"}, |
75 | {0x07d0, 0x0003, 0, CODEC_SAA7113, 2, V4L2_STD_NTSC, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Dazzle Fusion Model DVC-50 Rev 1 (NTSC)"}, | 75 | {0x07d0, 0x0003, 0, CODEC_SAA7113, 2, V4L2_STD_NTSC, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Dazzle Fusion Model DVC-50 Rev 1 (NTSC)"}, |
76 | {0x07d0, 0x0004, 0, CODEC_SAA7113, 2, V4L2_STD_PAL, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Dazzle Fusion Model DVC-80 Rev 1 (PAL)"}, | 76 | {0x07d0, 0x0004, 0, CODEC_SAA7113, 2, V4L2_STD_PAL, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Dazzle Fusion Model DVC-80 Rev 1 (PAL)"}, |
77 | {0x07d0, 0x0005, 0, CODEC_SAA7113, 2, V4L2_STD_SECAM, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Dazzle Fusion Model DVC-90 Rev 1 (SECAM)"}, | 77 | {0x07d0, 0x0005, 0, CODEC_SAA7113, 2, V4L2_STD_SECAM, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Dazzle Fusion Model DVC-90 Rev 1 (SECAM)"}, |
78 | {0x2304, 0x010d, -1, CODEC_SAA7111, 3, V4L2_STD_PAL, 1, 0, 0, 1, TUNER_TEMIC_4066FY5_PAL_I, -1, -1, -1, -1, -1, "Pinnacle Studio PCTV USB (PAL)"}, | 78 | {0x2304, 0x010d, -1, CODEC_SAA7111, 3, V4L2_STD_PAL, 1, 0, 0, 1, TUNER_TEMIC_4066FY5_PAL_I, -1, -1, -1, -1, -1, "Pinnacle Studio PCTV USB (PAL)"}, |
79 | {0x2304, 0x0109, -1, CODEC_SAA7111, 3, V4L2_STD_SECAM, 1, 0, 1, 1, TUNER_PHILIPS_SECAM, -1, -1, -1, -1, -1, "Pinnacle Studio PCTV USB (SECAM)"}, | 79 | {0x2304, 0x0109, -1, CODEC_SAA7111, 3, V4L2_STD_SECAM, 1, 0, 1, 1, TUNER_PHILIPS_SECAM, -1, -1, -1, -1, -1, "Pinnacle Studio PCTV USB (SECAM)"}, |
80 | {0x2304, 0x0110, -1, CODEC_SAA7111, 3, V4L2_STD_PAL, 1, 1, 1, 1, TUNER_PHILIPS_PAL, -1, -1,128, 23, -1, "Pinnacle Studio PCTV USB (PAL) FM"}, | 80 | {0x2304, 0x0110, -1, CODEC_SAA7111, 3, V4L2_STD_PAL, 1, 1, 1, 1, TUNER_PHILIPS_PAL, -1, -1,128, 23, -1, "Pinnacle Studio PCTV USB (PAL) FM"}, |
@@ -86,7 +86,7 @@ struct usbvision_device_data_st usbvision_device_data[] = { | |||
86 | {0x2304, 0x0300, -1, CODEC_SAA7113, 2, V4L2_STD_NTSC, 1, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Pinnacle Studio Linx Video input cable (NTSC)"}, | 86 | {0x2304, 0x0300, -1, CODEC_SAA7113, 2, V4L2_STD_NTSC, 1, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Pinnacle Studio Linx Video input cable (NTSC)"}, |
87 | {0x2304, 0x0301, -1, CODEC_SAA7113, 2, V4L2_STD_PAL, 1, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Pinnacle Studio Linx Video input cable (PAL)"}, | 87 | {0x2304, 0x0301, -1, CODEC_SAA7113, 2, V4L2_STD_PAL, 1, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Pinnacle Studio Linx Video input cable (PAL)"}, |
88 | {0x2304, 0x0419, -1, CODEC_SAA7113, 3, V4L2_STD_PAL, 1, 1, 1, 1, TUNER_TEMIC_4009FR5_PAL, -1, -1, 0, 3, 7, "Pinnacle PCTV Bungee USB (PAL) FM"}, | 88 | {0x2304, 0x0419, -1, CODEC_SAA7113, 3, V4L2_STD_PAL, 1, 1, 1, 1, TUNER_TEMIC_4009FR5_PAL, -1, -1, 0, 3, 7, "Pinnacle PCTV Bungee USB (PAL) FM"}, |
89 | {0x2400, 0x4200, -1, CODEC_SAA7111, 3, VIDEO_MODE_NTSC, 1, 0, 1, 1, TUNER_PHILIPS_NTSC_M, -1, -1, -1, -1, -1, "Hauppauge WinTv-USB"}, | 89 | {0x2400, 0x4200, -1, CODEC_SAA7111, 3, V4L2_STD_NTSC, 1, 0, 1, 1, TUNER_PHILIPS_NTSC_M, -1, -1, -1, -1, -1, "Hauppauge WinTv-USB"}, |
90 | {} /* Terminating entry */ | 90 | {} /* Terminating entry */ |
91 | }; | 91 | }; |
92 | 92 | ||
@@ -148,7 +148,6 @@ struct usb_device_id usbvision_table [] = { | |||
148 | { USB_DEVICE(0x2304, 0x0300) }, /* Pinnacle Studio Linx Video input cable (NTSC) */ | 148 | { USB_DEVICE(0x2304, 0x0300) }, /* Pinnacle Studio Linx Video input cable (NTSC) */ |
149 | { USB_DEVICE(0x2304, 0x0301) }, /* Pinnacle Studio Linx Video input cable (PAL) */ | 149 | { USB_DEVICE(0x2304, 0x0301) }, /* Pinnacle Studio Linx Video input cable (PAL) */ |
150 | { USB_DEVICE(0x2304, 0x0419) }, /* Pinnacle PCTV Bungee USB (PAL) FM */ | 150 | { USB_DEVICE(0x2304, 0x0419) }, /* Pinnacle PCTV Bungee USB (PAL) FM */ |
151 | |||
152 | { USB_DEVICE(0x2400, 0x4200) }, /* Hauppauge WinTv-USB2 Model 42012 */ | 151 | { USB_DEVICE(0x2400, 0x4200) }, /* Hauppauge WinTv-USB2 Model 42012 */ |
153 | 152 | ||
154 | { } /* Terminating entry */ | 153 | { } /* Terminating entry */ |
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index 31b133ef0698..8c7eba2a728e 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c | |||
@@ -204,7 +204,7 @@ MODULE_ALIAS(DRIVER_ALIAS); | |||
204 | 204 | ||
205 | static inline struct usb_usbvision *cd_to_usbvision(struct class_device *cd) | 205 | static inline struct usb_usbvision *cd_to_usbvision(struct class_device *cd) |
206 | { | 206 | { |
207 | struct video_device *vdev = to_video_device(cd); | 207 | struct video_device *vdev = container_of(cd, struct video_device, class_dev); |
208 | return video_get_drvdata(vdev); | 208 | return video_get_drvdata(vdev); |
209 | } | 209 | } |
210 | 210 | ||
@@ -214,81 +214,85 @@ static ssize_t show_version(struct class_device *cd, char *buf) | |||
214 | } | 214 | } |
215 | static CLASS_DEVICE_ATTR(version, S_IRUGO, show_version, NULL); | 215 | static CLASS_DEVICE_ATTR(version, S_IRUGO, show_version, NULL); |
216 | 216 | ||
217 | static ssize_t show_model(struct class_device *class_dev, char *buf) | 217 | static ssize_t show_model(struct class_device *cd, char *buf) |
218 | { | 218 | { |
219 | struct video_device *vdev = to_video_device(class_dev); | 219 | struct video_device *vdev = container_of(cd, struct video_device, class_dev); |
220 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); | 220 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); |
221 | return sprintf(buf, "%s\n", usbvision_device_data[usbvision->DevModel].ModelString); | 221 | return sprintf(buf, "%s\n", usbvision_device_data[usbvision->DevModel].ModelString); |
222 | } | 222 | } |
223 | static CLASS_DEVICE_ATTR(model, S_IRUGO, show_model, NULL); | 223 | static CLASS_DEVICE_ATTR(model, S_IRUGO, show_model, NULL); |
224 | 224 | ||
225 | static ssize_t show_hue(struct class_device *class_dev, char *buf) | 225 | static ssize_t show_hue(struct class_device *cd, char *buf) |
226 | { | 226 | { |
227 | struct video_device *vdev = to_video_device(class_dev); | 227 | struct video_device *vdev = container_of(cd, struct video_device, class_dev); |
228 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); | 228 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); |
229 | struct v4l2_control ctrl; | 229 | struct v4l2_control ctrl; |
230 | ctrl.id = V4L2_CID_HUE; | 230 | ctrl.id = V4L2_CID_HUE; |
231 | ctrl.value = 0; | 231 | ctrl.value = 0; |
232 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); | 232 | if(usbvision->user) |
233 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); | ||
233 | return sprintf(buf, "%d\n", ctrl.value >> 8); | 234 | return sprintf(buf, "%d\n", ctrl.value >> 8); |
234 | } | 235 | } |
235 | static CLASS_DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); | 236 | static CLASS_DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); |
236 | 237 | ||
237 | static ssize_t show_contrast(struct class_device *class_dev, char *buf) | 238 | static ssize_t show_contrast(struct class_device *cd, char *buf) |
238 | { | 239 | { |
239 | struct video_device *vdev = to_video_device(class_dev); | 240 | struct video_device *vdev = container_of(cd, struct video_device, class_dev); |
240 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); | 241 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); |
241 | struct v4l2_control ctrl; | 242 | struct v4l2_control ctrl; |
242 | ctrl.id = V4L2_CID_CONTRAST; | 243 | ctrl.id = V4L2_CID_CONTRAST; |
243 | ctrl.value = 0; | 244 | ctrl.value = 0; |
244 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); | 245 | if(usbvision->user) |
246 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); | ||
245 | return sprintf(buf, "%d\n", ctrl.value >> 8); | 247 | return sprintf(buf, "%d\n", ctrl.value >> 8); |
246 | } | 248 | } |
247 | static CLASS_DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); | 249 | static CLASS_DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); |
248 | 250 | ||
249 | static ssize_t show_brightness(struct class_device *class_dev, char *buf) | 251 | static ssize_t show_brightness(struct class_device *cd, char *buf) |
250 | { | 252 | { |
251 | struct video_device *vdev = to_video_device(class_dev); | 253 | struct video_device *vdev = container_of(cd, struct video_device, class_dev); |
252 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); | 254 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); |
253 | struct v4l2_control ctrl; | 255 | struct v4l2_control ctrl; |
254 | ctrl.id = V4L2_CID_BRIGHTNESS; | 256 | ctrl.id = V4L2_CID_BRIGHTNESS; |
255 | ctrl.value = 0; | 257 | ctrl.value = 0; |
256 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); | 258 | if(usbvision->user) |
259 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); | ||
257 | return sprintf(buf, "%d\n", ctrl.value >> 8); | 260 | return sprintf(buf, "%d\n", ctrl.value >> 8); |
258 | } | 261 | } |
259 | static CLASS_DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); | 262 | static CLASS_DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); |
260 | 263 | ||
261 | static ssize_t show_saturation(struct class_device *class_dev, char *buf) | 264 | static ssize_t show_saturation(struct class_device *cd, char *buf) |
262 | { | 265 | { |
263 | struct video_device *vdev = to_video_device(class_dev); | 266 | struct video_device *vdev = container_of(cd, struct video_device, class_dev); |
264 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); | 267 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); |
265 | struct v4l2_control ctrl; | 268 | struct v4l2_control ctrl; |
266 | ctrl.id = V4L2_CID_SATURATION; | 269 | ctrl.id = V4L2_CID_SATURATION; |
267 | ctrl.value = 0; | 270 | ctrl.value = 0; |
268 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); | 271 | if(usbvision->user) |
272 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); | ||
269 | return sprintf(buf, "%d\n", ctrl.value >> 8); | 273 | return sprintf(buf, "%d\n", ctrl.value >> 8); |
270 | } | 274 | } |
271 | static CLASS_DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); | 275 | static CLASS_DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); |
272 | 276 | ||
273 | static ssize_t show_streaming(struct class_device *class_dev, char *buf) | 277 | static ssize_t show_streaming(struct class_device *cd, char *buf) |
274 | { | 278 | { |
275 | struct video_device *vdev = to_video_device(class_dev); | 279 | struct video_device *vdev = container_of(cd, struct video_device, class_dev); |
276 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); | 280 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); |
277 | return sprintf(buf, "%s\n", YES_NO(usbvision->streaming==Stream_On?1:0)); | 281 | return sprintf(buf, "%s\n", YES_NO(usbvision->streaming==Stream_On?1:0)); |
278 | } | 282 | } |
279 | static CLASS_DEVICE_ATTR(streaming, S_IRUGO, show_streaming, NULL); | 283 | static CLASS_DEVICE_ATTR(streaming, S_IRUGO, show_streaming, NULL); |
280 | 284 | ||
281 | static ssize_t show_compression(struct class_device *class_dev, char *buf) | 285 | static ssize_t show_compression(struct class_device *cd, char *buf) |
282 | { | 286 | { |
283 | struct video_device *vdev = to_video_device(class_dev); | 287 | struct video_device *vdev = container_of(cd, struct video_device, class_dev); |
284 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); | 288 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); |
285 | return sprintf(buf, "%s\n", YES_NO(usbvision->isocMode==ISOC_MODE_COMPRESS)); | 289 | return sprintf(buf, "%s\n", YES_NO(usbvision->isocMode==ISOC_MODE_COMPRESS)); |
286 | } | 290 | } |
287 | static CLASS_DEVICE_ATTR(compression, S_IRUGO, show_compression, NULL); | 291 | static CLASS_DEVICE_ATTR(compression, S_IRUGO, show_compression, NULL); |
288 | 292 | ||
289 | static ssize_t show_device_bridge(struct class_device *class_dev, char *buf) | 293 | static ssize_t show_device_bridge(struct class_device *cd, char *buf) |
290 | { | 294 | { |
291 | struct video_device *vdev = to_video_device(class_dev); | 295 | struct video_device *vdev = container_of(cd, struct video_device, class_dev); |
292 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); | 296 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); |
293 | return sprintf(buf, "%d\n", usbvision->bridgeType); | 297 | return sprintf(buf, "%d\n", usbvision->bridgeType); |
294 | } | 298 | } |
@@ -297,31 +301,71 @@ static CLASS_DEVICE_ATTR(bridge, S_IRUGO, show_device_bridge, NULL); | |||
297 | static void usbvision_create_sysfs(struct video_device *vdev) | 301 | static void usbvision_create_sysfs(struct video_device *vdev) |
298 | { | 302 | { |
299 | int res; | 303 | int res; |
300 | if (vdev) { | 304 | if (!vdev) |
301 | res=video_device_create_file(vdev, &class_device_attr_version); | 305 | return; |
302 | res=video_device_create_file(vdev, &class_device_attr_model); | 306 | do { |
303 | res=video_device_create_file(vdev, &class_device_attr_hue); | 307 | res=class_device_create_file(&vdev->class_dev, |
304 | res=video_device_create_file(vdev, &class_device_attr_contrast); | 308 | &class_device_attr_version); |
305 | res=video_device_create_file(vdev, &class_device_attr_brightness); | 309 | if (res<0) |
306 | res=video_device_create_file(vdev, &class_device_attr_saturation); | 310 | break; |
307 | res=video_device_create_file(vdev, &class_device_attr_streaming); | 311 | res=class_device_create_file(&vdev->class_dev, |
308 | res=video_device_create_file(vdev, &class_device_attr_compression); | 312 | &class_device_attr_model); |
309 | res=video_device_create_file(vdev, &class_device_attr_bridge); | 313 | if (res<0) |
310 | } | 314 | break; |
315 | res=class_device_create_file(&vdev->class_dev, | ||
316 | &class_device_attr_hue); | ||
317 | if (res<0) | ||
318 | break; | ||
319 | res=class_device_create_file(&vdev->class_dev, | ||
320 | &class_device_attr_contrast); | ||
321 | if (res<0) | ||
322 | break; | ||
323 | res=class_device_create_file(&vdev->class_dev, | ||
324 | &class_device_attr_brightness); | ||
325 | if (res<0) | ||
326 | break; | ||
327 | res=class_device_create_file(&vdev->class_dev, | ||
328 | &class_device_attr_saturation); | ||
329 | if (res<0) | ||
330 | break; | ||
331 | res=class_device_create_file(&vdev->class_dev, | ||
332 | &class_device_attr_streaming); | ||
333 | if (res<0) | ||
334 | break; | ||
335 | res=class_device_create_file(&vdev->class_dev, | ||
336 | &class_device_attr_compression); | ||
337 | if (res<0) | ||
338 | break; | ||
339 | res=class_device_create_file(&vdev->class_dev, | ||
340 | &class_device_attr_bridge); | ||
341 | if (res>=0) | ||
342 | return; | ||
343 | } while (0); | ||
344 | |||
345 | err("%s error: %d\n", __FUNCTION__, res); | ||
311 | } | 346 | } |
312 | 347 | ||
313 | static void usbvision_remove_sysfs(struct video_device *vdev) | 348 | static void usbvision_remove_sysfs(struct video_device *vdev) |
314 | { | 349 | { |
315 | if (vdev) { | 350 | if (vdev) { |
316 | video_device_remove_file(vdev, &class_device_attr_version); | 351 | class_device_remove_file(&vdev->class_dev, |
317 | video_device_remove_file(vdev, &class_device_attr_model); | 352 | &class_device_attr_version); |
318 | video_device_remove_file(vdev, &class_device_attr_hue); | 353 | class_device_remove_file(&vdev->class_dev, |
319 | video_device_remove_file(vdev, &class_device_attr_contrast); | 354 | &class_device_attr_model); |
320 | video_device_remove_file(vdev, &class_device_attr_brightness); | 355 | class_device_remove_file(&vdev->class_dev, |
321 | video_device_remove_file(vdev, &class_device_attr_saturation); | 356 | &class_device_attr_hue); |
322 | video_device_remove_file(vdev, &class_device_attr_streaming); | 357 | class_device_remove_file(&vdev->class_dev, |
323 | video_device_remove_file(vdev, &class_device_attr_compression); | 358 | &class_device_attr_contrast); |
324 | video_device_remove_file(vdev, &class_device_attr_bridge); | 359 | class_device_remove_file(&vdev->class_dev, |
360 | &class_device_attr_brightness); | ||
361 | class_device_remove_file(&vdev->class_dev, | ||
362 | &class_device_attr_saturation); | ||
363 | class_device_remove_file(&vdev->class_dev, | ||
364 | &class_device_attr_streaming); | ||
365 | class_device_remove_file(&vdev->class_dev, | ||
366 | &class_device_attr_compression); | ||
367 | class_device_remove_file(&vdev->class_dev, | ||
368 | &class_device_attr_bridge); | ||
325 | } | 369 | } |
326 | } | 370 | } |
327 | 371 | ||
@@ -1933,22 +1977,22 @@ static void customdevice_process(void) | |||
1933 | { | 1977 | { |
1934 | case 'P': | 1978 | case 'P': |
1935 | PDEBUG(DBG_PROBE, "VideoNorm=PAL"); | 1979 | PDEBUG(DBG_PROBE, "VideoNorm=PAL"); |
1936 | usbvision_device_data[0].VideoNorm=VIDEO_MODE_PAL; | 1980 | usbvision_device_data[0].VideoNorm=V4L2_STD_PAL; |
1937 | break; | 1981 | break; |
1938 | 1982 | ||
1939 | case 'S': | 1983 | case 'S': |
1940 | PDEBUG(DBG_PROBE, "VideoNorm=SECAM"); | 1984 | PDEBUG(DBG_PROBE, "VideoNorm=SECAM"); |
1941 | usbvision_device_data[0].VideoNorm=VIDEO_MODE_SECAM; | 1985 | usbvision_device_data[0].VideoNorm=V4L2_STD_SECAM; |
1942 | break; | 1986 | break; |
1943 | 1987 | ||
1944 | case 'N': | 1988 | case 'N': |
1945 | PDEBUG(DBG_PROBE, "VideoNorm=NTSC"); | 1989 | PDEBUG(DBG_PROBE, "VideoNorm=NTSC"); |
1946 | usbvision_device_data[0].VideoNorm=VIDEO_MODE_NTSC; | 1990 | usbvision_device_data[0].VideoNorm=V4L2_STD_NTSC; |
1947 | break; | 1991 | break; |
1948 | 1992 | ||
1949 | default: | 1993 | default: |
1950 | PDEBUG(DBG_PROBE, "VideoNorm=PAL (by default)"); | 1994 | PDEBUG(DBG_PROBE, "VideoNorm=PAL (by default)"); |
1951 | usbvision_device_data[0].VideoNorm=VIDEO_MODE_PAL; | 1995 | usbvision_device_data[0].VideoNorm=V4L2_STD_PAL; |
1952 | break; | 1996 | break; |
1953 | } | 1997 | } |
1954 | goto2next(parse); | 1998 | goto2next(parse); |