aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/uhci-debug.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2005-12-17 18:03:37 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-20 17:49:57 -0500
commit8d402e1ae03656c1ad215514f8885ef4793f0948 (patch)
treeceac7800d7e07be1a7320a0b729156b12fbf26d6 /drivers/usb/host/uhci-debug.c
parent0ed8fee1c1d38a62e981025ba40b5eba30c4ce2a (diff)
[PATCH] UHCI: improve debugging code
This patch (as626) makes some improvements to the debugging code in uhci-hcd. The main change is that now the code won't get compiled if CONFIG_USB_DEBUG isn't set. But there are other changes too, like adding a missing .owner field and printing a debugging dump if the controller dies. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/uhci-debug.c')
-rw-r--r--drivers/usb/host/uhci-debug.c36
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
20static struct dentry *uhci_debugfs_root = NULL; 20#define uhci_debug_operations (* (struct file_operations *) NULL)
21static 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 */
23static inline void lprintk(char *buf) 26static 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
200static const char * const qh_names[] = { 202static 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
398struct uhci_debug { 402struct uhci_debug {
399 int size; 403 int size;
400 char *data; 404 char *data;
401 struct uhci_hcd *uhci;
402}; 405};
403 406
404static int uhci_debug_open(struct inode *inode, struct file *file) 407static 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
475static struct file_operations uhci_debug_operations = { 481static 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
493static inline void lprintk(char *buf)
494{}
495
496static inline int uhci_show_qh(struct uhci_qh *qh, char *buf,
497 int len, int space)
498{
499 return 0;
500}
501
502static 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