diff options
Diffstat (limited to 'drivers/usb/host/uhci-debug.c')
-rw-r--r-- | drivers/usb/host/uhci-debug.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c index f2f5f8ce1715..e1239319655c 100644 --- a/drivers/usb/host/uhci-debug.c +++ b/drivers/usb/host/uhci-debug.c | |||
@@ -17,10 +17,13 @@ | |||
17 | 17 | ||
18 | #include "uhci-hcd.h" | 18 | #include "uhci-hcd.h" |
19 | 19 | ||
20 | static struct dentry *uhci_debugfs_root = NULL; | 20 | #define uhci_debug_operations (* (struct file_operations *) NULL) |
21 | static struct dentry *uhci_debugfs_root; | ||
22 | |||
23 | #ifdef DEBUG | ||
21 | 24 | ||
22 | /* Handle REALLY large printks so we don't overflow buffers */ | 25 | /* Handle REALLY large printks so we don't overflow buffers */ |
23 | static inline void lprintk(char *buf) | 26 | static void lprintk(char *buf) |
24 | { | 27 | { |
25 | char *p; | 28 | char *p; |
26 | 29 | ||
@@ -196,7 +199,6 @@ static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space) | |||
196 | return out - buf; | 199 | return out - buf; |
197 | } | 200 | } |
198 | 201 | ||
199 | #ifdef CONFIG_PROC_FS | ||
200 | static const char * const qh_names[] = { | 202 | static const char * const qh_names[] = { |
201 | "skel_unlink_qh", "skel_iso_qh", | 203 | "skel_unlink_qh", "skel_iso_qh", |
202 | "skel_int128_qh", "skel_int64_qh", | 204 | "skel_int128_qh", "skel_int64_qh", |
@@ -393,12 +395,13 @@ static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len) | |||
393 | return out - buf; | 395 | return out - buf; |
394 | } | 396 | } |
395 | 397 | ||
398 | #ifdef CONFIG_DEBUG_FS | ||
399 | |||
396 | #define MAX_OUTPUT (64 * 1024) | 400 | #define MAX_OUTPUT (64 * 1024) |
397 | 401 | ||
398 | struct uhci_debug { | 402 | struct uhci_debug { |
399 | int size; | 403 | int size; |
400 | char *data; | 404 | char *data; |
401 | struct uhci_hcd *uhci; | ||
402 | }; | 405 | }; |
403 | 406 | ||
404 | static int uhci_debug_open(struct inode *inode, struct file *file) | 407 | static int uhci_debug_open(struct inode *inode, struct file *file) |
@@ -419,8 +422,10 @@ static int uhci_debug_open(struct inode *inode, struct file *file) | |||
419 | goto out; | 422 | goto out; |
420 | } | 423 | } |
421 | 424 | ||
425 | up->size = 0; | ||
422 | spin_lock_irqsave(&uhci->lock, flags); | 426 | spin_lock_irqsave(&uhci->lock, flags); |
423 | up->size = uhci_sprint_schedule(uhci, up->data, MAX_OUTPUT); | 427 | if (uhci->is_initialized) |
428 | up->size = uhci_sprint_schedule(uhci, up->data, MAX_OUTPUT); | ||
424 | spin_unlock_irqrestore(&uhci->lock, flags); | 429 | spin_unlock_irqrestore(&uhci->lock, flags); |
425 | 430 | ||
426 | file->private_data = up; | 431 | file->private_data = up; |
@@ -472,15 +477,32 @@ static int uhci_debug_release(struct inode *inode, struct file *file) | |||
472 | return 0; | 477 | return 0; |
473 | } | 478 | } |
474 | 479 | ||
480 | #undef uhci_debug_operations | ||
475 | static struct file_operations uhci_debug_operations = { | 481 | static struct file_operations uhci_debug_operations = { |
482 | .owner = THIS_MODULE, | ||
476 | .open = uhci_debug_open, | 483 | .open = uhci_debug_open, |
477 | .llseek = uhci_debug_lseek, | 484 | .llseek = uhci_debug_lseek, |
478 | .read = uhci_debug_read, | 485 | .read = uhci_debug_read, |
479 | .release = uhci_debug_release, | 486 | .release = uhci_debug_release, |
480 | }; | 487 | }; |
481 | 488 | ||
482 | #else /* CONFIG_DEBUG_FS */ | 489 | #endif /* CONFIG_DEBUG_FS */ |
483 | 490 | ||
484 | #define uhci_debug_operations (* (struct file_operations *) NULL) | 491 | #else /* DEBUG */ |
492 | |||
493 | static inline void lprintk(char *buf) | ||
494 | {} | ||
495 | |||
496 | static inline int uhci_show_qh(struct uhci_qh *qh, char *buf, | ||
497 | int len, int space) | ||
498 | { | ||
499 | return 0; | ||
500 | } | ||
501 | |||
502 | static inline int uhci_sprint_schedule(struct uhci_hcd *uhci, | ||
503 | char *buf, int len) | ||
504 | { | ||
505 | return 0; | ||
506 | } | ||
485 | 507 | ||
486 | #endif | 508 | #endif |