Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: gadget: f_uvc: remove compatibility layer

There are no users of the old interface left. Remove it.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Tested-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>

authored by

Andrzej Pietrasiewicz and committed by
Felipe Balbi
cb47d889 c913881e

-177
-166
drivers/usb/gadget/function/f_uvc.c
··· 33 33 #include "u_uvc.h" 34 34 35 35 unsigned int uvc_gadget_trace_param; 36 - #ifdef USBF_UVC_INCLUDED 37 - static unsigned int streaming_interval; 38 - static unsigned int streaming_maxpacket; 39 - static unsigned int streaming_maxburst; 40 - #endif 41 36 42 37 /* -------------------------------------------------------------------------- 43 38 * Function descriptors ··· 197 202 NULL, 198 203 }; 199 204 200 - #ifndef USBF_UVC_INCLUDED 201 - 202 205 void uvc_set_trace_param(unsigned int trace) 203 206 { 204 207 uvc_gadget_trace_param = trace; 205 208 } 206 209 EXPORT_SYMBOL(uvc_set_trace_param); 207 - 208 - #endif 209 210 210 211 /* -------------------------------------------------------------------------- 211 212 * Control requests ··· 557 566 return hdr; 558 567 } 559 568 560 - #ifdef USBF_UVC_INCLUDED 561 - static void 562 - uvc_function_unbind(struct usb_configuration *c, struct usb_function *f) 563 - { 564 - struct usb_composite_dev *cdev = c->cdev; 565 - struct uvc_device *uvc = to_uvc(f); 566 - 567 - INFO(cdev, "uvc_function_unbind\n"); 568 - 569 - video_unregister_device(uvc->vdev); 570 - v4l2_device_unregister(&uvc->v4l2_dev); 571 - uvc->control_ep->driver_data = NULL; 572 - uvc->video.ep->driver_data = NULL; 573 - 574 - uvc_en_us_strings[UVC_STRING_CONTROL_IDX].id = 0; 575 - usb_ep_free_request(cdev->gadget->ep0, uvc->control_req); 576 - kfree(uvc->control_buf); 577 - 578 - usb_free_all_descriptors(f); 579 - 580 - kfree(uvc); 581 - } 582 - #endif 583 - 584 569 static int 585 570 uvc_function_bind(struct usb_configuration *c, struct usb_function *f) 586 571 { ··· 565 598 unsigned int max_packet_mult; 566 599 unsigned int max_packet_size; 567 600 struct usb_ep *ep; 568 - #ifndef USBF_UVC_INCLUDED 569 601 struct f_uvc_opts *opts; 570 - #endif 571 602 int ret = -EINVAL; 572 603 573 604 INFO(cdev, "uvc_function_bind\n"); 574 605 575 - #ifdef USBF_UVC_INCLUDED 576 - /* Sanity check the streaming endpoint module parameters. 577 - */ 578 - streaming_interval = clamp(streaming_interval, 1U, 16U); 579 - streaming_maxpacket = clamp(streaming_maxpacket, 1U, 3072U); 580 - streaming_maxburst = min(streaming_maxburst, 15U); 581 - 582 - /* Fill in the FS/HS/SS Video Streaming specific descriptors from the 583 - * module parameters. 584 - * 585 - * NOTE: We assume that the user knows what they are doing and won't 586 - * give parameters that their UDC doesn't support. 587 - */ 588 - if (streaming_maxpacket <= 1024) { 589 - max_packet_mult = 1; 590 - max_packet_size = streaming_maxpacket; 591 - } else if (streaming_maxpacket <= 2048) { 592 - max_packet_mult = 2; 593 - max_packet_size = streaming_maxpacket / 2; 594 - } else { 595 - max_packet_mult = 3; 596 - max_packet_size = streaming_maxpacket / 3; 597 - } 598 - 599 - uvc_fs_streaming_ep.wMaxPacketSize = min(streaming_maxpacket, 1023U); 600 - uvc_fs_streaming_ep.bInterval = streaming_interval; 601 - 602 - uvc_hs_streaming_ep.wMaxPacketSize = max_packet_size; 603 - uvc_hs_streaming_ep.wMaxPacketSize |= ((max_packet_mult - 1) << 11); 604 - uvc_hs_streaming_ep.bInterval = streaming_interval; 605 - 606 - uvc_ss_streaming_ep.wMaxPacketSize = max_packet_size; 607 - uvc_ss_streaming_ep.bInterval = streaming_interval; 608 - uvc_ss_streaming_comp.bmAttributes = max_packet_mult - 1; 609 - uvc_ss_streaming_comp.bMaxBurst = streaming_maxburst; 610 - uvc_ss_streaming_comp.wBytesPerInterval = 611 - max_packet_size * max_packet_mult * streaming_maxburst; 612 - #else 613 606 opts = to_f_uvc_opts(f->fi); 614 607 /* Sanity check the streaming endpoint module parameters. 615 608 */ ··· 608 681 uvc_ss_streaming_comp.bMaxBurst = opts->streaming_maxburst; 609 682 uvc_ss_streaming_comp.wBytesPerInterval = 610 683 max_packet_size * max_packet_mult * opts->streaming_maxburst; 611 - #endif 612 684 613 685 /* Allocate endpoints. */ 614 686 ep = usb_ep_autoconfig(cdev->gadget, &uvc_control_ep); ··· 733 807 * USB gadget function 734 808 */ 735 809 736 - #ifdef USBF_UVC_INCLUDED 737 - /** 738 - * uvc_bind_config - add a UVC function to a configuration 739 - * @c: the configuration to support the UVC instance 740 - * Context: single threaded during gadget setup 741 - * 742 - * Returns zero on success, else negative errno. 743 - * 744 - * Caller must have called @uvc_setup(). Caller is also responsible for 745 - * calling @uvc_cleanup() before module unload. 746 - */ 747 - int __init 748 - uvc_bind_config(struct usb_configuration *c, 749 - const struct uvc_descriptor_header * const *fs_control, 750 - const struct uvc_descriptor_header * const *ss_control, 751 - const struct uvc_descriptor_header * const *fs_streaming, 752 - const struct uvc_descriptor_header * const *hs_streaming, 753 - const struct uvc_descriptor_header * const *ss_streaming, 754 - unsigned int stream_interv, unsigned int stream_maxpkt, 755 - unsigned int stream_maxburst, unsigned int trace) 756 - { 757 - struct uvc_device *uvc; 758 - int ret = 0; 759 - 760 - /* TODO Check if the USB device controller supports the required 761 - * features. 762 - */ 763 - if (!gadget_is_dualspeed(c->cdev->gadget)) 764 - return -EINVAL; 765 - 766 - uvc = kzalloc(sizeof(*uvc), GFP_KERNEL); 767 - if (uvc == NULL) 768 - return -ENOMEM; 769 - 770 - uvc->state = UVC_STATE_DISCONNECTED; 771 - 772 - /* Validate the descriptors. */ 773 - if (fs_control == NULL || fs_control[0] == NULL || 774 - fs_control[0]->bDescriptorSubType != UVC_VC_HEADER) 775 - goto error; 776 - 777 - if (ss_control == NULL || ss_control[0] == NULL || 778 - ss_control[0]->bDescriptorSubType != UVC_VC_HEADER) 779 - goto error; 780 - 781 - if (fs_streaming == NULL || fs_streaming[0] == NULL || 782 - fs_streaming[0]->bDescriptorSubType != UVC_VS_INPUT_HEADER) 783 - goto error; 784 - 785 - if (hs_streaming == NULL || hs_streaming[0] == NULL || 786 - hs_streaming[0]->bDescriptorSubType != UVC_VS_INPUT_HEADER) 787 - goto error; 788 - 789 - if (ss_streaming == NULL || ss_streaming[0] == NULL || 790 - ss_streaming[0]->bDescriptorSubType != UVC_VS_INPUT_HEADER) 791 - goto error; 792 - 793 - streaming_interval = stream_interv; 794 - streaming_maxpacket = stream_maxpkt; 795 - streaming_maxburst = stream_maxburst; 796 - uvc_gadget_trace_param = trace; 797 - uvc->desc.fs_control = fs_control; 798 - uvc->desc.ss_control = ss_control; 799 - uvc->desc.fs_streaming = fs_streaming; 800 - uvc->desc.hs_streaming = hs_streaming; 801 - uvc->desc.ss_streaming = ss_streaming; 802 - 803 - /* Register the function. */ 804 - uvc->func.name = "uvc"; 805 - uvc->func.strings = uvc_function_strings; 806 - uvc->func.bind = uvc_function_bind; 807 - uvc->func.unbind = uvc_function_unbind; 808 - uvc->func.get_alt = uvc_function_get_alt; 809 - uvc->func.set_alt = uvc_function_set_alt; 810 - uvc->func.disable = uvc_function_disable; 811 - uvc->func.setup = uvc_function_setup; 812 - 813 - ret = usb_add_function(c, &uvc->func); 814 - if (ret) 815 - kfree(uvc); 816 - 817 - return ret; 818 - 819 - error: 820 - kfree(uvc); 821 - return ret; 822 - } 823 - 824 - #else 825 - 826 810 static void uvc_free_inst(struct usb_function_instance *f) 827 811 { 828 812 struct f_uvc_opts *opts = to_f_uvc_opts(f); ··· 813 977 DECLARE_USB_FUNCTION_INIT(uvc, uvc_alloc_inst, uvc_alloc); 814 978 MODULE_LICENSE("GPL"); 815 979 MODULE_AUTHOR("Laurent Pinchart"); 816 - 817 - #endif
-11
drivers/usb/gadget/function/f_uvc.h
··· 24 24 25 25 void uvc_function_disconnect(struct uvc_device *uvc); 26 26 27 - int uvc_bind_config(struct usb_configuration *c, 28 - const struct uvc_descriptor_header * const *fs_control, 29 - const struct uvc_descriptor_header * const *hs_control, 30 - const struct uvc_descriptor_header * const *fs_streaming, 31 - const struct uvc_descriptor_header * const *hs_streaming, 32 - const struct uvc_descriptor_header * const *ss_streaming, 33 - unsigned int streaming_interval_webcam, 34 - unsigned int streaming_maxpacket_webcam, 35 - unsigned int streaming_maxburst_webcam, 36 - unsigned int uvc_gadget_trace_webcam); 37 - 38 27 #endif /* _F_UVC_H_ */ 39 28