diff options
Diffstat (limited to 'drivers/usb/mon/mon_text.c')
-rw-r--r-- | drivers/usb/mon/mon_text.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c index bbf54396e5f2..ec0cc51e39ac 100644 --- a/drivers/usb/mon/mon_text.c +++ b/drivers/usb/mon/mon_text.c | |||
@@ -124,8 +124,10 @@ static inline char mon_text_get_setup(struct mon_event_text *ep, | |||
124 | if (!usb_pipecontrol(urb->pipe) || ev_type != 'S') | 124 | if (!usb_pipecontrol(urb->pipe) || ev_type != 'S') |
125 | return '-'; | 125 | return '-'; |
126 | 126 | ||
127 | if (mbus->uses_dma && (urb->transfer_flags & URB_NO_SETUP_DMA_MAP)) | 127 | if (urb->dev->bus->uses_dma && |
128 | (urb->transfer_flags & URB_NO_SETUP_DMA_MAP)) { | ||
128 | return mon_dmapeek(ep->setup, urb->setup_dma, SETUP_MAX); | 129 | return mon_dmapeek(ep->setup, urb->setup_dma, SETUP_MAX); |
130 | } | ||
129 | if (urb->setup_packet == NULL) | 131 | if (urb->setup_packet == NULL) |
130 | return 'Z'; /* '0' would be not as pretty. */ | 132 | return 'Z'; /* '0' would be not as pretty. */ |
131 | 133 | ||
@@ -160,8 +162,10 @@ static inline char mon_text_get_data(struct mon_event_text *ep, struct urb *urb, | |||
160 | * contain non-NULL garbage in case the upper level promised to | 162 | * contain non-NULL garbage in case the upper level promised to |
161 | * set DMA for the HCD. | 163 | * set DMA for the HCD. |
162 | */ | 164 | */ |
163 | if (mbus->uses_dma && (urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP)) | 165 | if (urb->dev->bus->uses_dma && |
166 | (urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP)) { | ||
164 | return mon_dmapeek(ep->data, urb->transfer_dma, len); | 167 | return mon_dmapeek(ep->data, urb->transfer_dma, len); |
168 | } | ||
165 | 169 | ||
166 | if (urb->transfer_buffer == NULL) | 170 | if (urb->transfer_buffer == NULL) |
167 | return 'Z'; /* '0' would be not as pretty. */ | 171 | return 'Z'; /* '0' would be not as pretty. */ |
@@ -201,7 +205,7 @@ static void mon_text_event(struct mon_reader_text *rp, struct urb *urb, | |||
201 | ep->type = ev_type; | 205 | ep->type = ev_type; |
202 | ep->pipe = urb->pipe; | 206 | ep->pipe = urb->pipe; |
203 | ep->id = (unsigned long) urb; | 207 | ep->id = (unsigned long) urb; |
204 | ep->busnum = rp->r.m_bus->u_bus->busnum; | 208 | ep->busnum = urb->dev->bus->busnum; |
205 | ep->tstamp = stamp; | 209 | ep->tstamp = stamp; |
206 | ep->length = (ev_type == 'S') ? | 210 | ep->length = (ev_type == 'S') ? |
207 | urb->transfer_buffer_length : urb->actual_length; | 211 | urb->transfer_buffer_length : urb->actual_length; |
@@ -305,13 +309,11 @@ static struct mon_event_text *mon_text_fetch(struct mon_reader_text *rp, | |||
305 | static int mon_text_open(struct inode *inode, struct file *file) | 309 | static int mon_text_open(struct inode *inode, struct file *file) |
306 | { | 310 | { |
307 | struct mon_bus *mbus; | 311 | struct mon_bus *mbus; |
308 | struct usb_bus *ubus; | ||
309 | struct mon_reader_text *rp; | 312 | struct mon_reader_text *rp; |
310 | int rc; | 313 | int rc; |
311 | 314 | ||
312 | mutex_lock(&mon_lock); | 315 | mutex_lock(&mon_lock); |
313 | mbus = inode->i_private; | 316 | mbus = inode->i_private; |
314 | ubus = mbus->u_bus; | ||
315 | 317 | ||
316 | rp = kzalloc(sizeof(struct mon_reader_text), GFP_KERNEL); | 318 | rp = kzalloc(sizeof(struct mon_reader_text), GFP_KERNEL); |
317 | if (rp == NULL) { | 319 | if (rp == NULL) { |
@@ -335,8 +337,7 @@ static int mon_text_open(struct inode *inode, struct file *file) | |||
335 | rp->r.rnf_error = mon_text_error; | 337 | rp->r.rnf_error = mon_text_error; |
336 | rp->r.rnf_complete = mon_text_complete; | 338 | rp->r.rnf_complete = mon_text_complete; |
337 | 339 | ||
338 | snprintf(rp->slab_name, SLAB_NAME_SZ, "mon%dt_%lx", ubus->busnum, | 340 | snprintf(rp->slab_name, SLAB_NAME_SZ, "mon_text_%p", rp); |
339 | (long)rp); | ||
340 | rp->e_slab = kmem_cache_create(rp->slab_name, | 341 | rp->e_slab = kmem_cache_create(rp->slab_name, |
341 | sizeof(struct mon_event_text), sizeof(long), 0, | 342 | sizeof(struct mon_event_text), sizeof(long), 0, |
342 | mon_text_ctor, NULL); | 343 | mon_text_ctor, NULL); |
@@ -654,14 +655,14 @@ static const struct file_operations mon_fops_text_u = { | |||
654 | .release = mon_text_release, | 655 | .release = mon_text_release, |
655 | }; | 656 | }; |
656 | 657 | ||
657 | int mon_text_add(struct mon_bus *mbus, const struct usb_bus *ubus) | 658 | int mon_text_add(struct mon_bus *mbus, int busnum) |
658 | { | 659 | { |
659 | struct dentry *d; | 660 | struct dentry *d; |
660 | enum { NAMESZ = 10 }; | 661 | enum { NAMESZ = 10 }; |
661 | char name[NAMESZ]; | 662 | char name[NAMESZ]; |
662 | int rc; | 663 | int rc; |
663 | 664 | ||
664 | rc = snprintf(name, NAMESZ, "%dt", ubus->busnum); | 665 | rc = snprintf(name, NAMESZ, "%dt", busnum); |
665 | if (rc <= 0 || rc >= NAMESZ) | 666 | if (rc <= 0 || rc >= NAMESZ) |
666 | goto err_print_t; | 667 | goto err_print_t; |
667 | d = debugfs_create_file(name, 0600, mon_dir, mbus, &mon_fops_text_t); | 668 | d = debugfs_create_file(name, 0600, mon_dir, mbus, &mon_fops_text_t); |
@@ -669,7 +670,7 @@ int mon_text_add(struct mon_bus *mbus, const struct usb_bus *ubus) | |||
669 | goto err_create_t; | 670 | goto err_create_t; |
670 | mbus->dent_t = d; | 671 | mbus->dent_t = d; |
671 | 672 | ||
672 | rc = snprintf(name, NAMESZ, "%du", ubus->busnum); | 673 | rc = snprintf(name, NAMESZ, "%du", busnum); |
673 | if (rc <= 0 || rc >= NAMESZ) | 674 | if (rc <= 0 || rc >= NAMESZ) |
674 | goto err_print_u; | 675 | goto err_print_u; |
675 | d = debugfs_create_file(name, 0600, mon_dir, mbus, &mon_fops_text_u); | 676 | d = debugfs_create_file(name, 0600, mon_dir, mbus, &mon_fops_text_u); |
@@ -677,7 +678,7 @@ int mon_text_add(struct mon_bus *mbus, const struct usb_bus *ubus) | |||
677 | goto err_create_u; | 678 | goto err_create_u; |
678 | mbus->dent_u = d; | 679 | mbus->dent_u = d; |
679 | 680 | ||
680 | rc = snprintf(name, NAMESZ, "%ds", ubus->busnum); | 681 | rc = snprintf(name, NAMESZ, "%ds", busnum); |
681 | if (rc <= 0 || rc >= NAMESZ) | 682 | if (rc <= 0 || rc >= NAMESZ) |
682 | goto err_print_s; | 683 | goto err_print_s; |
683 | d = debugfs_create_file(name, 0600, mon_dir, mbus, &mon_fops_stat); | 684 | d = debugfs_create_file(name, 0600, mon_dir, mbus, &mon_fops_stat); |