usb: gadget: renesas_usbhs: remove usbhsh_request list
mod_host had usbhsh_request active/free list. it was almost meaningless, and vainly complicated. This patch remove it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
parent
9c6736523a
commit
c5b963f809
|
@ -74,7 +74,6 @@ struct usbhsh_pipe_info {
|
||||||
struct usbhsh_request {
|
struct usbhsh_request {
|
||||||
struct urb *urb;
|
struct urb *urb;
|
||||||
struct usbhs_pkt pkt;
|
struct usbhs_pkt pkt;
|
||||||
struct list_head ureq_link; /* see hpriv :: ureq_link_xxx */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct usbhsh_device {
|
struct usbhsh_device {
|
||||||
|
@ -104,10 +103,6 @@ struct usbhsh_hpriv {
|
||||||
u32 port_stat; /* USB_PORT_STAT_xxx */
|
u32 port_stat; /* USB_PORT_STAT_xxx */
|
||||||
|
|
||||||
struct completion setup_ack_done;
|
struct completion setup_ack_done;
|
||||||
|
|
||||||
/* see usbhsh_req_alloc/free */
|
|
||||||
struct list_head ureq_link_active;
|
|
||||||
struct list_head ureq_link_free;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -178,31 +173,6 @@ static const char usbhsh_hcd_name[] = "renesas_usbhs host";
|
||||||
/*
|
/*
|
||||||
* req alloc/free
|
* req alloc/free
|
||||||
*/
|
*/
|
||||||
static void usbhsh_ureq_list_init(struct usbhsh_hpriv *hpriv)
|
|
||||||
{
|
|
||||||
INIT_LIST_HEAD(&hpriv->ureq_link_active);
|
|
||||||
INIT_LIST_HEAD(&hpriv->ureq_link_free);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void usbhsh_ureq_list_quit(struct usbhsh_hpriv *hpriv)
|
|
||||||
{
|
|
||||||
struct usb_hcd *hcd = usbhsh_hpriv_to_hcd(hpriv);
|
|
||||||
struct device *dev = usbhsh_hcd_to_dev(hcd);
|
|
||||||
struct usbhsh_request *ureq, *next;
|
|
||||||
|
|
||||||
/* kfree all active ureq */
|
|
||||||
list_for_each_entry_safe(ureq, next,
|
|
||||||
&hpriv->ureq_link_active,
|
|
||||||
ureq_link) {
|
|
||||||
dev_err(dev, "active ureq (%p) is force freed\n", ureq);
|
|
||||||
kfree(ureq);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* kfree all free ureq */
|
|
||||||
list_for_each_entry_safe(ureq, next, &hpriv->ureq_link_free, ureq_link)
|
|
||||||
kfree(ureq);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct usbhsh_request *usbhsh_ureq_alloc(struct usbhsh_hpriv *hpriv,
|
static struct usbhsh_request *usbhsh_ureq_alloc(struct usbhsh_hpriv *hpriv,
|
||||||
struct urb *urb,
|
struct urb *urb,
|
||||||
gfp_t mem_flags)
|
gfp_t mem_flags)
|
||||||
|
@ -211,35 +181,13 @@ static struct usbhsh_request *usbhsh_ureq_alloc(struct usbhsh_hpriv *hpriv,
|
||||||
struct usbhs_priv *priv = usbhsh_hpriv_to_priv(hpriv);
|
struct usbhs_priv *priv = usbhsh_hpriv_to_priv(hpriv);
|
||||||
struct device *dev = usbhs_priv_to_dev(priv);
|
struct device *dev = usbhs_priv_to_dev(priv);
|
||||||
|
|
||||||
if (list_empty(&hpriv->ureq_link_free)) {
|
|
||||||
/*
|
|
||||||
* create new one if there is no free ureq
|
|
||||||
*/
|
|
||||||
ureq = kzalloc(sizeof(struct usbhsh_request), mem_flags);
|
ureq = kzalloc(sizeof(struct usbhsh_request), mem_flags);
|
||||||
if (ureq)
|
|
||||||
INIT_LIST_HEAD(&ureq->ureq_link);
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* reuse "free" ureq if exist
|
|
||||||
*/
|
|
||||||
ureq = list_entry(hpriv->ureq_link_free.next,
|
|
||||||
struct usbhsh_request,
|
|
||||||
ureq_link);
|
|
||||||
if (ureq)
|
|
||||||
list_del_init(&ureq->ureq_link);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ureq) {
|
if (!ureq) {
|
||||||
dev_err(dev, "ureq alloc fail\n");
|
dev_err(dev, "ureq alloc fail\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
usbhs_pkt_init(&ureq->pkt);
|
usbhs_pkt_init(&ureq->pkt);
|
||||||
|
|
||||||
/*
|
|
||||||
* push it to "active" list
|
|
||||||
*/
|
|
||||||
list_add_tail(&ureq->ureq_link, &hpriv->ureq_link_active);
|
|
||||||
ureq->urb = urb;
|
ureq->urb = urb;
|
||||||
usbhsh_urb_to_ureq(urb) = ureq;
|
usbhsh_urb_to_ureq(urb) = ureq;
|
||||||
|
|
||||||
|
@ -249,18 +197,10 @@ static struct usbhsh_request *usbhsh_ureq_alloc(struct usbhsh_hpriv *hpriv,
|
||||||
static void usbhsh_ureq_free(struct usbhsh_hpriv *hpriv,
|
static void usbhsh_ureq_free(struct usbhsh_hpriv *hpriv,
|
||||||
struct usbhsh_request *ureq)
|
struct usbhsh_request *ureq)
|
||||||
{
|
{
|
||||||
struct usbhs_pkt *pkt = &ureq->pkt;
|
|
||||||
|
|
||||||
usbhs_pkt_init(pkt);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* removed from "active" list,
|
|
||||||
* and push it to "free" list
|
|
||||||
*/
|
|
||||||
usbhsh_urb_to_ureq(ureq->urb) = NULL;
|
usbhsh_urb_to_ureq(ureq->urb) = NULL;
|
||||||
ureq->urb = NULL;
|
ureq->urb = NULL;
|
||||||
list_del_init(&ureq->ureq_link);
|
|
||||||
list_add_tail(&ureq->ureq_link, &hpriv->ureq_link_free);
|
kfree(ureq);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1310,7 +1250,6 @@ int usbhs_mod_host_probe(struct usbhs_priv *priv)
|
||||||
hpriv->mod.stop = usbhsh_stop;
|
hpriv->mod.stop = usbhsh_stop;
|
||||||
hpriv->pipe_info = pipe_info;
|
hpriv->pipe_info = pipe_info;
|
||||||
hpriv->pipe_size = pipe_size;
|
hpriv->pipe_size = pipe_size;
|
||||||
usbhsh_ureq_list_init(hpriv);
|
|
||||||
usbhsh_port_stat_init(hpriv);
|
usbhsh_port_stat_init(hpriv);
|
||||||
|
|
||||||
/* init all device */
|
/* init all device */
|
||||||
|
@ -1334,8 +1273,6 @@ int usbhs_mod_host_remove(struct usbhs_priv *priv)
|
||||||
struct usbhsh_hpriv *hpriv = usbhsh_priv_to_hpriv(priv);
|
struct usbhsh_hpriv *hpriv = usbhsh_priv_to_hpriv(priv);
|
||||||
struct usb_hcd *hcd = usbhsh_hpriv_to_hcd(hpriv);
|
struct usb_hcd *hcd = usbhsh_hpriv_to_hcd(hpriv);
|
||||||
|
|
||||||
usbhsh_ureq_list_quit(hpriv);
|
|
||||||
|
|
||||||
usb_put_hcd(hcd);
|
usb_put_hcd(hcd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue