usb: f_qdss: Cleanup control interface as no longer in use

Currently, if debug_inface is enabled the list pool allocation is
done for ctrl_write_pool instead of data_write_pool. Therefore
when coresight calls qdss_write function it finds the data_write_pool
empty & since data is populated in ctrl_write_pool, it will return
-EIO. This restricts qdss to work on a composition where ctrl & data
write pool coexists.

Fix this by removing the control interface as it is no longer used.

Change-Id: I2d6368d8f5a1b0ada2634ec682f19bc99551c76c
Signed-off-by: Udipto Goswami <ugoswami@codeaurora.org>
This commit is contained in:
Udipto Goswami 2020-05-20 14:43:38 +05:30
commit c6a5fecbaf
3 changed files with 9 additions and 90 deletions

View file

@ -227,21 +227,14 @@ static void qdss_write_complete(struct usb_ep *ep,
enum qdss_state state;
unsigned long flags;
if (qdss->debug_inface_enabled) {
in = qdss->port.ctrl_in;
list_pool = &qdss->ctrl_write_pool;
state = USB_QDSS_CTRL_WRITE_DONE;
} else {
in = qdss->port.data;
list_pool = &qdss->data_write_pool;
state = USB_QDSS_DATA_WRITE_DONE;
}
in = qdss->port.data;
list_pool = &qdss->data_write_pool;
state = USB_QDSS_DATA_WRITE_DONE;
qdss_log("channel:%s ep:%s req:%pK req->status:%d req->length:%d\n",
qdss->ch.name, ep->name, req, req->status, req->length);
spin_lock_irqsave(&qdss->lock, flags);
if (!qdss->debug_inface_enabled)
list_del(&qreq->list);
list_del(&qreq->list);
list_add_tail(&qreq->list, list_pool);
complete(&qreq->write_done);
if (req->length != 0) {
@ -259,7 +252,7 @@ void usb_qdss_free_req(struct usb_qdss_ch *ch)
struct f_qdss *qdss;
struct list_head *act, *tmp;
struct qdss_req *qreq;
int data_write_req = 0, ctrl_write_req = 0;
int data_write_req = 0;
unsigned long flags;
spin_lock_irqsave(&channel_lock, flags);
@ -281,16 +274,8 @@ void usb_qdss_free_req(struct usb_qdss_ch *ch)
data_write_req++;
}
list_for_each_safe(act, tmp, &qdss->ctrl_write_pool) {
qreq = list_entry(act, struct qdss_req, list);
list_del(&qreq->list);
usb_ep_free_request(qdss->port.ctrl_in, qreq->usb_req);
kfree(qreq);
ctrl_write_req++;
}
qdss_log("channel:%s data_write_req:%d ctrl_write_req:%d freed\n",
qdss->ch.name, data_write_req, ctrl_write_req);
qdss_log("channel:%s data_write_req:%d freed\n", qdss->ch.name,
data_write_req);
spin_unlock_irqrestore(&qdss->lock, flags);
}
EXPORT_SYMBOL(usb_qdss_free_req);
@ -312,19 +297,8 @@ int usb_qdss_alloc_req(struct usb_qdss_ch *ch, int no_write_buf)
return -ENODEV;
}
if ((qdss->debug_inface_enabled && no_write_buf <= 0) ||
(!qdss->debug_inface_enabled && no_write_buf <= 0)) {
pr_err("%s: missing params\n", __func__);
return -ENODEV;
}
if (qdss->debug_inface_enabled) {
in = qdss->port.ctrl_in;
list_pool = &qdss->ctrl_write_pool;
} else {
in = qdss->port.data;
list_pool = &qdss->data_write_pool;
}
in = qdss->port.data;
list_pool = &qdss->data_write_pool;
for (i = 0; i < no_write_buf; i++) {
qreq = kzalloc(sizeof(struct qdss_req), GFP_KERNEL);
@ -796,7 +770,6 @@ static struct f_qdss *alloc_usb_qdss(char *channel_name)
spin_unlock_irqrestore(&channel_lock, flags);
spin_lock_init(&qdss->lock);
INIT_LIST_HEAD(&qdss->ctrl_write_pool);
INIT_LIST_HEAD(&qdss->data_write_pool);
INIT_LIST_HEAD(&qdss->queued_data_pool);
INIT_WORK(&qdss->connect_w, usb_qdss_connect_work);
@ -805,51 +778,6 @@ static struct f_qdss *alloc_usb_qdss(char *channel_name)
return qdss;
}
int usb_qdss_ctrl_write(struct usb_qdss_ch *ch, struct qdss_request *d_req)
{
struct f_qdss *qdss = ch->priv_usb;
unsigned long flags;
struct usb_request *req = NULL;
struct qdss_req *qreq;
if (!qdss)
return -ENODEV;
qdss_log("channel:%s d_req:%pK\n", ch->name, d_req);
spin_lock_irqsave(&qdss->lock, flags);
if (qdss->usb_connected == 0) {
spin_unlock_irqrestore(&qdss->lock, flags);
return -EIO;
}
if (list_empty(&qdss->ctrl_write_pool)) {
pr_err("error: %s list is empty\n", __func__);
spin_unlock_irqrestore(&qdss->lock, flags);
return -EAGAIN;
}
qreq = list_first_entry(&qdss->ctrl_write_pool, struct qdss_req,
list);
list_del(&qreq->list);
spin_unlock_irqrestore(&qdss->lock, flags);
qreq->qdss_req = d_req;
req = qreq->usb_req;
req->buf = d_req->buf;
req->length = d_req->length;
if (usb_ep_queue(qdss->port.ctrl_in, req, GFP_ATOMIC)) {
spin_lock_irqsave(&qdss->lock, flags);
list_add_tail(&qreq->list, &qdss->ctrl_write_pool);
spin_unlock_irqrestore(&qdss->lock, flags);
pr_err("%s usb_ep_queue failed\n", __func__);
return -EIO;
}
return 0;
}
EXPORT_SYMBOL(usb_qdss_ctrl_write);
int usb_qdss_write(struct usb_qdss_ch *ch, struct qdss_request *d_req)
{
struct f_qdss *qdss = ch->priv_usb;

View file

@ -50,7 +50,6 @@ struct f_qdss {
bool debug_inface_enabled;
struct usb_request *endless_req;
struct usb_qdss_ch ch;
struct list_head ctrl_write_pool;
/* for mdm channel SW path */
struct list_head data_write_pool;

View file

@ -39,7 +39,6 @@ enum qdss_state {
USB_QDSS_DISCONNECT,
USB_QDSS_CTRL_READ_DONE,
USB_QDSS_DATA_WRITE_DONE,
USB_QDSS_CTRL_WRITE_DONE,
};
struct qdss_req {
@ -57,7 +56,6 @@ void usb_qdss_close(struct usb_qdss_ch *ch);
int usb_qdss_alloc_req(struct usb_qdss_ch *ch, int n_write);
void usb_qdss_free_req(struct usb_qdss_ch *ch);
int usb_qdss_write(struct usb_qdss_ch *ch, struct qdss_request *d_req);
int usb_qdss_ctrl_write(struct usb_qdss_ch *ch, struct qdss_request *d_req);
#else
static inline struct usb_qdss_ch *usb_qdss_open(const char *name, void *priv,
void (*n)(void *, unsigned int event,
@ -71,12 +69,6 @@ static inline int usb_qdss_write(struct usb_qdss_ch *c, struct qdss_request *d)
return -ENODEV;
}
static inline int usb_qdss_ctrl_write(struct usb_qdss_ch *c,
struct qdss_request *d)
{
return -ENODEV;
}
static inline int usb_qdss_alloc_req(struct usb_qdss_ch *c, int n_wr, int n_rd)
{
return -ENODEV;