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>
This commit is contained in:
parent
888fda4705
commit
9347d51c52
6 changed files with 24 additions and 21 deletions
|
@ -1275,7 +1275,7 @@ void usb_hcd_giveback_urb (struct usb_hcd *hcd, struct urb *urb)
|
|||
urb->status = -EREMOTEIO;
|
||||
|
||||
unmap_urb_for_dma(hcd, urb);
|
||||
usbmon_urb_complete(&hcd->self, urb);
|
||||
usbmon_urb_complete(&hcd->self, urb, urb->status);
|
||||
usb_unanchor_urb(urb);
|
||||
|
||||
/* pass ownership to the completion handler */
|
||||
|
|
|
@ -413,7 +413,7 @@ static inline void usbfs_cleanup(void) { }
|
|||
struct usb_mon_operations {
|
||||
void (*urb_submit)(struct usb_bus *bus, struct urb *urb);
|
||||
void (*urb_submit_error)(struct usb_bus *bus, struct urb *urb, int err);
|
||||
void (*urb_complete)(struct usb_bus *bus, struct urb *urb);
|
||||
void (*urb_complete)(struct usb_bus *bus, struct urb *urb, int status);
|
||||
/* void (*urb_unlink)(struct usb_bus *bus, struct urb *urb); */
|
||||
};
|
||||
|
||||
|
@ -432,10 +432,11 @@ static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb,
|
|||
(*mon_ops->urb_submit_error)(bus, urb, error);
|
||||
}
|
||||
|
||||
static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb)
|
||||
static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
|
||||
int status)
|
||||
{
|
||||
if (bus->monitored)
|
||||
(*mon_ops->urb_complete)(bus, urb);
|
||||
(*mon_ops->urb_complete)(bus, urb, status);
|
||||
}
|
||||
|
||||
int usb_mon_register(struct usb_mon_operations *ops);
|
||||
|
@ -446,7 +447,8 @@ void usb_mon_deregister(void);
|
|||
static inline void usbmon_urb_submit(struct usb_bus *bus, struct urb *urb) {}
|
||||
static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb,
|
||||
int error) {}
|
||||
static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb) {}
|
||||
static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
|
||||
int status) {}
|
||||
|
||||
#endif /* CONFIG_USB_MON */
|
||||
|
||||
|
|
|
@ -386,7 +386,7 @@ static char mon_bin_get_data(const struct mon_reader_bin *rp,
|
|||
}
|
||||
|
||||
static void mon_bin_event(struct mon_reader_bin *rp, struct urb *urb,
|
||||
char ev_type)
|
||||
char ev_type, int status)
|
||||
{
|
||||
const struct usb_endpoint_descriptor *epd = &urb->ep->desc;
|
||||
unsigned long flags;
|
||||
|
@ -452,7 +452,7 @@ static void mon_bin_event(struct mon_reader_bin *rp, struct urb *urb,
|
|||
ep->id = (unsigned long) urb;
|
||||
ep->ts_sec = ts.tv_sec;
|
||||
ep->ts_usec = ts.tv_usec;
|
||||
ep->status = urb->status;
|
||||
ep->status = status;
|
||||
ep->len_urb = urb_length;
|
||||
ep->len_cap = length;
|
||||
|
||||
|
@ -475,13 +475,13 @@ static void mon_bin_event(struct mon_reader_bin *rp, struct urb *urb,
|
|||
static void mon_bin_submit(void *data, struct urb *urb)
|
||||
{
|
||||
struct mon_reader_bin *rp = data;
|
||||
mon_bin_event(rp, urb, 'S');
|
||||
mon_bin_event(rp, urb, 'S', -EINPROGRESS);
|
||||
}
|
||||
|
||||
static void mon_bin_complete(void *data, struct urb *urb)
|
||||
static void mon_bin_complete(void *data, struct urb *urb, int status)
|
||||
{
|
||||
struct mon_reader_bin *rp = data;
|
||||
mon_bin_event(rp, urb, 'C');
|
||||
mon_bin_event(rp, urb, 'C', status);
|
||||
}
|
||||
|
||||
static void mon_bin_error(void *data, struct urb *urb, int error)
|
||||
|
|
|
@ -129,7 +129,8 @@ static void mon_submit_error(struct usb_bus *ubus, struct urb *urb, int error)
|
|||
|
||||
/*
|
||||
*/
|
||||
static void mon_bus_complete(struct mon_bus *mbus, struct urb *urb)
|
||||
static void mon_bus_complete(struct mon_bus *mbus, struct urb *urb,
|
||||
int status)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct list_head *pos;
|
||||
|
@ -139,18 +140,18 @@ static void mon_bus_complete(struct mon_bus *mbus, struct urb *urb)
|
|||
mbus->cnt_events++;
|
||||
list_for_each (pos, &mbus->r_list) {
|
||||
r = list_entry(pos, struct mon_reader, r_link);
|
||||
r->rnf_complete(r->r_data, urb);
|
||||
r->rnf_complete(r->r_data, urb, status);
|
||||
}
|
||||
spin_unlock_irqrestore(&mbus->lock, flags);
|
||||
}
|
||||
|
||||
static void mon_complete(struct usb_bus *ubus, struct urb *urb)
|
||||
static void mon_complete(struct usb_bus *ubus, struct urb *urb, int status)
|
||||
{
|
||||
struct mon_bus *mbus;
|
||||
|
||||
if ((mbus = ubus->mon_bus) != NULL)
|
||||
mon_bus_complete(mbus, urb);
|
||||
mon_bus_complete(&mon_bus0, urb);
|
||||
mon_bus_complete(mbus, urb, status);
|
||||
mon_bus_complete(&mon_bus0, urb, status);
|
||||
}
|
||||
|
||||
/* int (*unlink_urb) (struct urb *urb, int status); */
|
||||
|
|
|
@ -183,7 +183,7 @@ static inline unsigned int mon_get_timestamp(void)
|
|||
}
|
||||
|
||||
static void mon_text_event(struct mon_reader_text *rp, struct urb *urb,
|
||||
char ev_type)
|
||||
char ev_type, int status)
|
||||
{
|
||||
struct mon_event_text *ep;
|
||||
unsigned int stamp;
|
||||
|
@ -210,7 +210,7 @@ static void mon_text_event(struct mon_reader_text *rp, struct urb *urb,
|
|||
ep->length = (ev_type == 'S') ?
|
||||
urb->transfer_buffer_length : urb->actual_length;
|
||||
/* Collecting status makes debugging sense for submits, too */
|
||||
ep->status = urb->status;
|
||||
ep->status = status;
|
||||
|
||||
if (ep->xfertype == USB_ENDPOINT_XFER_INT) {
|
||||
ep->interval = urb->interval;
|
||||
|
@ -248,13 +248,13 @@ static void mon_text_event(struct mon_reader_text *rp, struct urb *urb,
|
|||
static void mon_text_submit(void *data, struct urb *urb)
|
||||
{
|
||||
struct mon_reader_text *rp = data;
|
||||
mon_text_event(rp, urb, 'S');
|
||||
mon_text_event(rp, urb, 'S', -EINPROGRESS);
|
||||
}
|
||||
|
||||
static void mon_text_complete(void *data, struct urb *urb)
|
||||
static void mon_text_complete(void *data, struct urb *urb, int status)
|
||||
{
|
||||
struct mon_reader_text *rp = data;
|
||||
mon_text_event(rp, urb, 'C');
|
||||
mon_text_event(rp, urb, 'C', status);
|
||||
}
|
||||
|
||||
static void mon_text_error(void *data, struct urb *urb, int error)
|
||||
|
|
|
@ -46,7 +46,7 @@ struct mon_reader {
|
|||
|
||||
void (*rnf_submit)(void *data, struct urb *urb);
|
||||
void (*rnf_error)(void *data, struct urb *urb, int error);
|
||||
void (*rnf_complete)(void *data, struct urb *urb);
|
||||
void (*rnf_complete)(void *data, struct urb *urb, int status);
|
||||
};
|
||||
|
||||
void mon_reader_add(struct mon_bus *mbus, struct mon_reader *r);
|
||||
|
|
Loading…
Reference in a new issue