diff options
Diffstat (limited to 'drivers/media/video/usbvision/usbvision-video.c')
-rw-r--r-- | drivers/media/video/usbvision/usbvision-video.c | 120 |
1 files changed, 64 insertions, 56 deletions
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index 0cb006f2943d..e2f3c01cfa13 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c | |||
@@ -68,7 +68,6 @@ | |||
68 | #include <media/tuner.h> | 68 | #include <media/tuner.h> |
69 | #include <media/audiochip.h> | 69 | #include <media/audiochip.h> |
70 | 70 | ||
71 | #include <linux/moduleparam.h> | ||
72 | #include <linux/workqueue.h> | 71 | #include <linux/workqueue.h> |
73 | 72 | ||
74 | #ifdef CONFIG_KMOD | 73 | #ifdef CONFIG_KMOD |
@@ -183,20 +182,22 @@ MODULE_ALIAS(DRIVER_ALIAS); | |||
183 | 182 | ||
184 | #define YES_NO(x) ((x) ? "Yes" : "No") | 183 | #define YES_NO(x) ((x) ? "Yes" : "No") |
185 | 184 | ||
186 | static inline struct usb_usbvision *cd_to_usbvision(struct class_device *cd) | 185 | static inline struct usb_usbvision *cd_to_usbvision(struct device *cd) |
187 | { | 186 | { |
188 | struct video_device *vdev = | 187 | struct video_device *vdev = |
189 | container_of(cd, struct video_device, class_dev); | 188 | container_of(cd, struct video_device, class_dev); |
190 | return video_get_drvdata(vdev); | 189 | return video_get_drvdata(vdev); |
191 | } | 190 | } |
192 | 191 | ||
193 | static ssize_t show_version(struct class_device *cd, char *buf) | 192 | static ssize_t show_version(struct device *cd, |
193 | struct device_attribute *attr, char *buf) | ||
194 | { | 194 | { |
195 | return sprintf(buf, "%s\n", USBVISION_VERSION_STRING); | 195 | return sprintf(buf, "%s\n", USBVISION_VERSION_STRING); |
196 | } | 196 | } |
197 | static CLASS_DEVICE_ATTR(version, S_IRUGO, show_version, NULL); | 197 | static DEVICE_ATTR(version, S_IRUGO, show_version, NULL); |
198 | 198 | ||
199 | static ssize_t show_model(struct class_device *cd, char *buf) | 199 | static ssize_t show_model(struct device *cd, |
200 | struct device_attribute *attr, char *buf) | ||
200 | { | 201 | { |
201 | struct video_device *vdev = | 202 | struct video_device *vdev = |
202 | container_of(cd, struct video_device, class_dev); | 203 | container_of(cd, struct video_device, class_dev); |
@@ -204,9 +205,10 @@ static ssize_t show_model(struct class_device *cd, char *buf) | |||
204 | return sprintf(buf, "%s\n", | 205 | return sprintf(buf, "%s\n", |
205 | usbvision_device_data[usbvision->DevModel].ModelString); | 206 | usbvision_device_data[usbvision->DevModel].ModelString); |
206 | } | 207 | } |
207 | static CLASS_DEVICE_ATTR(model, S_IRUGO, show_model, NULL); | 208 | static DEVICE_ATTR(model, S_IRUGO, show_model, NULL); |
208 | 209 | ||
209 | static ssize_t show_hue(struct class_device *cd, char *buf) | 210 | static ssize_t show_hue(struct device *cd, |
211 | struct device_attribute *attr, char *buf) | ||
210 | { | 212 | { |
211 | struct video_device *vdev = | 213 | struct video_device *vdev = |
212 | container_of(cd, struct video_device, class_dev); | 214 | container_of(cd, struct video_device, class_dev); |
@@ -218,9 +220,10 @@ static ssize_t show_hue(struct class_device *cd, char *buf) | |||
218 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); | 220 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); |
219 | return sprintf(buf, "%d\n", ctrl.value); | 221 | return sprintf(buf, "%d\n", ctrl.value); |
220 | } | 222 | } |
221 | static CLASS_DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); | 223 | static DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); |
222 | 224 | ||
223 | static ssize_t show_contrast(struct class_device *cd, char *buf) | 225 | static ssize_t show_contrast(struct device *cd, |
226 | struct device_attribute *attr, char *buf) | ||
224 | { | 227 | { |
225 | struct video_device *vdev = | 228 | struct video_device *vdev = |
226 | container_of(cd, struct video_device, class_dev); | 229 | container_of(cd, struct video_device, class_dev); |
@@ -232,9 +235,10 @@ static ssize_t show_contrast(struct class_device *cd, char *buf) | |||
232 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); | 235 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); |
233 | return sprintf(buf, "%d\n", ctrl.value); | 236 | return sprintf(buf, "%d\n", ctrl.value); |
234 | } | 237 | } |
235 | static CLASS_DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); | 238 | static DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); |
236 | 239 | ||
237 | static ssize_t show_brightness(struct class_device *cd, char *buf) | 240 | static ssize_t show_brightness(struct device *cd, |
241 | struct device_attribute *attr, char *buf) | ||
238 | { | 242 | { |
239 | struct video_device *vdev = | 243 | struct video_device *vdev = |
240 | container_of(cd, struct video_device, class_dev); | 244 | container_of(cd, struct video_device, class_dev); |
@@ -246,9 +250,10 @@ static ssize_t show_brightness(struct class_device *cd, char *buf) | |||
246 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); | 250 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); |
247 | return sprintf(buf, "%d\n", ctrl.value); | 251 | return sprintf(buf, "%d\n", ctrl.value); |
248 | } | 252 | } |
249 | static CLASS_DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); | 253 | static DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); |
250 | 254 | ||
251 | static ssize_t show_saturation(struct class_device *cd, char *buf) | 255 | static ssize_t show_saturation(struct device *cd, |
256 | struct device_attribute *attr, char *buf) | ||
252 | { | 257 | { |
253 | struct video_device *vdev = | 258 | struct video_device *vdev = |
254 | container_of(cd, struct video_device, class_dev); | 259 | container_of(cd, struct video_device, class_dev); |
@@ -260,9 +265,10 @@ static ssize_t show_saturation(struct class_device *cd, char *buf) | |||
260 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); | 265 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); |
261 | return sprintf(buf, "%d\n", ctrl.value); | 266 | return sprintf(buf, "%d\n", ctrl.value); |
262 | } | 267 | } |
263 | static CLASS_DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); | 268 | static DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); |
264 | 269 | ||
265 | static ssize_t show_streaming(struct class_device *cd, char *buf) | 270 | static ssize_t show_streaming(struct device *cd, |
271 | struct device_attribute *attr, char *buf) | ||
266 | { | 272 | { |
267 | struct video_device *vdev = | 273 | struct video_device *vdev = |
268 | container_of(cd, struct video_device, class_dev); | 274 | container_of(cd, struct video_device, class_dev); |
@@ -270,9 +276,10 @@ static ssize_t show_streaming(struct class_device *cd, char *buf) | |||
270 | return sprintf(buf, "%s\n", | 276 | return sprintf(buf, "%s\n", |
271 | YES_NO(usbvision->streaming==Stream_On?1:0)); | 277 | YES_NO(usbvision->streaming==Stream_On?1:0)); |
272 | } | 278 | } |
273 | static CLASS_DEVICE_ATTR(streaming, S_IRUGO, show_streaming, NULL); | 279 | static DEVICE_ATTR(streaming, S_IRUGO, show_streaming, NULL); |
274 | 280 | ||
275 | static ssize_t show_compression(struct class_device *cd, char *buf) | 281 | static ssize_t show_compression(struct device *cd, |
282 | struct device_attribute *attr, char *buf) | ||
276 | { | 283 | { |
277 | struct video_device *vdev = | 284 | struct video_device *vdev = |
278 | container_of(cd, struct video_device, class_dev); | 285 | container_of(cd, struct video_device, class_dev); |
@@ -280,16 +287,17 @@ static ssize_t show_compression(struct class_device *cd, char *buf) | |||
280 | return sprintf(buf, "%s\n", | 287 | return sprintf(buf, "%s\n", |
281 | YES_NO(usbvision->isocMode==ISOC_MODE_COMPRESS)); | 288 | YES_NO(usbvision->isocMode==ISOC_MODE_COMPRESS)); |
282 | } | 289 | } |
283 | static CLASS_DEVICE_ATTR(compression, S_IRUGO, show_compression, NULL); | 290 | static DEVICE_ATTR(compression, S_IRUGO, show_compression, NULL); |
284 | 291 | ||
285 | static ssize_t show_device_bridge(struct class_device *cd, char *buf) | 292 | static ssize_t show_device_bridge(struct device *cd, |
293 | struct device_attribute *attr, char *buf) | ||
286 | { | 294 | { |
287 | struct video_device *vdev = | 295 | struct video_device *vdev = |
288 | container_of(cd, struct video_device, class_dev); | 296 | container_of(cd, struct video_device, class_dev); |
289 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); | 297 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); |
290 | return sprintf(buf, "%d\n", usbvision->bridgeType); | 298 | return sprintf(buf, "%d\n", usbvision->bridgeType); |
291 | } | 299 | } |
292 | static CLASS_DEVICE_ATTR(bridge, S_IRUGO, show_device_bridge, NULL); | 300 | static DEVICE_ATTR(bridge, S_IRUGO, show_device_bridge, NULL); |
293 | 301 | ||
294 | static void usbvision_create_sysfs(struct video_device *vdev) | 302 | static void usbvision_create_sysfs(struct video_device *vdev) |
295 | { | 303 | { |
@@ -297,40 +305,40 @@ static void usbvision_create_sysfs(struct video_device *vdev) | |||
297 | if (!vdev) | 305 | if (!vdev) |
298 | return; | 306 | return; |
299 | do { | 307 | do { |
300 | res=class_device_create_file(&vdev->class_dev, | 308 | res = device_create_file(&vdev->class_dev, |
301 | &class_device_attr_version); | 309 | &dev_attr_version); |
302 | if (res<0) | 310 | if (res<0) |
303 | break; | 311 | break; |
304 | res=class_device_create_file(&vdev->class_dev, | 312 | res = device_create_file(&vdev->class_dev, |
305 | &class_device_attr_model); | 313 | &dev_attr_model); |
306 | if (res<0) | 314 | if (res<0) |
307 | break; | 315 | break; |
308 | res=class_device_create_file(&vdev->class_dev, | 316 | res = device_create_file(&vdev->class_dev, |
309 | &class_device_attr_hue); | 317 | &dev_attr_hue); |
310 | if (res<0) | 318 | if (res<0) |
311 | break; | 319 | break; |
312 | res=class_device_create_file(&vdev->class_dev, | 320 | res = device_create_file(&vdev->class_dev, |
313 | &class_device_attr_contrast); | 321 | &dev_attr_contrast); |
314 | if (res<0) | 322 | if (res<0) |
315 | break; | 323 | break; |
316 | res=class_device_create_file(&vdev->class_dev, | 324 | res = device_create_file(&vdev->class_dev, |
317 | &class_device_attr_brightness); | 325 | &dev_attr_brightness); |
318 | if (res<0) | 326 | if (res<0) |
319 | break; | 327 | break; |
320 | res=class_device_create_file(&vdev->class_dev, | 328 | res = device_create_file(&vdev->class_dev, |
321 | &class_device_attr_saturation); | 329 | &dev_attr_saturation); |
322 | if (res<0) | 330 | if (res<0) |
323 | break; | 331 | break; |
324 | res=class_device_create_file(&vdev->class_dev, | 332 | res = device_create_file(&vdev->class_dev, |
325 | &class_device_attr_streaming); | 333 | &dev_attr_streaming); |
326 | if (res<0) | 334 | if (res<0) |
327 | break; | 335 | break; |
328 | res=class_device_create_file(&vdev->class_dev, | 336 | res = device_create_file(&vdev->class_dev, |
329 | &class_device_attr_compression); | 337 | &dev_attr_compression); |
330 | if (res<0) | 338 | if (res<0) |
331 | break; | 339 | break; |
332 | res=class_device_create_file(&vdev->class_dev, | 340 | res = device_create_file(&vdev->class_dev, |
333 | &class_device_attr_bridge); | 341 | &dev_attr_bridge); |
334 | if (res>=0) | 342 | if (res>=0) |
335 | return; | 343 | return; |
336 | } while (0); | 344 | } while (0); |
@@ -341,24 +349,24 @@ static void usbvision_create_sysfs(struct video_device *vdev) | |||
341 | static void usbvision_remove_sysfs(struct video_device *vdev) | 349 | static void usbvision_remove_sysfs(struct video_device *vdev) |
342 | { | 350 | { |
343 | if (vdev) { | 351 | if (vdev) { |
344 | class_device_remove_file(&vdev->class_dev, | 352 | device_remove_file(&vdev->class_dev, |
345 | &class_device_attr_version); | 353 | &dev_attr_version); |
346 | class_device_remove_file(&vdev->class_dev, | 354 | device_remove_file(&vdev->class_dev, |
347 | &class_device_attr_model); | 355 | &dev_attr_model); |
348 | class_device_remove_file(&vdev->class_dev, | 356 | device_remove_file(&vdev->class_dev, |
349 | &class_device_attr_hue); | 357 | &dev_attr_hue); |
350 | class_device_remove_file(&vdev->class_dev, | 358 | device_remove_file(&vdev->class_dev, |
351 | &class_device_attr_contrast); | 359 | &dev_attr_contrast); |
352 | class_device_remove_file(&vdev->class_dev, | 360 | device_remove_file(&vdev->class_dev, |
353 | &class_device_attr_brightness); | 361 | &dev_attr_brightness); |
354 | class_device_remove_file(&vdev->class_dev, | 362 | device_remove_file(&vdev->class_dev, |
355 | &class_device_attr_saturation); | 363 | &dev_attr_saturation); |
356 | class_device_remove_file(&vdev->class_dev, | 364 | device_remove_file(&vdev->class_dev, |
357 | &class_device_attr_streaming); | 365 | &dev_attr_streaming); |
358 | class_device_remove_file(&vdev->class_dev, | 366 | device_remove_file(&vdev->class_dev, |
359 | &class_device_attr_compression); | 367 | &dev_attr_compression); |
360 | class_device_remove_file(&vdev->class_dev, | 368 | device_remove_file(&vdev->class_dev, |
361 | &class_device_attr_bridge); | 369 | &dev_attr_bridge); |
362 | } | 370 | } |
363 | } | 371 | } |
364 | 372 | ||