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 2/3] usb: gadget: uvc: Add new disable_interrupt_ep attribute
Date: Wed, 28 Dec 2022 04:02:07 +0200 [thread overview]
Message-ID: <Y6ujn+PSrCZKgJfx@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20221205143758.1096914-3-dan.scally@ideasonboard.com>
Hi Dan,
Thank you for the patch.
On Mon, Dec 05, 2022 at 02:37:57PM +0000, Daniel Scally wrote:
> Add a new attribute to the default control config group that allows
> users to specify whether they want to disable the default interrupt
> endpoint for the VideoControl interface.
>
> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
Apart from the missing documentation, this looks good to me.
> ---
> drivers/usb/gadget/function/u_uvc.h | 2 +
> drivers/usb/gadget/function/uvc_configfs.c | 53 ++++++++++++++++++++++
> 2 files changed, 55 insertions(+)
>
> diff --git a/drivers/usb/gadget/function/u_uvc.h b/drivers/usb/gadget/function/u_uvc.h
> index 24b8681b0d6f..7e6d31a8fad7 100644
> --- a/drivers/usb/gadget/function/u_uvc.h
> +++ b/drivers/usb/gadget/function/u_uvc.h
> @@ -29,6 +29,8 @@ struct f_uvc_opts {
> unsigned int streaming_interface;
> char function_name[32];
>
> + bool disable_interrupt_ep;
> +
> /*
> * Control descriptors array pointers for full-/high-speed and
> * super-speed. They point by default to the uvc_fs_control_cls and
> diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c
> index 4303a3283ba0..644d87eee164 100644
> --- a/drivers/usb/gadget/function/uvc_configfs.c
> +++ b/drivers/usb/gadget/function/uvc_configfs.c
> @@ -716,8 +716,61 @@ static ssize_t uvcg_default_control_b_interface_number_show(
>
> UVC_ATTR_RO(uvcg_default_control_, b_interface_number, bInterfaceNumber);
>
> +static ssize_t uvcg_default_control_disable_interrupt_ep_show(
> + struct config_item *item, char *page)
> +{
> + struct config_group *group = to_config_group(item);
> + struct mutex *su_mutex = &group->cg_subsys->su_mutex;
> + struct config_item *opts_item;
> + struct f_uvc_opts *opts;
> + int result = 0;
> +
> + mutex_lock(su_mutex); /* for navigating configfs hierarchy */
> +
> + opts_item = item->ci_parent;
> + opts = to_f_uvc_opts(opts_item);
> +
> + mutex_lock(&opts->lock);
> + result += sprintf(page, "%u\n", opts->disable_interrupt_ep);
> + mutex_unlock(&opts->lock);
> +
> + mutex_unlock(su_mutex);
> +
> + return result;
> +}
> +
> +static ssize_t uvcg_default_control_disable_interrupt_ep_store(
> + struct config_item *item, const char *page, size_t len)
> +{
> + struct config_group *group = to_config_group(item);
> + struct mutex *su_mutex = &group->cg_subsys->su_mutex;
> + struct config_item *opts_item;
> + struct f_uvc_opts *opts;
> + ssize_t ret;
> + u8 num;
> +
> + ret = kstrtou8(page, 0, &num);
> + if (ret)
> + return ret;
> +
> + mutex_lock(su_mutex); /* for navigating configfs hierarchy */
> +
> + opts_item = item->ci_parent;
> + opts = to_f_uvc_opts(opts_item);
> +
> + mutex_lock(&opts->lock);
> + opts->disable_interrupt_ep = num;
> + mutex_unlock(&opts->lock);
> +
> + mutex_unlock(su_mutex);
> +
> + return len;
> +}
> +UVC_ATTR(uvcg_default_control_, disable_interrupt_ep, disable_interrupt_ep);
> +
> static struct configfs_attribute *uvcg_default_control_attrs[] = {
> &uvcg_default_control_attr_b_interface_number,
> + &uvcg_default_control_attr_disable_interrupt_ep,
> NULL,
> };
>
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2022-12-28 2:02 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
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 [this message]
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=Y6ujn+PSrCZKgJfx@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