aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/mon/mon_text.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-07-30 17:10:36 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-10-12 17:55:01 -0400
commit18ea5d00d05fa6300606f0711748016c95fb26dc (patch)
tree67b0411f8e31f58c4127757875a1ecf2e924d995 /drivers/usb/mon/mon_text.c
parent93cf9b909efb773f74b5d87659d41f957ccbce7e (diff)
USB: avoid urb->pipe in usbmon
This patch (as949) changes the usbmon driver to use the new urb->ep field rather than urb->pipe. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Cc: 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.c58
1 files changed, 32 insertions, 26 deletions
diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c
index 8f27a9e1c36b..9d0070ceef52 100644
--- a/drivers/usb/mon/mon_text.c
+++ b/drivers/usb/mon/mon_text.c
@@ -50,10 +50,12 @@ struct mon_iso_desc {
50struct mon_event_text { 50struct mon_event_text {
51 struct list_head e_link; 51 struct list_head e_link;
52 int type; /* submit, complete, etc. */ 52 int type; /* submit, complete, etc. */
53 unsigned int pipe; /* Pipe */
54 unsigned long id; /* From pointer, most of the time */ 53 unsigned long id; /* From pointer, most of the time */
55 unsigned int tstamp; 54 unsigned int tstamp;
55 int xfertype;
56 int busnum; 56 int busnum;
57 int devnum;
58 int epnum;
57 int length; /* Depends on type: xfer length or act length */ 59 int length; /* Depends on type: xfer length or act length */
58 int status; 60 int status;
59 int interval; 61 int interval;
@@ -61,6 +63,7 @@ struct mon_event_text {
61 int error_count; 63 int error_count;
62 char setup_flag; 64 char setup_flag;
63 char data_flag; 65 char data_flag;
66 char is_in;
64 int numdesc; /* Full number */ 67 int numdesc; /* Full number */
65 struct mon_iso_desc isodesc[ISODESC_MAX]; 68 struct mon_iso_desc isodesc[ISODESC_MAX];
66 unsigned char setup[SETUP_MAX]; 69 unsigned char setup[SETUP_MAX];
@@ -121,7 +124,7 @@ static inline char mon_text_get_setup(struct mon_event_text *ep,
121 struct urb *urb, char ev_type, struct mon_bus *mbus) 124 struct urb *urb, char ev_type, struct mon_bus *mbus)
122{ 125{
123 126
124 if (!usb_pipecontrol(urb->pipe) || ev_type != 'S') 127 if (ep->xfertype != USB_ENDPOINT_XFER_CONTROL || ev_type != 'S')
125 return '-'; 128 return '-';
126 129
127 if (urb->dev->bus->uses_dma && 130 if (urb->dev->bus->uses_dma &&
@@ -138,14 +141,12 @@ static inline char mon_text_get_setup(struct mon_event_text *ep,
138static inline char mon_text_get_data(struct mon_event_text *ep, struct urb *urb, 141static inline char mon_text_get_data(struct mon_event_text *ep, struct urb *urb,
139 int len, char ev_type, struct mon_bus *mbus) 142 int len, char ev_type, struct mon_bus *mbus)
140{ 143{
141 int pipe = urb->pipe;
142
143 if (len <= 0) 144 if (len <= 0)
144 return 'L'; 145 return 'L';
145 if (len >= DATA_MAX) 146 if (len >= DATA_MAX)
146 len = DATA_MAX; 147 len = DATA_MAX;
147 148
148 if (usb_pipein(pipe)) { 149 if (ep->is_in) {
149 if (ev_type != 'C') 150 if (ev_type != 'C')
150 return '<'; 151 return '<';
151 } else { 152 } else {
@@ -203,24 +204,28 @@ static void mon_text_event(struct mon_reader_text *rp, struct urb *urb,
203 } 204 }
204 205
205 ep->type = ev_type; 206 ep->type = ev_type;
206 ep->pipe = urb->pipe;
207 ep->id = (unsigned long) urb; 207 ep->id = (unsigned long) urb;
208 ep->busnum = urb->dev->bus->busnum; 208 ep->busnum = urb->dev->bus->busnum;
209 ep->devnum = urb->dev->devnum;
210 ep->epnum = usb_endpoint_num(&urb->ep->desc);
211 ep->xfertype = usb_endpoint_type(&urb->ep->desc);
212 ep->is_in = usb_urb_dir_in(urb);
209 ep->tstamp = stamp; 213 ep->tstamp = stamp;
210 ep->length = (ev_type == 'S') ? 214 ep->length = (ev_type == 'S') ?
211 urb->transfer_buffer_length : urb->actual_length; 215 urb->transfer_buffer_length : urb->actual_length;
212 /* Collecting status makes debugging sense for submits, too */ 216 /* Collecting status makes debugging sense for submits, too */
213 ep->status = urb->status; 217 ep->status = urb->status;
214 218
215 if (usb_pipeint(urb->pipe)) { 219 if (ep->xfertype == USB_ENDPOINT_XFER_INT) {
216 ep->interval = urb->interval; 220 ep->interval = urb->interval;
217 } else if (usb_pipeisoc(urb->pipe)) { 221 } else if (ep->xfertype == USB_ENDPOINT_XFER_ISOC) {
218 ep->interval = urb->interval; 222 ep->interval = urb->interval;
219 ep->start_frame = urb->start_frame; 223 ep->start_frame = urb->start_frame;
220 ep->error_count = urb->error_count; 224 ep->error_count = urb->error_count;
221 } 225 }
222 ep->numdesc = urb->number_of_packets; 226 ep->numdesc = urb->number_of_packets;
223 if (usb_pipeisoc(urb->pipe) && urb->number_of_packets > 0) { 227 if (ep->xfertype == USB_ENDPOINT_XFER_ISOC &&
228 urb->number_of_packets > 0) {
224 if ((ndesc = urb->number_of_packets) > ISODESC_MAX) 229 if ((ndesc = urb->number_of_packets) > ISODESC_MAX)
225 ndesc = ISODESC_MAX; 230 ndesc = ISODESC_MAX;
226 fp = urb->iso_frame_desc; 231 fp = urb->iso_frame_desc;
@@ -268,9 +273,12 @@ static void mon_text_error(void *data, struct urb *urb, int error)
268 } 273 }
269 274
270 ep->type = 'E'; 275 ep->type = 'E';
271 ep->pipe = urb->pipe;
272 ep->id = (unsigned long) urb; 276 ep->id = (unsigned long) urb;
273 ep->busnum = 0; 277 ep->busnum = 0;
278 ep->devnum = urb->dev->devnum;
279 ep->epnum = usb_endpoint_num(&urb->ep->desc);
280 ep->xfertype = usb_endpoint_type(&urb->ep->desc);
281 ep->is_in = usb_urb_dir_in(urb);
274 ep->tstamp = 0; 282 ep->tstamp = 0;
275 ep->length = 0; 283 ep->length = 0;
276 ep->status = error; 284 ep->status = error;
@@ -413,10 +421,10 @@ static ssize_t mon_text_read_u(struct file *file, char __user *buf,
413 mon_text_read_head_u(rp, &ptr, ep); 421 mon_text_read_head_u(rp, &ptr, ep);
414 if (ep->type == 'E') { 422 if (ep->type == 'E') {
415 mon_text_read_statset(rp, &ptr, ep); 423 mon_text_read_statset(rp, &ptr, ep);
416 } else if (usb_pipeisoc(ep->pipe)) { 424 } else if (ep->xfertype == USB_ENDPOINT_XFER_ISOC) {
417 mon_text_read_isostat(rp, &ptr, ep); 425 mon_text_read_isostat(rp, &ptr, ep);
418 mon_text_read_isodesc(rp, &ptr, ep); 426 mon_text_read_isodesc(rp, &ptr, ep);
419 } else if (usb_pipeint(ep->pipe)) { 427 } else if (ep->xfertype == USB_ENDPOINT_XFER_INT) {
420 mon_text_read_intstat(rp, &ptr, ep); 428 mon_text_read_intstat(rp, &ptr, ep);
421 } else { 429 } else {
422 mon_text_read_statset(rp, &ptr, ep); 430 mon_text_read_statset(rp, &ptr, ep);
@@ -468,18 +476,17 @@ static void mon_text_read_head_t(struct mon_reader_text *rp,
468{ 476{
469 char udir, utype; 477 char udir, utype;
470 478
471 udir = usb_pipein(ep->pipe) ? 'i' : 'o'; 479 udir = (ep->is_in ? 'i' : 'o');
472 switch (usb_pipetype(ep->pipe)) { 480 switch (ep->xfertype) {
473 case PIPE_ISOCHRONOUS: utype = 'Z'; break; 481 case USB_ENDPOINT_XFER_ISOC: utype = 'Z'; break;
474 case PIPE_INTERRUPT: utype = 'I'; break; 482 case USB_ENDPOINT_XFER_INT: utype = 'I'; break;
475 case PIPE_CONTROL: utype = 'C'; break; 483 case USB_ENDPOINT_XFER_CONTROL: utype = 'C'; break;
476 default: /* PIPE_BULK */ utype = 'B'; 484 default: /* PIPE_BULK */ utype = 'B';
477 } 485 }
478 p->cnt += snprintf(p->pbuf + p->cnt, p->limit - p->cnt, 486 p->cnt += snprintf(p->pbuf + p->cnt, p->limit - p->cnt,
479 "%lx %u %c %c%c:%03u:%02u", 487 "%lx %u %c %c%c:%03u:%02u",
480 ep->id, ep->tstamp, ep->type, 488 ep->id, ep->tstamp, ep->type,
481 utype, udir, 489 utype, udir, ep->devnum, ep->epnum);
482 usb_pipedevice(ep->pipe), usb_pipeendpoint(ep->pipe));
483} 490}
484 491
485static void mon_text_read_head_u(struct mon_reader_text *rp, 492static void mon_text_read_head_u(struct mon_reader_text *rp,
@@ -487,18 +494,17 @@ static void mon_text_read_head_u(struct mon_reader_text *rp,
487{ 494{
488 char udir, utype; 495 char udir, utype;
489 496
490 udir = usb_pipein(ep->pipe) ? 'i' : 'o'; 497 udir = (ep->is_in ? 'i' : 'o');
491 switch (usb_pipetype(ep->pipe)) { 498 switch (ep->xfertype) {
492 case PIPE_ISOCHRONOUS: utype = 'Z'; break; 499 case USB_ENDPOINT_XFER_ISOC: utype = 'Z'; break;
493 case PIPE_INTERRUPT: utype = 'I'; break; 500 case USB_ENDPOINT_XFER_INT: utype = 'I'; break;
494 case PIPE_CONTROL: utype = 'C'; break; 501 case USB_ENDPOINT_XFER_CONTROL: utype = 'C'; break;
495 default: /* PIPE_BULK */ utype = 'B'; 502 default: /* PIPE_BULK */ utype = 'B';
496 } 503 }
497 p->cnt += snprintf(p->pbuf + p->cnt, p->limit - p->cnt, 504 p->cnt += snprintf(p->pbuf + p->cnt, p->limit - p->cnt,
498 "%lx %u %c %c%c:%d:%03u:%u", 505 "%lx %u %c %c%c:%d:%03u:%u",
499 ep->id, ep->tstamp, ep->type, 506 ep->id, ep->tstamp, ep->type,
500 utype, udir, 507 utype, udir, ep->busnum, ep->devnum, ep->epnum);
501 ep->busnum, usb_pipedevice(ep->pipe), usb_pipeendpoint(ep->pipe));
502} 508}
503 509
504static void mon_text_read_statset(struct mon_reader_text *rp, 510static void mon_text_read_statset(struct mon_reader_text *rp,