aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-08-24 15:41:41 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-10-12 17:55:23 -0400
commit9347d51c52afcf1a77d2104f162cf8a085624c83 (patch)
treef128a00eeed69166f5f5a7196a8c1c45c5cc5d92 /drivers/usb
parent888fda47051716765175d0008450126c837adb32 (diff)
USB: reorganize urb->status use in usbmon
This patch (as978) reorganizes the way usbmon uses urb->status. It now accepts the status value as an argument. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/hcd.c2
-rw-r--r--drivers/usb/core/hcd.h10
-rw-r--r--drivers/usb/mon/mon_bin.c10
-rw-r--r--drivers/usb/mon/mon_main.c11
-rw-r--r--drivers/usb/mon/mon_text.c10
-rw-r--r--drivers/usb/mon/usb_mon.h2
6 files changed, 24 insertions, 21 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 8b17babf5c55..4ac021e42cd8 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1275,7 +1275,7 @@ void usb_hcd_giveback_urb (struct usb_hcd *hcd, struct urb *urb)
1275 urb->status = -EREMOTEIO; 1275 urb->status = -EREMOTEIO;
1276 1276
1277 unmap_urb_for_dma(hcd, urb); 1277 unmap_urb_for_dma(hcd, urb);
1278 usbmon_urb_complete(&hcd->self, urb); 1278 usbmon_urb_complete(&hcd->self, urb, urb->status);
1279 usb_unanchor_urb(urb); 1279 usb_unanchor_urb(urb);
1280 1280
1281 /* pass ownership to the completion handler */ 1281 /* pass ownership to the completion handler */
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
index 745be2566f62..729b7a03acd8 100644
--- a/drivers/usb/core/hcd.h
+++ b/drivers/usb/core/hcd.h
@@ -413,7 +413,7 @@ static inline void usbfs_cleanup(void) { }
413struct usb_mon_operations { 413struct usb_mon_operations {
414 void (*urb_submit)(struct usb_bus *bus, struct urb *urb); 414 void (*urb_submit)(struct usb_bus *bus, struct urb *urb);
415 void (*urb_submit_error)(struct usb_bus *bus, struct urb *urb, int err); 415 void (*urb_submit_error)(struct usb_bus *bus, struct urb *urb, int err);
416 void (*urb_complete)(struct usb_bus *bus, struct urb *urb); 416 void (*urb_complete)(struct usb_bus *bus, struct urb *urb, int status);
417 /* void (*urb_unlink)(struct usb_bus *bus, struct urb *urb); */ 417 /* void (*urb_unlink)(struct usb_bus *bus, struct urb *urb); */
418}; 418};
419 419
@@ -432,10 +432,11 @@ static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb,
432 (*mon_ops->urb_submit_error)(bus, urb, error); 432 (*mon_ops->urb_submit_error)(bus, urb, error);
433} 433}
434 434
435static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb) 435static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
436 int status)
436{ 437{
437 if (bus->monitored) 438 if (bus->monitored)
438 (*mon_ops->urb_complete)(bus, urb); 439 (*mon_ops->urb_complete)(bus, urb, status);
439} 440}
440 441
441int usb_mon_register(struct usb_mon_operations *ops); 442int usb_mon_register(struct usb_mon_operations *ops);
@@ -446,7 +447,8 @@ void usb_mon_deregister(void);
446static inline void usbmon_urb_submit(struct usb_bus *bus, struct urb *urb) {} 447static inline void usbmon_urb_submit(struct usb_bus *bus, struct urb *urb) {}
447static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb, 448static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb,
448 int error) {} 449 int error) {}
449static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb) {} 450static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
451 int status) {}
450 452
451#endif /* CONFIG_USB_MON */ 453#endif /* CONFIG_USB_MON */
452 454
diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c
index 3d6f03819ffd..f06e4e2b49d3 100644
--- a/drivers/usb/mon/mon_bin.c
+++ b/drivers/usb/mon/mon_bin.c
@@ -386,7 +386,7 @@ static char mon_bin_get_data(const struct mon_reader_bin *rp,
386} 386}
387 387
388static void mon_bin_event(struct mon_reader_bin *rp, struct urb *urb, 388static void mon_bin_event(struct mon_reader_bin *rp, struct urb *urb,
389 char ev_type) 389 char ev_type, int status)
390{ 390{
391 const struct usb_endpoint_descriptor *epd = &urb->ep->desc; 391 const struct usb_endpoint_descriptor *epd = &urb->ep->desc;
392 unsigned long flags; 392 unsigned long flags;
@@ -452,7 +452,7 @@ static void mon_bin_event(struct mon_reader_bin *rp, struct urb *urb,
452 ep->id = (unsigned long) urb; 452 ep->id = (unsigned long) urb;
453 ep->ts_sec = ts.tv_sec; 453 ep->ts_sec = ts.tv_sec;
454 ep->ts_usec = ts.tv_usec; 454 ep->ts_usec = ts.tv_usec;
455 ep->status = urb->status; 455 ep->status = status;
456 ep->len_urb = urb_length; 456 ep->len_urb = urb_length;
457 ep->len_cap = length; 457 ep->len_cap = length;
458 458
@@ -475,13 +475,13 @@ static void mon_bin_event(struct mon_reader_bin *rp, struct urb *urb,
475static void mon_bin_submit(void *data, struct urb *urb) 475static void mon_bin_submit(void *data, struct urb *urb)
476{ 476{
477 struct mon_reader_bin *rp = data; 477 struct mon_reader_bin *rp = data;
478 mon_bin_event(rp, urb, 'S'); 478 mon_bin_event(rp, urb, 'S', -EINPROGRESS);
479} 479}
480 480
481static void mon_bin_complete(void *data, struct urb *urb) 481static void mon_bin_complete(void *data, struct urb *urb, int status)
482{ 482{
483 struct mon_reader_bin *rp = data; 483 struct mon_reader_bin *rp = data;
484 mon_bin_event(rp, urb, 'C'); 484 mon_bin_event(rp, urb, 'C', status);
485} 485}
486 486
487static void mon_bin_error(void *data, struct urb *urb, int error) 487static void mon_bin_error(void *data, struct urb *urb, int error)
diff --git a/drivers/usb/mon/mon_main.c b/drivers/usb/mon/mon_main.c
index 2e317bd79e92..b371ffd39d36 100644
--- a/drivers/usb/mon/mon_main.c
+++ b/drivers/usb/mon/mon_main.c
@@ -129,7 +129,8 @@ static void mon_submit_error(struct usb_bus *ubus, struct urb *urb, int error)
129 129
130/* 130/*
131 */ 131 */
132static void mon_bus_complete(struct mon_bus *mbus, struct urb *urb) 132static void mon_bus_complete(struct mon_bus *mbus, struct urb *urb,
133 int status)
133{ 134{
134 unsigned long flags; 135 unsigned long flags;
135 struct list_head *pos; 136 struct list_head *pos;
@@ -139,18 +140,18 @@ static void mon_bus_complete(struct mon_bus *mbus, struct urb *urb)
139 mbus->cnt_events++; 140 mbus->cnt_events++;
140 list_for_each (pos, &mbus->r_list) { 141 list_for_each (pos, &mbus->r_list) {
141 r = list_entry(pos, struct mon_reader, r_link); 142 r = list_entry(pos, struct mon_reader, r_link);
142 r->rnf_complete(r->r_data, urb); 143 r->rnf_complete(r->r_data, urb, status);
143 } 144 }
144 spin_unlock_irqrestore(&mbus->lock, flags); 145 spin_unlock_irqrestore(&mbus->lock, flags);
145} 146}
146 147
147static void mon_complete(struct usb_bus *ubus, struct urb *urb) 148static void mon_complete(struct usb_bus *ubus, struct urb *urb, int status)
148{ 149{
149 struct mon_bus *mbus; 150 struct mon_bus *mbus;
150 151
151 if ((mbus = ubus->mon_bus) != NULL) 152 if ((mbus = ubus->mon_bus) != NULL)
152 mon_bus_complete(mbus, urb); 153 mon_bus_complete(mbus, urb, status);
153 mon_bus_complete(&mon_bus0, urb); 154 mon_bus_complete(&mon_bus0, urb, status);
154} 155}
155 156
156/* int (*unlink_urb) (struct urb *urb, int status); */ 157/* int (*unlink_urb) (struct urb *urb, int status); */
diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c
index 663a702a17dd..ebb04ac4857b 100644
--- a/drivers/usb/mon/mon_text.c
+++ b/drivers/usb/mon/mon_text.c
@@ -183,7 +183,7 @@ static inline unsigned int mon_get_timestamp(void)
183} 183}
184 184
185static void mon_text_event(struct mon_reader_text *rp, struct urb *urb, 185static void mon_text_event(struct mon_reader_text *rp, struct urb *urb,
186 char ev_type) 186 char ev_type, int status)
187{ 187{
188 struct mon_event_text *ep; 188 struct mon_event_text *ep;
189 unsigned int stamp; 189 unsigned int stamp;
@@ -210,7 +210,7 @@ static void mon_text_event(struct mon_reader_text *rp, struct urb *urb,
210 ep->length = (ev_type == 'S') ? 210 ep->length = (ev_type == 'S') ?
211 urb->transfer_buffer_length : urb->actual_length; 211 urb->transfer_buffer_length : urb->actual_length;
212 /* Collecting status makes debugging sense for submits, too */ 212 /* Collecting status makes debugging sense for submits, too */
213 ep->status = urb->status; 213 ep->status = status;
214 214
215 if (ep->xfertype == USB_ENDPOINT_XFER_INT) { 215 if (ep->xfertype == USB_ENDPOINT_XFER_INT) {
216 ep->interval = urb->interval; 216 ep->interval = urb->interval;
@@ -248,13 +248,13 @@ static void mon_text_event(struct mon_reader_text *rp, struct urb *urb,
248static void mon_text_submit(void *data, struct urb *urb) 248static void mon_text_submit(void *data, struct urb *urb)
249{ 249{
250 struct mon_reader_text *rp = data; 250 struct mon_reader_text *rp = data;
251 mon_text_event(rp, urb, 'S'); 251 mon_text_event(rp, urb, 'S', -EINPROGRESS);
252} 252}
253 253
254static void mon_text_complete(void *data, struct urb *urb) 254static void mon_text_complete(void *data, struct urb *urb, int status)
255{ 255{
256 struct mon_reader_text *rp = data; 256 struct mon_reader_text *rp = data;
257 mon_text_event(rp, urb, 'C'); 257 mon_text_event(rp, urb, 'C', status);
258} 258}
259 259
260static void mon_text_error(void *data, struct urb *urb, int error) 260static void mon_text_error(void *data, struct urb *urb, int error)
diff --git a/drivers/usb/mon/usb_mon.h b/drivers/usb/mon/usb_mon.h
index f68ad6d99ad7..f5d84ff8c101 100644
--- a/drivers/usb/mon/usb_mon.h
+++ b/drivers/usb/mon/usb_mon.h
@@ -46,7 +46,7 @@ struct mon_reader {
46 46
47 void (*rnf_submit)(void *data, struct urb *urb); 47 void (*rnf_submit)(void *data, struct urb *urb);
48 void (*rnf_error)(void *data, struct urb *urb, int error); 48 void (*rnf_error)(void *data, struct urb *urb, int error);
49 void (*rnf_complete)(void *data, struct urb *urb); 49 void (*rnf_complete)(void *data, struct urb *urb, int status);
50}; 50};
51 51
52void mon_reader_add(struct mon_bus *mbus, struct mon_reader *r); 52void mon_reader_add(struct mon_bus *mbus, struct mon_reader *r);