upgrade to fedora-2.6.12-1.1398.FC4 + vserver 2.0.rc7
[linux-2.6.git] / drivers / usb / host / uhci-debug.c
index baf7444..24c73c5 100644 (file)
 
 #include <linux/config.h>
 #include <linux/kernel.h>
-#include <linux/proc_fs.h>
+#include <linux/debugfs.h>
 #include <linux/smp_lock.h>
 #include <asm/io.h>
 
 #include "uhci-hcd.h"
 
+static struct dentry *uhci_debugfs_root = NULL;
+
 /* Handle REALLY large printk's so we don't overflow buffers */
 static inline void lprintk(char *buf)
 {
@@ -95,24 +97,25 @@ static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space)
        struct list_head *head, *tmp;
        struct uhci_td *td;
        int i = 0, checked = 0, prevactive = 0;
+       __le32 element = qh_element(qh);
 
        /* Try to make sure there's enough memory */
        if (len < 80 * 6)
                return 0;
 
        out += sprintf(out, "%*s[%p] link (%08x) element (%08x)\n", space, "",
-                       qh, le32_to_cpu(qh->link), le32_to_cpu(qh->element));
+                       qh, le32_to_cpu(qh->link), le32_to_cpu(element));
 
-       if (qh->element & UHCI_PTR_QH)
+       if (element & UHCI_PTR_QH)
                out += sprintf(out, "%*s  Element points to QH (bug?)\n", space, "");
 
-       if (qh->element & UHCI_PTR_DEPTH)
+       if (element & UHCI_PTR_DEPTH)
                out += sprintf(out, "%*s  Depth traverse\n", space, "");
 
-       if (qh->element & cpu_to_le32(8))
+       if (element & cpu_to_le32(8))
                out += sprintf(out, "%*s  Bit 3 set (bug?)\n", space, "");
 
-       if (!(qh->element & ~(UHCI_PTR_QH | UHCI_PTR_DEPTH)))
+       if (!(element & ~(UHCI_PTR_QH | UHCI_PTR_DEPTH)))
                out += sprintf(out, "%*s  Element is NULL (bug?)\n", space, "");
 
        if (!qh->urbp) {
@@ -127,7 +130,7 @@ static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space)
 
        td = list_entry(tmp, struct uhci_td, list);
 
-       if (cpu_to_le32(td->dma_handle) != (qh->element & ~UHCI_PTR_BITS))
+       if (cpu_to_le32(td->dma_handle) != (element & ~UHCI_PTR_BITS))
                out += sprintf(out, "%*s Element != First TD\n", space, "");
 
        while (tmp != head) {
@@ -403,7 +406,7 @@ static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len)
        struct uhci_td *td;
        struct list_head *tmp, *head;
 
-       spin_lock_irqsave(&uhci->schedule_lock, flags);
+       spin_lock_irqsave(&uhci->lock, flags);
 
        out += sprintf(out, "HC status\n");
        out += uhci_show_status(uhci, out, len - (out - buf));
@@ -447,7 +450,7 @@ static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len)
                        if (qh->link != UHCI_PTR_TERM)
                                out += sprintf(out, "    bandwidth reclamation on!\n");
 
-                       if (qh->element != cpu_to_le32(uhci->term_td->dma_handle))
+                       if (qh_element(qh) != cpu_to_le32(uhci->term_td->dma_handle))
                                out += sprintf(out, "    skel_term_qh element is not set to term_td!\n");
 
                        continue;
@@ -489,26 +492,23 @@ static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len)
        if (debug > 2)
                out += uhci_show_lists(uhci, out, len - (out - buf));
 
-       spin_unlock_irqrestore(&uhci->schedule_lock, flags);
+       spin_unlock_irqrestore(&uhci->lock, flags);
 
        return out - buf;
 }
 
 #define MAX_OUTPUT     (64 * 1024)
 
-static struct proc_dir_entry *uhci_proc_root = NULL;
-
-struct uhci_proc {
+struct uhci_debug {
        int size;
        char *data;
        struct uhci_hcd *uhci;
 };
 
-static int uhci_proc_open(struct inode *inode, struct file *file)
+static int uhci_debug_open(struct inode *inode, struct file *file)
 {
-       const struct proc_dir_entry *dp = PDE(inode);
-       struct uhci_hcd *uhci = dp->data;
-       struct uhci_proc *up;
+       struct uhci_hcd *uhci = inode->u.generic_ip;
+       struct uhci_debug *up;
        int ret = -ENOMEM;
 
        lock_kernel();
@@ -532,9 +532,9 @@ out:
        return ret;
 }
 
-static loff_t uhci_proc_lseek(struct file *file, loff_t off, int whence)
+static loff_t uhci_debug_lseek(struct file *file, loff_t off, int whence)
 {
-       struct uhci_proc *up;
+       struct uhci_debug *up;
        loff_t new = -1;
 
        lock_kernel();
@@ -556,16 +556,16 @@ static loff_t uhci_proc_lseek(struct file *file, loff_t off, int whence)
        return (file->f_pos = new);
 }
 
-static ssize_t uhci_proc_read(struct file *file, char __user *buf,
+static ssize_t uhci_debug_read(struct file *file, char __user *buf,
                                size_t nbytes, loff_t *ppos)
 {
-       struct uhci_proc *up = file->private_data;
+       struct uhci_debug *up = file->private_data;
        return simple_read_from_buffer(buf, nbytes, ppos, up->data, up->size);
 }
 
-static int uhci_proc_release(struct inode *inode, struct file *file)
+static int uhci_debug_release(struct inode *inode, struct file *file)
 {
-       struct uhci_proc *up = file->private_data;
+       struct uhci_debug *up = file->private_data;
 
        kfree(up->data);
        kfree(up);
@@ -573,11 +573,15 @@ static int uhci_proc_release(struct inode *inode, struct file *file)
        return 0;
 }
 
-static struct file_operations uhci_proc_operations = {
-       .open =         uhci_proc_open,
-       .llseek =       uhci_proc_lseek,
-       .read =         uhci_proc_read,
-//     write:          uhci_proc_write,
-       .release =      uhci_proc_release,
+static struct file_operations uhci_debug_operations = {
+       .open =         uhci_debug_open,
+       .llseek =       uhci_debug_lseek,
+       .read =         uhci_debug_read,
+       .release =      uhci_debug_release,
 };
+
+#else  /* CONFIG_DEBUG_FS */
+
+#define uhci_debug_operations (* (struct file_operations *) NULL)
+
 #endif