webcam.c (4ba24fef3eb3b142197135223b90ced2f319cd53) | webcam.c (c94e289f195e0e13cf34d27f9338d28221a85751) |
---|---|
1/* 2 * webcam.c -- USB webcam gadget driver 3 * 4 * Copyright (C) 2009-2010 5 * Laurent Pinchart (laurent.pinchart@ideasonboard.com) 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by --- 320 unchanged lines hidden (view full) --- 329 (const struct uvc_descriptor_header *) &uvc_color_matching, 330 NULL, 331}; 332 333/* -------------------------------------------------------------------------- 334 * USB configuration 335 */ 336 | 1/* 2 * webcam.c -- USB webcam gadget driver 3 * 4 * Copyright (C) 2009-2010 5 * Laurent Pinchart (laurent.pinchart@ideasonboard.com) 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by --- 320 unchanged lines hidden (view full) --- 329 (const struct uvc_descriptor_header *) &uvc_color_matching, 330 NULL, 331}; 332 333/* -------------------------------------------------------------------------- 334 * USB configuration 335 */ 336 |
337static int __init | 337static int |
338webcam_config_bind(struct usb_configuration *c) 339{ 340 int status = 0; 341 342 f_uvc = usb_get_function(fi_uvc); 343 if (IS_ERR(f_uvc)) 344 return PTR_ERR(f_uvc); 345 --- 7 unchanged lines hidden (view full) --- 353static struct usb_configuration webcam_config_driver = { 354 .label = webcam_config_label, 355 .bConfigurationValue = 1, 356 .iConfiguration = 0, /* dynamic */ 357 .bmAttributes = USB_CONFIG_ATT_SELFPOWER, 358 .MaxPower = CONFIG_USB_GADGET_VBUS_DRAW, 359}; 360 | 338webcam_config_bind(struct usb_configuration *c) 339{ 340 int status = 0; 341 342 f_uvc = usb_get_function(fi_uvc); 343 if (IS_ERR(f_uvc)) 344 return PTR_ERR(f_uvc); 345 --- 7 unchanged lines hidden (view full) --- 353static struct usb_configuration webcam_config_driver = { 354 .label = webcam_config_label, 355 .bConfigurationValue = 1, 356 .iConfiguration = 0, /* dynamic */ 357 .bmAttributes = USB_CONFIG_ATT_SELFPOWER, 358 .MaxPower = CONFIG_USB_GADGET_VBUS_DRAW, 359}; 360 |
361static int /* __init_or_exit */ | 361static int |
362webcam_unbind(struct usb_composite_dev *cdev) 363{ 364 if (!IS_ERR_OR_NULL(f_uvc)) 365 usb_put_function(f_uvc); 366 if (!IS_ERR_OR_NULL(fi_uvc)) 367 usb_put_function_instance(fi_uvc); 368 return 0; 369} 370 | 362webcam_unbind(struct usb_composite_dev *cdev) 363{ 364 if (!IS_ERR_OR_NULL(f_uvc)) 365 usb_put_function(f_uvc); 366 if (!IS_ERR_OR_NULL(fi_uvc)) 367 usb_put_function_instance(fi_uvc); 368 return 0; 369} 370 |
371static int __init | 371static int |
372webcam_bind(struct usb_composite_dev *cdev) 373{ 374 struct f_uvc_opts *uvc_opts; 375 int ret; 376 377 fi_uvc = usb_get_function_instance("uvc"); 378 if (IS_ERR(fi_uvc)) 379 return PTR_ERR(fi_uvc); --- 37 unchanged lines hidden (view full) --- 417 usb_put_function_instance(fi_uvc); 418 return ret; 419} 420 421/* -------------------------------------------------------------------------- 422 * Driver 423 */ 424 | 372webcam_bind(struct usb_composite_dev *cdev) 373{ 374 struct f_uvc_opts *uvc_opts; 375 int ret; 376 377 fi_uvc = usb_get_function_instance("uvc"); 378 if (IS_ERR(fi_uvc)) 379 return PTR_ERR(fi_uvc); --- 37 unchanged lines hidden (view full) --- 417 usb_put_function_instance(fi_uvc); 418 return ret; 419} 420 421/* -------------------------------------------------------------------------- 422 * Driver 423 */ 424 |
425static __refdata struct usb_composite_driver webcam_driver = { | 425static struct usb_composite_driver webcam_driver = { |
426 .name = "g_webcam", 427 .dev = &webcam_device_descriptor, 428 .strings = webcam_device_strings, 429 .max_speed = USB_SPEED_SUPER, 430 .bind = webcam_bind, 431 .unbind = webcam_unbind, 432}; 433 434module_usb_composite_driver(webcam_driver); 435 436MODULE_AUTHOR("Laurent Pinchart"); 437MODULE_DESCRIPTION("Webcam Video Gadget"); 438MODULE_LICENSE("GPL"); 439MODULE_VERSION("0.1.0"); 440 | 426 .name = "g_webcam", 427 .dev = &webcam_device_descriptor, 428 .strings = webcam_device_strings, 429 .max_speed = USB_SPEED_SUPER, 430 .bind = webcam_bind, 431 .unbind = webcam_unbind, 432}; 433 434module_usb_composite_driver(webcam_driver); 435 436MODULE_AUTHOR("Laurent Pinchart"); 437MODULE_DESCRIPTION("Webcam Video Gadget"); 438MODULE_LICENSE("GPL"); 439MODULE_VERSION("0.1.0"); 440 |