2021-06-23 10:04:35

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH RFC] usb: renesas_usbhs: fifo: : use proper DMAENGINE API for termination

dmaengine_terminate_all() is deprecated in favor of explicitly saying if
it should be sync or async. Here, we want dmaengine_terminate_sync()
because there is no other synchronization code in the driver to handle
an async case.

Signed-off-by: Wolfram Sang <[email protected]>
---

Shimoda-san, can you please double check if this works with the
additional locking in this function? Thank you!

drivers/usb/renesas_usbhs/fifo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
index b5e7991dc7d9..6176f2325f03 100644
--- a/drivers/usb/renesas_usbhs/fifo.c
+++ b/drivers/usb/renesas_usbhs/fifo.c
@@ -121,7 +121,7 @@ struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt)
if (fifo)
chan = usbhsf_dma_chan_get(fifo, pkt);
if (chan) {
- dmaengine_terminate_all(chan);
+ dmaengine_terminate_sync(chan);
usbhsf_dma_unmap(pkt);
}

--
2.30.2


2021-06-24 01:28:15

by Yoshihiro Shimoda

[permalink] [raw]
Subject: RE: [PATCH RFC] usb: renesas_usbhs: fifo: : use proper DMAENGINE API for termination

Hi Wolfram-san,

> From: Wolfram Sang, Sent: Wednesday, June 23, 2021 7:03 PM
>
> dmaengine_terminate_all() is deprecated in favor of explicitly saying if
> it should be sync or async. Here, we want dmaengine_terminate_sync()
> because there is no other synchronization code in the driver to handle
> an async case.
>
> Signed-off-by: Wolfram Sang <[email protected]>
> ---
>
> Shimoda-san, can you please double check if this works with the
> additional locking in this function? Thank you!

Thank you for the patch! I checked and tested this patch and worked
correctly on my environment.
# To be honest, both shdma and usb-dmac driver doesn't support .device_synchronize
# so that _async() is enough for now.

However, I have a concern which this patch will conflict my fixed patch [1].

[1]
https://lore.kernel.org/linux-renesas-soc/[email protected]/

Since I caused a trouble [2], the patch [1] was not merged yet.
So, I intended to resend the patch in near the future.

[2]
https://lore.kernel.org/linux-renesas-soc/TY2PR01MB3692555C6EAC8F02BC8B3D63D8329@TY2PR01MB3692.jpnprd01.prod.outlook.com/

In backporting point of view, I guess it's better to apply my fixed patch at first,
and then apply this DMAENGINE patch. But, what do you think?

Best regards,
Yoshihiro Shimoda

> drivers/usb/renesas_usbhs/fifo.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
> index b5e7991dc7d9..6176f2325f03 100644
> --- a/drivers/usb/renesas_usbhs/fifo.c
> +++ b/drivers/usb/renesas_usbhs/fifo.c
> @@ -121,7 +121,7 @@ struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt)
> if (fifo)
> chan = usbhsf_dma_chan_get(fifo, pkt);
> if (chan) {
> - dmaengine_terminate_all(chan);
> + dmaengine_terminate_sync(chan);
> usbhsf_dma_unmap(pkt);
> }
> --
> 2.30.2

2021-06-24 05:55:04

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH RFC] usb: renesas_usbhs: fifo: : use proper DMAENGINE API for termination

Hi Shimoda-san,

> In backporting point of view, I guess it's better to apply my fixed patch at first,
> and then apply this DMAENGINE patch. But, what do you think?

Yes, I agree. Could you kindly notify me when your patch is accepted
upstream? Or CC me on your patch?

Thank you and kind regards,

Wolfram


Attachments:
(No filename) (324.00 B)
signature.asc (849.00 B)
Download all attachments

2021-06-24 10:37:38

by Yoshihiro Shimoda

[permalink] [raw]
Subject: RE: [PATCH RFC] usb: renesas_usbhs: fifo: : use proper DMAENGINE API for termination

Hi Wolfram-san,

> From: Wolfram Sang, Sent: Thursday, June 24, 2021 2:54 PM
>
> Hi Shimoda-san,
>
> > In backporting point of view, I guess it's better to apply my fixed patch at first,
> > and then apply this DMAENGINE patch. But, what do you think?
>
> Yes, I agree. Could you kindly notify me when your patch is accepted
> upstream? Or CC me on your patch?

Thank you for your reply! I'll resend a patch with your email address on CC.

Best regards,
Yoshihiro Shimoda