usb: gadget: renesas_usbhs: move done callback to struct usbhs_pkt
transfer done function was registered in struct struct usbhs_pipe_info.
It was good for mod_gadget, but not good for mod_host.
This function move it to struct usbhs_pkt.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
index 9bf3a43..8b40726 100644
--- a/drivers/usb/renesas_usbhs/fifo.c
+++ b/drivers/usb/renesas_usbhs/fifo.c
@@ -54,6 +54,8 @@
};
void usbhs_pkt_push(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt,
+ void (*done)(struct usbhs_priv *priv,
+ struct usbhs_pkt *pkt),
void *buf, int len, int zero)
{
struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
@@ -63,6 +65,11 @@
/******************** spin lock ********************/
usbhs_lock(priv, flags);
+ if (!done) {
+ dev_err(dev, "no done function\n");
+ return;
+ }
+
if (!pipe->handler) {
dev_err(dev, "no handler function\n");
pipe->handler = &usbhsf_null_handler;
@@ -82,6 +89,7 @@
pkt->length = len;
pkt->zero = zero;
pkt->actual = 0;
+ pkt->done = done;
usbhs_unlock(priv, flags);
/******************** spin unlock ******************/
@@ -131,7 +139,6 @@
static int usbhsf_pkt_handler(struct usbhs_pipe *pipe, int type)
{
struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
- struct usbhs_pipe_info *info = usbhs_priv_to_pipeinfo(priv);
struct usbhs_pkt *pkt;
struct device *dev = usbhs_priv_to_dev(priv);
int (*func)(struct usbhs_pkt *pkt, int *is_done);
@@ -171,7 +178,7 @@
/******************** spin unlock ******************/
if (is_done) {
- info->done(priv, pkt);
+ pkt->done(priv, pkt);
usbhs_pkt_start(pipe);
}