Commit a6363463 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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.
Reviewed-by: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0511b363
...@@ -78,6 +78,8 @@ ...@@ -78,6 +78,8 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/bitmap.h> #include <linux/bitmap.h>
#include <linux/prefetch.h> #include <linux/prefetch.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
...@@ -88,7 +90,6 @@ static int dbg_level; ...@@ -88,7 +90,6 @@ static int dbg_level;
module_param(dbg_level, int, 0644); module_param(dbg_level, int, 0644);
#else #else
module_param(dbg_level, int, 0); module_param(dbg_level, int, 0);
#define STUB_DEBUG_FILE
#endif #endif
#include "../core/usb.h" #include "../core/usb.h"
...@@ -1907,20 +1908,6 @@ static int isp1362_bus_resume(struct usb_hcd *hcd) ...@@ -1907,20 +1908,6 @@ static int isp1362_bus_resume(struct usb_hcd *hcd)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
#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) 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, 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, struct isp1362_hcd *isp1362_hcd) ...@@ -2063,7 +2050,7 @@ static void dump_regs(struct seq_file *s, struct isp1362_hcd *isp1362_hcd)
isp1362_read_reg16(isp1362_hcd, HCATLDTCTO)); 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_hcd *isp1362_hcd = s->private;
struct isp1362_ep *ep; struct isp1362_ep *ep;
...@@ -2167,41 +2154,31 @@ static int proc_isp1362_show(struct seq_file *s, void *unused) ...@@ -2167,41 +2154,31 @@ static int proc_isp1362_show(struct seq_file *s, void *unused)
return 0; 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, inode);
} }
static const struct file_operations proc_ops = { static const struct file_operations debug_ops = {
.open = proc_isp1362_open, .open = isp1362_open,
.read = seq_read, .read = seq_read,
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release, .release = single_release,
}; };
/* expect just one isp1362_hcd per system */ /* expect just one isp1362_hcd per system */
static const char proc_filename[] = "driver/isp1362";
static void create_debug_file(struct isp1362_hcd *isp1362_hcd) static void create_debug_file(struct isp1362_hcd *isp1362_hcd)
{ {
struct proc_dir_entry *pde; isp1362_hcd->debug_file = debugfs_create_file("isp1362", S_IRUGO,
usb_debug_root,
pde = proc_create_data(proc_filename, 0, NULL, &proc_ops, isp1362_hcd); isp1362_hcd, &debug_ops);
if (pde == NULL) {
pr_warning("%s: Failed to create debug file '%s'\n", __func__, proc_filename);
return;
}
isp1362_hcd->pde = pde;
} }
static void remove_debug_file(struct isp1362_hcd *isp1362_hcd) static void remove_debug_file(struct isp1362_hcd *isp1362_hcd)
{ {
if (isp1362_hcd->pde) debugfs_remove(isp1362_hcd->debug_file);
remove_proc_entry(proc_filename, NULL);
} }
#endif
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static void __isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd) static void __isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd)
......
...@@ -480,7 +480,7 @@ struct isp1362_hcd { ...@@ -480,7 +480,7 @@ struct isp1362_hcd {
struct isp1362_platform_data *board; struct isp1362_platform_data *board;
struct proc_dir_entry *pde; struct dentry *debug_file;
unsigned long stat1, stat2, stat4, stat8, stat16; unsigned long stat1, stat2, stat4, stat8, stat16;
/* HC registers */ /* HC registers */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment