diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2011-06-06 14:18:16 +0900 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-06-07 09:10:08 -0700 |
commit | 6acb95d4e0709a582023e87f9b3537fb4d837fd0 (patch) | |
tree | 635562ba3b0c219fbc08d6880fe2e64c2e3d1b31 /drivers/usb/renesas_usbhs/fifo.c | |
parent | 4bd0481152d0d5e8326d7e24329b0069713ed718 (diff) |
usb: renesas_usbhs: modify packet queue control method
Current renesas_usbhs driver is controlling packet queue on mod_gadget.c.
But it has relationship with pipe/fifo, not host/gadget.
So, controlling USB packet queue in pipe.c/fifo.c is
more convenient than in mod_gadget.c.
This patch modify it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/renesas_usbhs/fifo.c')
-rw-r--r-- | drivers/usb/renesas_usbhs/fifo.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index 09838848981..088bfd787e4 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c @@ -22,17 +22,40 @@ /* * packet info function */ -void usbhs_pkt_update(struct usbhs_pkt *pkt, - struct usbhs_pipe *pipe, - void *buf, int len) +void usbhs_pkt_init(struct usbhs_pkt *pkt) +{ + INIT_LIST_HEAD(&pkt->node); +} + +void usbhs_pkt_update(struct usbhs_pkt *pkt, void *buf, int len) { - pkt->pipe = pipe; pkt->buf = buf; pkt->length = len; pkt->actual = 0; pkt->maxp = 0; } +void usbhs_pkt_push(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt) +{ + list_del_init(&pkt->node); + list_add_tail(&pkt->node, &pipe->list); + + pkt->pipe = pipe; +} + +void usbhs_pkt_pop(struct usbhs_pkt *pkt) +{ + list_del_init(&pkt->node); +} + +struct usbhs_pkt *usbhs_pkt_get(struct usbhs_pipe *pipe) +{ + if (list_empty(&pipe->list)) + return NULL; + + return list_entry(pipe->list.next, struct usbhs_pkt, node); +} + /* * FIFO ctrl */ |