diff options
Diffstat (limited to 'drivers/usb/mon')
-rw-r--r-- | drivers/usb/mon/mon_main.c | 7 | ||||
-rw-r--r-- | drivers/usb/mon/mon_stat.c | 4 | ||||
-rw-r--r-- | drivers/usb/mon/mon_text.c | 19 | ||||
-rw-r--r-- | drivers/usb/mon/usb_mon.h | 5 |
4 files changed, 18 insertions, 17 deletions
diff --git a/drivers/usb/mon/mon_main.c b/drivers/usb/mon/mon_main.c index 275a66f8305..394bbf2f68d 100644 --- a/drivers/usb/mon/mon_main.c +++ b/drivers/usb/mon/mon_main.c @@ -265,7 +265,6 @@ static void mon_dissolve(struct mon_bus *mbus, struct usb_bus *ubus) ubus->mon_bus = NULL; mbus->u_bus = NULL; mb(); - // usb_bus_put(ubus); } /* @@ -297,12 +296,12 @@ static void mon_bus_init(struct dentry *mondir, struct usb_bus *ubus) INIT_LIST_HEAD(&mbus->r_list); /* - * This usb_bus_get here is superfluous, because we receive - * a notification if usb_bus is about to be removed. + * We don't need to take a reference to ubus, because we receive + * a notification if the bus is about to be removed. */ - // usb_bus_get(ubus); mbus->u_bus = ubus; ubus->mon_bus = mbus; + mbus->uses_dma = ubus->uses_dma; rc = snprintf(name, NAMESZ, "%dt", ubus->busnum); if (rc <= 0 || rc >= NAMESZ) diff --git a/drivers/usb/mon/mon_stat.c b/drivers/usb/mon/mon_stat.c index 1fe01d994a7..f6d1491256c 100644 --- a/drivers/usb/mon/mon_stat.c +++ b/drivers/usb/mon/mon_stat.c @@ -28,7 +28,7 @@ static int mon_stat_open(struct inode *inode, struct file *file) if ((sp = kmalloc(sizeof(struct snap), GFP_KERNEL)) == NULL) return -ENOMEM; - mbus = inode->u.generic_ip; + mbus = inode->i_private; sp->slen = snprintf(sp->str, STAT_BUF_SIZE, "nreaders %d events %u text_lost %u\n", @@ -62,7 +62,7 @@ static int mon_stat_release(struct inode *inode, struct file *file) return 0; } -struct file_operations mon_fops_stat = { +const struct file_operations mon_fops_stat = { .owner = THIS_MODULE, .open = mon_stat_open, .llseek = no_llseek, diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c index f961a770cee..7a2346c5328 100644 --- a/drivers/usb/mon/mon_text.c +++ b/drivers/usb/mon/mon_text.c @@ -75,13 +75,13 @@ static void mon_text_ctor(void *, kmem_cache_t *, unsigned long); */ static inline char mon_text_get_setup(struct mon_event_text *ep, - struct urb *urb, char ev_type) + struct urb *urb, char ev_type, struct mon_bus *mbus) { if (!usb_pipecontrol(urb->pipe) || ev_type != 'S') return '-'; - if (urb->transfer_flags & URB_NO_SETUP_DMA_MAP) + if (mbus->uses_dma && (urb->transfer_flags & URB_NO_SETUP_DMA_MAP)) return mon_dmapeek(ep->setup, urb->setup_dma, SETUP_MAX); if (urb->setup_packet == NULL) return 'Z'; /* '0' would be not as pretty. */ @@ -91,7 +91,7 @@ static inline char mon_text_get_setup(struct mon_event_text *ep, } static inline char mon_text_get_data(struct mon_event_text *ep, struct urb *urb, - int len, char ev_type) + int len, char ev_type, struct mon_bus *mbus) { int pipe = urb->pipe; @@ -117,7 +117,7 @@ static inline char mon_text_get_data(struct mon_event_text *ep, struct urb *urb, * contain non-NULL garbage in case the upper level promised to * set DMA for the HCD. */ - if (urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP) + if (mbus->uses_dma && (urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP)) return mon_dmapeek(ep->data, urb->transfer_dma, len); if (urb->transfer_buffer == NULL) @@ -161,8 +161,9 @@ static void mon_text_event(struct mon_reader_text *rp, struct urb *urb, /* Collecting status makes debugging sense for submits, too */ ep->status = urb->status; - ep->setup_flag = mon_text_get_setup(ep, urb, ev_type); - ep->data_flag = mon_text_get_data(ep, urb, ep->length, ev_type); + ep->setup_flag = mon_text_get_setup(ep, urb, ev_type, rp->r.m_bus); + ep->data_flag = mon_text_get_data(ep, urb, ep->length, ev_type, + rp->r.m_bus); rp->nevents++; list_add_tail(&ep->e_link, &rp->e_list); @@ -238,7 +239,7 @@ static int mon_text_open(struct inode *inode, struct file *file) int rc; mutex_lock(&mon_lock); - mbus = inode->u.generic_ip; + mbus = inode->i_private; ubus = mbus->u_bus; rp = kzalloc(sizeof(struct mon_reader_text), GFP_KERNEL); @@ -401,7 +402,7 @@ static int mon_text_release(struct inode *inode, struct file *file) struct mon_event_text *ep; mutex_lock(&mon_lock); - mbus = inode->u.generic_ip; + mbus = inode->i_private; if (mbus->nreaders <= 0) { printk(KERN_ERR TAG ": consistency error on close\n"); @@ -435,7 +436,7 @@ static int mon_text_release(struct inode *inode, struct file *file) return 0; } -struct file_operations mon_fops_text = { +const struct file_operations mon_fops_text = { .owner = THIS_MODULE, .open = mon_text_open, .llseek = no_llseek, diff --git a/drivers/usb/mon/usb_mon.h b/drivers/usb/mon/usb_mon.h index 33678c24ebe..ab9d02d5df7 100644 --- a/drivers/usb/mon/usb_mon.h +++ b/drivers/usb/mon/usb_mon.h @@ -20,6 +20,7 @@ struct mon_bus { struct dentry *dent_s; /* Debugging file */ struct dentry *dent_t; /* Text interface file */ struct usb_bus *u_bus; + int uses_dma; /* Ref */ int nreaders; /* Under mon_lock AND mbus->lock */ @@ -53,7 +54,7 @@ extern char mon_dmapeek(unsigned char *dst, dma_addr_t dma_addr, int len); extern struct mutex mon_lock; -extern struct file_operations mon_fops_text; -extern struct file_operations mon_fops_stat; +extern const struct file_operations mon_fops_text; +extern const struct file_operations mon_fops_stat; #endif /* __USB_MON_H */ |