aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/mon/mon_text.c
diff options
context:
space:
mode:
authorPete Zaitcev <zaitcev@redhat.com>2006-06-10 01:03:32 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-06-21 18:04:17 -0400
commit12e72feab5d9a23107f245b0f241a2484cbb5a4e (patch)
tree0a7325d03fddd768118e42e25cf7a8214b99a560 /drivers/usb/mon/mon_text.c
parent5b1c674d223eef6c6494be8be91e9e3a3054817e (diff)
[PATCH] USB: implement error event in usbmon
Implement the "error" event in usbmon. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/mon/mon_text.c')
-rw-r--r--drivers/usb/mon/mon_text.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c
index 9f9236bf62d2..e02c1a30c4cd 100644
--- a/drivers/usb/mon/mon_text.c
+++ b/drivers/usb/mon/mon_text.c
@@ -182,6 +182,32 @@ static void mon_text_complete(void *data, struct urb *urb)
182 mon_text_event(rp, urb, 'C'); 182 mon_text_event(rp, urb, 'C');
183} 183}
184 184
185static void mon_text_error(void *data, struct urb *urb, int error)
186{
187 struct mon_reader_text *rp = data;
188 struct mon_event_text *ep;
189
190 if (rp->nevents >= EVENT_MAX ||
191 (ep = kmem_cache_alloc(rp->e_slab, SLAB_ATOMIC)) == NULL) {
192 rp->r.m_bus->cnt_text_lost++;
193 return;
194 }
195
196 ep->type = 'E';
197 ep->pipe = urb->pipe;
198 ep->id = (unsigned long) urb;
199 ep->tstamp = 0;
200 ep->length = 0;
201 ep->status = error;
202
203 ep->setup_flag = '-';
204 ep->data_flag = 'E';
205
206 rp->nevents++;
207 list_add_tail(&ep->e_link, &rp->e_list);
208 wake_up(&rp->wait);
209}
210
185/* 211/*
186 * Fetch next event from the circular buffer. 212 * Fetch next event from the circular buffer.
187 */ 213 */
@@ -235,6 +261,7 @@ static int mon_text_open(struct inode *inode, struct file *file)
235 rp->r.m_bus = mbus; 261 rp->r.m_bus = mbus;
236 rp->r.r_data = rp; 262 rp->r.r_data = rp;
237 rp->r.rnf_submit = mon_text_submit; 263 rp->r.rnf_submit = mon_text_submit;
264 rp->r.rnf_error = mon_text_error;
238 rp->r.rnf_complete = mon_text_complete; 265 rp->r.rnf_complete = mon_text_complete;
239 266
240 snprintf(rp->slab_name, SLAB_NAME_SZ, "mon%dt_%lx", ubus->busnum, 267 snprintf(rp->slab_name, SLAB_NAME_SZ, "mon%dt_%lx", ubus->busnum,