Re: [RFC/PATCH 24/45] usb: host: ehci: make use of new usb_endpoint_maxp_mult()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 30 Sep 2016, Felipe Balbi wrote:

> > There are lots of other places where the new helpers might be used.  
> > Search for "max_packet" and "hb_mult" in ehci-q.c and ehci-sched.c.
> 
> Here's a new version:

Looks good in general.  I have just two comments...

> 8<------------------------------------------------------------------------------
> From f4daa62bbbd1c03e349e576aef8f2a5f039afb1a Mon Sep 17 00:00:00 2001
> From: Felipe Balbi <felipe.balbi@xxxxxxxxxxxxxxx>
> Date: Wed, 28 Sep 2016 13:38:18 +0300
> Subject: [PATCH] usb: host: ehci: make use of new usb_endpoint_maxp_mult()
> 
> We have introduced a helper to calculate multiplier
> value from wMaxPacketSize. Start using it.
> 
> Cc: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> Cc: <linux-usb@xxxxxxxxxxxxxxx>
> Signed-off-by: Felipe Balbi <felipe.balbi@xxxxxxxxxxxxxxx>
> ---
>  drivers/usb/host/ehci-q.c     | 10 ++++++----
>  drivers/usb/host/ehci-sched.c |  2 +-
>  2 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
> index eca3710d8fc4..a45a5dc7ed9f 100644
> --- a/drivers/usb/host/ehci-q.c
> +++ b/drivers/usb/host/ehci-q.c
> @@ -550,8 +550,6 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
>  
>  /*-------------------------------------------------------------------------*/
>  
> -// high bandwidth multiplier, as encoded in highspeed endpoint descriptors
> -#define hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03))
>  // ... and packet size, for any kind of endpoint descriptor
>  #define max_packet(wMaxPacketSize) ((wMaxPacketSize) & 0x07ff)
>  
> @@ -770,9 +768,11 @@ qh_make (
>  	gfp_t			flags
>  ) {
>  	struct ehci_qh		*qh = ehci_qh_alloc (ehci, flags);
> +	struct usb_host_endpoint *ep;
>  	u32			info1 = 0, info2 = 0;
>  	int			is_input, type;
>  	int			maxp = 0;
> +	int			mult;
>  	struct usb_tt		*tt = urb->dev->tt;
>  	struct ehci_qh_hw	*hw;
>  
> @@ -787,7 +787,9 @@ qh_make (
>  
>  	is_input = usb_pipein (urb->pipe);
>  	type = usb_pipetype (urb->pipe);
> +	ep = usb_pipe_endpoint (urb->dev, urb->pipe);

You don't need to compute this; you can use urb->ep directly.

Also, my policy is not to put a space before the open paren in a
function call (Dave's original style) when adding new code or updating
existing code.

Otherwise it's good.  Thank you.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux