From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Daniel Scally <dan.scally@ideasonboard.com>
Cc: linux-usb@vger.kernel.org, gregkh@linuxfoundation.org,
mgr@pengutronix.de, kieran.bingham@ideasonboard.com
Subject: Re: [PATCH 1/3] usb: gadget: uvc: Rename uvc_control_ep
Date: Wed, 28 Dec 2022 03:59:55 +0200 [thread overview]
Message-ID: <Y6ujGxxWd5ffq7qY@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20221205143758.1096914-2-dan.scally@ideasonboard.com>
Hi Dan,
Thank you for the patch.
On Mon, Dec 05, 2022 at 02:37:56PM +0000, Daniel Scally wrote:
> The f_uvc code defines an endpoint named "uvc_control_ep" but it
> is configured with a non-zero endpoint address and has its
> bmAttributes flagged as USB_ENDPOINT_XFER_INT - this cannot be the
> VideoControl interface's control endpoint, as the default endpoint
> 0 is used for that purpose. This is instead the optional interrupt
> endpoint that can be contained by a VideoControl interface.
>
> Rename the variables to make that clear.
>
> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
> ---
> drivers/usb/gadget/function/f_uvc.c | 24 ++++++++++++------------
> drivers/usb/gadget/function/uvc.h | 2 +-
> 2 files changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
> index 6e196e06181e..49b7231742d6 100644
> --- a/drivers/usb/gadget/function/f_uvc.c
> +++ b/drivers/usb/gadget/function/f_uvc.c
> @@ -86,7 +86,7 @@ static struct usb_interface_descriptor uvc_control_intf = {
> .iInterface = 0,
> };
>
> -static struct usb_endpoint_descriptor uvc_control_ep = {
> +static struct usb_endpoint_descriptor uvc_interrupt_ep = {
> .bLength = USB_DT_ENDPOINT_SIZE,
> .bDescriptorType = USB_DT_ENDPOINT,
> .bEndpointAddress = USB_DIR_IN,
> @@ -290,14 +290,14 @@ uvc_function_set_alt(struct usb_function *f, unsigned interface, unsigned alt)
> if (alt)
> return -EINVAL;
>
> - uvcg_info(f, "reset UVC Control\n");
> - usb_ep_disable(uvc->control_ep);
> + uvcg_info(f, "reset UVC interrupt endpoint\n");
> + usb_ep_disable(uvc->interrupt_ep);
Technically it's called the "VideoControl Interrupt Endpoint", but that
would be quite long, and given that UVC has a single interrupt endpoint
in all interfaces, I think the name is fine.
>
> - if (!uvc->control_ep->desc)
> - if (config_ep_by_speed(cdev->gadget, f, uvc->control_ep))
> + if (!uvc->interrupt_ep->desc)
> + if (config_ep_by_speed(cdev->gadget, f, uvc->interrupt_ep))
> return -EINVAL;
>
> - usb_ep_enable(uvc->control_ep);
> + usb_ep_enable(uvc->interrupt_ep);
>
> if (uvc->state == UVC_STATE_DISCONNECTED) {
> memset(&v4l2_event, 0, sizeof(v4l2_event));
> @@ -375,7 +375,7 @@ uvc_function_disable(struct usb_function *f)
> uvc->state = UVC_STATE_DISCONNECTED;
>
> usb_ep_disable(uvc->video.ep);
> - usb_ep_disable(uvc->control_ep);
> + usb_ep_disable(uvc->interrupt_ep);
> }
>
> /* --------------------------------------------------------------------------
> @@ -511,7 +511,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
> * uvc_iad
> * uvc_control_intf
> * Class-specific UVC control descriptors
> - * uvc_control_ep
> + * uvc_interrupt_ep
> * uvc_control_cs_ep
> * uvc_ss_control_comp (for SS only)
Shouldn't you also rename those two variables ?
Ideally I would also rename struct uvc_control_endpoint_descriptor and
UVC_DT_CONTROL_ENDPOINT_SIZE, but those are exposed to userspace :-(
> * uvc_streaming_intf_alt0
> @@ -523,7 +523,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
> control_size = 0;
> streaming_size = 0;
> bytes = uvc_iad.bLength + uvc_control_intf.bLength
> - + uvc_control_ep.bLength + uvc_control_cs_ep.bLength
> + + uvc_interrupt_ep.bLength + uvc_control_cs_ep.bLength
> + uvc_streaming_intf_alt0.bLength;
>
> if (speed == USB_SPEED_SUPER) {
> @@ -569,7 +569,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
> uvc_control_header->bInCollection = 1;
> uvc_control_header->baInterfaceNr[0] = uvc->streaming_intf;
>
> - UVC_COPY_DESCRIPTOR(mem, dst, &uvc_control_ep);
> + UVC_COPY_DESCRIPTOR(mem, dst, &uvc_interrupt_ep);
> if (speed == USB_SPEED_SUPER)
> UVC_COPY_DESCRIPTOR(mem, dst, &uvc_ss_control_comp);
>
> @@ -656,12 +656,12 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
> (opts->streaming_maxburst + 1));
>
> /* Allocate endpoints. */
> - ep = usb_ep_autoconfig(cdev->gadget, &uvc_control_ep);
> + ep = usb_ep_autoconfig(cdev->gadget, &uvc_interrupt_ep);
> if (!ep) {
> uvcg_info(f, "Unable to allocate control EP\n");
> goto error;
> }
> - uvc->control_ep = ep;
> + uvc->interrupt_ep = ep;
>
> if (gadget_is_superspeed(c->cdev->gadget))
> ep = usb_ep_autoconfig_ss(cdev->gadget, &uvc_ss_streaming_ep,
> diff --git a/drivers/usb/gadget/function/uvc.h b/drivers/usb/gadget/function/uvc.h
> index 40226b1f7e14..48b71e04c2b1 100644
> --- a/drivers/usb/gadget/function/uvc.h
> +++ b/drivers/usb/gadget/function/uvc.h
> @@ -146,7 +146,7 @@ struct uvc_device {
> } desc;
>
> unsigned int control_intf;
> - struct usb_ep *control_ep;
> + struct usb_ep *interrupt_ep;
> struct usb_request *control_req;
> void *control_buf;
>
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2022-12-28 2:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-05 14:37 [PATCH 0/3] Add ability to disable UVC Gadget's interrupt endpoint Daniel Scally
2022-12-05 14:37 ` [PATCH 1/3] usb: gadget: uvc: Rename uvc_control_ep Daniel Scally
2022-12-08 15:33 ` Greg KH
2022-12-08 15:39 ` Dan Scally
2022-12-28 1:59 ` Laurent Pinchart [this message]
2023-01-01 20:25 ` Dan Scally
2022-12-05 14:37 ` [PATCH 2/3] usb: gadget: uvc: Add new disable_interrupt_ep attribute Daniel Scally
2022-12-08 15:32 ` Greg KH
2022-12-28 2:02 ` Laurent Pinchart
2022-12-05 14:37 ` [PATCH 3/3] usb: gadget: uvc: Allow disabling of interrupt endpoint Daniel Scally
2022-12-28 2:09 ` Laurent Pinchart
2023-01-01 20:46 ` Dan Scally
2023-01-02 10:24 ` Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y6ujGxxWd5ffq7qY@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=dan.scally@ideasonboard.com \
--cc=gregkh@linuxfoundation.org \
--cc=kieran.bingham@ideasonboard.com \
--cc=linux-usb@vger.kernel.org \
--cc=mgr@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox