aboutsummaryrefslogtreecommitdiffstats
path: root/usb-isp1362-move-debug-files-from-proc-to-debugfs.patch
diff options
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-02 12:24:26 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-02 12:24:26 -0700
commit08d2feaec62a45d40dc318b94ec3ea58599fbb0a (patch)
treef2f1a72bb2aa9af171b6748af01be04aac4122af /usb-isp1362-move-debug-files-from-proc-to-debugfs.patch
parentce8b378606196a70278d5b79b2164682ab02b4b0 (diff)
downloadpatches-08d2feaec62a45d40dc318b94ec3ea58599fbb0a.tar.gz
more usb patches added
Diffstat (limited to 'usb-isp1362-move-debug-files-from-proc-to-debugfs.patch')
-rw-r--r--usb-isp1362-move-debug-files-from-proc-to-debugfs.patch127
1 files changed, 127 insertions, 0 deletions
diff --git a/usb-isp1362-move-debug-files-from-proc-to-debugfs.patch b/usb-isp1362-move-debug-files-from-proc-to-debugfs.patch
new file mode 100644
index 00000000000000..ed2cece0f0e113
--- /dev/null
+++ b/usb-isp1362-move-debug-files-from-proc-to-debugfs.patch
@@ -0,0 +1,127 @@
+From foo@baz Tue Jul 2 12:17:06 PDT 2013
+Date: Tue, 02 Jul 2013 12:17:06 -0700
+To: Greg KH <gregkh@linuxfoundation.org>
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Subject: USB: isp1362: move debug files from proc to debugfs
+
+Drivers should not be putting debug files in /proc/ that is what debugfs
+is for, so move the isp1362 driver's debug file to debugfs.
+
+Cc: Felipe Balbi <balbi@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/isp1362-hcd.c | 45 ++++++++++-------------------------------
+ drivers/usb/host/isp1362.h | 2 -
+ 2 files changed, 12 insertions(+), 35 deletions(-)
+
+--- a/drivers/usb/host/isp1362-hcd.c
++++ b/drivers/usb/host/isp1362-hcd.c
+@@ -78,6 +78,8 @@
+ #include <linux/io.h>
+ #include <linux/bitmap.h>
+ #include <linux/prefetch.h>
++#include <linux/debugfs.h>
++#include <linux/seq_file.h>
+
+ #include <asm/irq.h>
+ #include <asm/byteorder.h>
+@@ -88,7 +90,6 @@ static int dbg_level;
+ module_param(dbg_level, int, 0644);
+ #else
+ module_param(dbg_level, int, 0);
+-#define STUB_DEBUG_FILE
+ #endif
+
+ #include "../core/usb.h"
+@@ -1907,20 +1908,6 @@ static int isp1362_bus_resume(struct usb
+
+ /*-------------------------------------------------------------------------*/
+
+-#ifdef STUB_DEBUG_FILE
+-
+-static inline void create_debug_file(struct isp1362_hcd *isp1362_hcd)
+-{
+-}
+-static inline void remove_debug_file(struct isp1362_hcd *isp1362_hcd)
+-{
+-}
+-
+-#else
+-
+-#include <linux/proc_fs.h>
+-#include <linux/seq_file.h>
+-
+ static void dump_irq(struct seq_file *s, char *label, u16 mask)
+ {
+ seq_printf(s, "%-15s %04x%s%s%s%s%s%s\n", label, mask,
+@@ -2063,7 +2050,7 @@ static void dump_regs(struct seq_file *s
+ isp1362_read_reg16(isp1362_hcd, HCATLDTCTO));
+ }
+
+-static int proc_isp1362_show(struct seq_file *s, void *unused)
++static int isp1362_show(struct seq_file *s, void *unused)
+ {
+ struct isp1362_hcd *isp1362_hcd = s->private;
+ struct isp1362_ep *ep;
+@@ -2167,41 +2154,31 @@ static int proc_isp1362_show(struct seq_
+ return 0;
+ }
+
+-static int proc_isp1362_open(struct inode *inode, struct file *file)
++static int isp1362_open(struct inode *inode, struct file *file)
+ {
+- return single_open(file, proc_isp1362_show, PDE_DATA(inode));
++ return single_open(file, isp1362_show, PDE_DATA(inode));
+ }
+
+-static const struct file_operations proc_ops = {
+- .open = proc_isp1362_open,
++static const struct file_operations debug_ops = {
++ .open = isp1362_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+ };
+
+ /* expect just one isp1362_hcd per system */
+-static const char proc_filename[] = "driver/isp1362";
+-
+ static void create_debug_file(struct isp1362_hcd *isp1362_hcd)
+ {
+- struct proc_dir_entry *pde;
+-
+- pde = proc_create_data(proc_filename, 0, NULL, &proc_ops, isp1362_hcd);
+- if (pde == NULL) {
+- pr_warning("%s: Failed to create debug file '%s'\n", __func__, proc_filename);
+- return;
+- }
+- isp1362_hcd->pde = pde;
++ isp1362_hcd->debug_file = debugfs_create_file("isp1362", S_IRUGO,
++ usb_debug_root,
++ isp1362_hcd, &debug_ops);
+ }
+
+ static void remove_debug_file(struct isp1362_hcd *isp1362_hcd)
+ {
+- if (isp1362_hcd->pde)
+- remove_proc_entry(proc_filename, NULL);
++ debugfs_remove(isp1362_hcd->debug_file);
+ }
+
+-#endif
+-
+ /*-------------------------------------------------------------------------*/
+
+ static void __isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd)
+--- a/drivers/usb/host/isp1362.h
++++ b/drivers/usb/host/isp1362.h
+@@ -480,7 +480,7 @@ struct isp1362_hcd {
+
+ struct isp1362_platform_data *board;
+
+- struct proc_dir_entry *pde;
++ struct dentry *debug_file;
+ unsigned long stat1, stat2, stat4, stat8, stat16;
+
+ /* HC registers */