[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231012142859.GC1010588@nchen-desktop>
Date: Thu, 12 Oct 2023 22:28:59 +0800
From: Peter Chen <peter.chen@...nel.org>
To: Thierry Reding <thierry.reding@...il.com>
Cc: Michał Mirosław <mirq-linux@...e.qmqm.pl>,
Peter Geis <pgwipeout@...il.com>,
Dmitry Osipenko <digetx@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Thierry Reding <treding@...dia.com>,
linux-kernel@...r.kernel.org, linux-tegra@...r.kernel.org,
linux-usb@...r.kernel.org
Subject: Re: [PATCH v2 2/3] usb: chipidea: Simplify Tegra DMA alignment code
On 23-10-11 23:53:28, Thierry Reding wrote:
> On Thu, Sep 28, 2023 at 11:06:03PM +0200, Michał Mirosław wrote:
> > The USB host on Tegra3 works with 32-bit alignment. Previous code tried
> > to align the buffer, but it did align the wrapper struct instead, so
> > the buffer was at a constant offset of 8 bytes (two pointers) from
> > expected alignment. Since kmalloc() guarantees at least 8-byte
> > alignment already, the alignment-extending is removed.
> >
> > Fixes: fc53d5279094 ("usb: chipidea: tegra: Support host mode")
> > Signed-off-by: Michał Mirosław <mirq-linux@...e.qmqm.pl>
> > ---
> > drivers/usb/chipidea/host.c | 45 +++++++++++++++----------------------
> > 1 file changed, 18 insertions(+), 27 deletions(-)
> >
> > diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
> > index abddd39d1ff1..0cce19208370 100644
> > --- a/drivers/usb/chipidea/host.c
> > +++ b/drivers/usb/chipidea/host.c
> > @@ -30,8 +30,7 @@ struct ehci_ci_priv {
> > };
> >
> > struct ci_hdrc_dma_aligned_buffer {
> > - void *kmalloc_ptr;
> > - void *old_xfer_buffer;
> > + void *original_buffer;
> > u8 data[];
> > };
> >
> > @@ -380,60 +379,52 @@ static int ci_ehci_bus_suspend(struct usb_hcd *hcd)
> > return 0;
> > }
> >
> > -static void ci_hdrc_free_dma_aligned_buffer(struct urb *urb)
> > +static void ci_hdrc_free_dma_aligned_buffer(struct urb *urb, bool copy_back)
> > {
> > struct ci_hdrc_dma_aligned_buffer *temp;
> > - size_t length;
> >
> > if (!(urb->transfer_flags & URB_ALIGNED_TEMP_BUFFER))
> > return;
> > + urb->transfer_flags &= ~URB_ALIGNED_TEMP_BUFFER;
>
> This threw me off a bit until I realized it was already there
> previously, just in a different place. Is there a particular reason why
> this is moved?
>
> Regardless, this looks fine, so:
>
> Acked-by: Thierry Reding <treding@...dia.com>
Acked-by: Peter Chen <peter.chen@...nel.org>
--
Thanks,
Peter Chen
Powered by blists - more mailing lists