> From: Felipe Balbi [mailto:balbi@xxxxxx] > Sent: Wednesday, September 28, 2011 3:30 AM > > Hi, > > On Tue, Sep 27, 2011 at 10:53:32PM -0700, Paul Zimmerman wrote: > > Fix offset calculation in dwc3_trb_dma_offset() > > > > Signed-off-by: Paul Zimmerman <paulz@xxxxxxxxxxxx> > > --- > > drivers/usb/dwc3/gadget.c | 2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c > > index 5283956..2c68934 100644 > > --- a/drivers/usb/dwc3/gadget.c > > +++ b/drivers/usb/dwc3/gadget.c > > @@ -189,7 +189,7 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep, > > static dma_addr_t dwc3_trb_dma_offset(struct dwc3_ep *dep, > > struct dwc3_trb_hw *trb) > > { > > - u32 offset = trb - dep->trb_pool; > > + u32 offset = (char *)trb - (char *)dep->trb_pool; > > Have you really seen anything wrong with this ? Also, I'm not sure a > char would be good here. Maybe unsigned long would be better. Also, > don't change the alignment :-) Yes, I definitely saw something wrong with this. The DMA address for the first TRB was <address>, and for the second TRB it was <address> + 1, where it should have been <address> + 16. For some reason it only showed up after a disconnect/reconnect cycle, but it was definitely wrong. Not sure what you mean about unsigned long and alignment. This is pretty basic pointer math, I think the way I did it is the correct fix. The other alternative would be (trb - dep->trb_pool) * sizeof(struct dwc3_trb_hw), but I like mine better. -- Paul ��.n��������+%������w��{.n�����{���)��jg��������ݢj����G�������j:+v���w�m������w�������h�����٥