From: Felipe Balbi <felipe.balbi@linux.intel.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Linux USB <linux-usb@vger.kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org
Subject: Re: [RFC/PATCH 14/45] media: usb: uvc: make use of new usb_endpoint_maxp_mult()
Date: Thu, 29 Sep 2016 12:44:29 +0300 [thread overview]
Message-ID: <87d1jnoxaa.fsf@linux.intel.com> (raw)
In-Reply-To: <2520132.9qLLxPy19B@avalon>
[-- Attachment #1: Type: text/plain, Size: 2272 bytes --]
Hi,
Laurent Pinchart <laurent.pinchart@ideasonboard.com> writes:
> Hi Felipe,
>
> Thanks for the patch.
>
> On Wednesday 28 Sep 2016 16:05:23 Felipe Balbi wrote:
>> We have introduced a helper to calculate multiplier
>> value from wMaxPacketSize. Start using it.
>>
>> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
>> Cc: <linux-media@vger.kernel.org>
>> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
>> ---
>> drivers/media/usb/uvc/uvc_video.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/usb/uvc/uvc_video.c
>> b/drivers/media/usb/uvc/uvc_video.c index b5589d5f5da4..11e0e5f4e1c2 100644
>> --- a/drivers/media/usb/uvc/uvc_video.c
>> +++ b/drivers/media/usb/uvc/uvc_video.c
>> @@ -1467,6 +1467,7 @@ static unsigned int uvc_endpoint_max_bpi(struct
>> usb_device *dev, struct usb_host_endpoint *ep)
>> {
>> u16 psize;
>> + u16 mult;
>>
>> switch (dev->speed) {
>> case USB_SPEED_SUPER:
>> @@ -1474,7 +1475,8 @@ static unsigned int uvc_endpoint_max_bpi(struct
>> usb_device *dev, return le16_to_cpu(ep->ss_ep_comp.wBytesPerInterval);
>> case USB_SPEED_HIGH:
>> psize = usb_endpoint_maxp(&ep->desc);
>> - return (psize & 0x07ff) * (1 + ((psize >> 11) & 3));
>> + mult = usb_endpoint_maxp_mult(&ep->desc);
>> + return (psize & 0x07ff) * mult;
>
> I believe you can remove the & 0x07ff here after patch 28/45.
>
> This being said, wouldn't it be useful to introduce a helper function that
> performs the full computation instead of requiring usage of two helpers that
> both call __le16_to_cpu() on the same field ? Or possibly turn the whole
> uvc_endpoint_max_bpi() function into a core helper ? I haven't checked whether
> it can be useful to other drivers though.
it's probably not useful for many other drivers. The multiplier is only
valid for High-speed Isochronous and Interrupt endpoints. If it's not
High speed, we don't care. If it's not Isoc or Int, we don't care.
If we have a single helper, we are likely gonna be doing extra
computation for no reason. Moreover, this is only called once during
probe(), there's really nothing to optimize here.
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]
next prev parent reply other threads:[~2016-09-29 9:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20160928130554.29790-1-felipe.balbi@linux.intel.com>
2016-09-28 13:05 ` [RFC/PATCH 02/45] usb: gadget: composite: correctly initialize ep->maxpacket Felipe Balbi
2016-09-28 13:05 ` [RFC/PATCH 03/45] usb: gadget: composite: always set ep->mult to a sensible value Felipe Balbi
2016-09-28 13:05 ` [RFC/PATCH 04/45] usb: dwc3: gadget: set PCM1 field of isochronous-first TRBs Felipe Balbi
2016-09-28 13:05 ` [RFC/PATCH 13/45] media: usbtv: core: make use of new usb_endpoint_maxp_mult() Felipe Balbi
2016-09-28 13:05 ` [RFC/PATCH 14/45] media: usb: uvc: " Felipe Balbi
2016-09-29 9:18 ` Laurent Pinchart
2016-09-29 9:44 ` Felipe Balbi [this message]
2016-09-28 13:05 ` [RFC/PATCH 20/45] usb: gadget: udc: fsl: " Felipe Balbi
2016-09-28 13:05 ` [RFC/PATCH 30/45] media: usb: uvc: remove unnecessary & operation Felipe Balbi
2016-09-29 9:19 ` Laurent Pinchart
2016-09-28 13:05 ` [RFC/PATCH 43/45] usb: gadget: udc: fsl: " Felipe Balbi
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=87d1jnoxaa.fsf@linux.intel.com \
--to=felipe.balbi@linux.intel.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mchehab@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.