aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/mon
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
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')
-rw-r--r--drivers/usb/mon/mon_bin.c44
-rw-r--r--drivers/usb/mon/mon_main.c4
-rw-r--r--drivers/usb/mon/mon_text.c58
3 files changed, 68 insertions, 38 deletions
diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c
index c03dfd7a9d36..0b0d77c669da 100644
--- a/drivers/usb/mon/mon_bin.c
+++ b/drivers/usb/mon/mon_bin.c
@@ -354,7 +354,7 @@ static inline char mon_bin_get_setup(unsigned char *setupb,
354 const struct urb *urb, char ev_type) 354 const struct urb *urb, char ev_type)
355{ 355{
356 356
357 if (!usb_pipecontrol(urb->pipe) || ev_type != 'S') 357 if (!usb_endpoint_xfer_control(&urb->ep->desc) || ev_type != 'S')
358 return '-'; 358 return '-';
359 359
360 if (urb->dev->bus->uses_dma && 360 if (urb->dev->bus->uses_dma &&
@@ -410,7 +410,7 @@ static void mon_bin_event(struct mon_reader_bin *rp, struct urb *urb,
410 if (length >= rp->b_size/5) 410 if (length >= rp->b_size/5)
411 length = rp->b_size/5; 411 length = rp->b_size/5;
412 412
413 if (usb_pipein(urb->pipe)) { 413 if (usb_urb_dir_in(urb)) {
414 if (ev_type == 'S') { 414 if (ev_type == 'S') {
415 length = 0; 415 length = 0;
416 data_tag = '<'; 416 data_tag = '<';
@@ -440,10 +440,22 @@ static void mon_bin_event(struct mon_reader_bin *rp, struct urb *urb,
440 */ 440 */
441 memset(ep, 0, PKT_SIZE); 441 memset(ep, 0, PKT_SIZE);
442 ep->type = ev_type; 442 ep->type = ev_type;
443 ep->xfer_type = usb_pipetype(urb->pipe); 443 switch (usb_endpoint_type(&urb->ep->desc)) {
444 /* We use the fact that usb_pipein() returns 0x80 */ 444 case USB_ENDPOINT_XFER_CONTROL:
445 ep->epnum = usb_pipeendpoint(urb->pipe) | usb_pipein(urb->pipe); 445 ep->xfer_type = PIPE_CONTROL;
446 ep->devnum = usb_pipedevice(urb->pipe); 446 break;
447 case USB_ENDPOINT_XFER_BULK:
448 ep->xfer_type = PIPE_BULK;
449 break;
450 case USB_ENDPOINT_XFER_INT:
451 ep->xfer_type = PIPE_INTERRUPT;
452 break;
453 default:
454 ep->xfer_type = PIPE_ISOCHRONOUS;
455 break;
456 }
457 ep->epnum = urb->ep->desc.bEndpointAddress;
458 ep->devnum = urb->dev->devnum;
447 ep->busnum = urb->dev->bus->busnum; 459 ep->busnum = urb->dev->bus->busnum;
448 ep->id = (unsigned long) urb; 460 ep->id = (unsigned long) urb;
449 ep->ts_sec = ts.tv_sec; 461 ep->ts_sec = ts.tv_sec;
@@ -500,10 +512,22 @@ static void mon_bin_error(void *data, struct urb *urb, int error)
500 512
501 memset(ep, 0, PKT_SIZE); 513 memset(ep, 0, PKT_SIZE);
502 ep->type = 'E'; 514 ep->type = 'E';
503 ep->xfer_type = usb_pipetype(urb->pipe); 515 switch (usb_endpoint_type(&urb->ep->desc)) {
504 /* We use the fact that usb_pipein() returns 0x80 */ 516 case USB_ENDPOINT_XFER_CONTROL:
505 ep->epnum = usb_pipeendpoint(urb->pipe) | usb_pipein(urb->pipe); 517 ep->xfer_type = PIPE_CONTROL;
506 ep->devnum = usb_pipedevice(urb->pipe); 518 break;
519 case USB_ENDPOINT_XFER_BULK:
520 ep->xfer_type = PIPE_BULK;
521 break;
522 case USB_ENDPOINT_XFER_INT:
523 ep->xfer_type = PIPE_INTERRUPT;
524 break;
525 default:
526 ep->xfer_type = PIPE_ISOCHRONOUS;
527 break;
528 }
529 ep->epnum = urb->ep->desc.bEndpointAddress;
530 ep->devnum = urb->dev->devnum;
507 ep->busnum = urb->dev->bus->busnum; 531 ep->busnum = urb->dev->bus->busnum;
508 ep->id = (unsigned long) urb; 532 ep->id = (unsigned long) urb;
509 ep->status = error; 533 ep->status = error;
diff --git a/drivers/usb/mon/mon_main.c b/drivers/usb/mon/mon_main.c
index ce61d8b0fd86..e58f761d060f 100644
--- a/drivers/usb/mon/mon_main.c
+++ b/drivers/usb/mon/mon_main.c
@@ -154,8 +154,8 @@ static void mon_complete(struct usb_bus *ubus, struct urb *urb)
154 * This should not happen. 154 * This should not happen.
155 * At this point we do not even know the bus number... 155 * At this point we do not even know the bus number...
156 */ 156 */
157 printk(KERN_ERR TAG ": Null mon bus in URB, pipe 0x%x\n", 157 printk(KERN_ERR TAG ": Null mon bus in URB, address %p\n",
158 urb->pipe); 158 urb);
159 return; 159 return;
160 } 160 }
161 161
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,