Re: [PATCH v3 3/4] xhci: Fix errors in the running total calculations in the TRB math

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

 



On Mon, Feb 14, 2011 at 02:56:15PM -0800, Paul Zimmerman wrote:
> From: Alan Stern [mailto:stern@xxxxxxxxxxxxxxxxxxx] 
> > > --- a/drivers/usb/host/xhci-ring.c
> > > +++ b/drivers/usb/host/xhci-ring.c
> > > @@ -2375,6 +2375,7 @@ static unsigned int count_sg_trbs_needed(struct xhci_hcd *xhci, struct urb *urb)
> > >  		/* Scatter gather list entries may cross 64KB boundaries */
> > >  		running_total = TRB_MAX_BUFF_SIZE -
> > >  			(sg_dma_address(sg) & (TRB_MAX_BUFF_SIZE - 1));
> > > +		running_total &= TRB_MAX_BUFF_SIZE - 1;
> > 
> > It be a lot simpler to replace these two expressions with:
> > 
> > 	running_total = (- sg_dma_address(sg)) & (TRB_MAX_BUFF_SIZE - 1);
> > 
> > However this might not be very comprehensible.  As a compromise, you 
> > could use:
> > 
> > 	running_total = (TRB_MAX_BUFF_SIZE - sg_dma_address(sg)) &
> > 			(TRB_MAX_BUFF_SIZE - 1);
> 
> Sarah, what do you think? I would prefer to get the current patches into 
> the kernel, since they have been well-tested. I could make either of the
> modifications Alan is recommending as a cleanup patch on top of that.

Cleanup patches are fine later.  I'll queue these.

Sarah Sharp
--
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