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

USB: OHCI: use the ohci structure directly in debugfs files.

Right now we jump through some hoops to get to the struct ohci_hcd
struct in the ohci debugfs files.  Remove all of the fun casting around
and just use the pointer directly.

This is needed as the dev pointer in the hcd structure is going away,
and it makes the code simpler and smaller

Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 74675a58
...@@ -431,7 +431,7 @@ static struct dentry *ohci_debug_root; ...@@ -431,7 +431,7 @@ static struct dentry *ohci_debug_root;
struct debug_buffer { struct debug_buffer {
ssize_t (*fill_func)(struct debug_buffer *); /* fill method */ ssize_t (*fill_func)(struct debug_buffer *); /* fill method */
struct device *dev; struct ohci_hcd *ohci;
struct mutex mutex; /* protect filling of buffer */ struct mutex mutex; /* protect filling of buffer */
size_t count; /* number of characters filled into buffer */ size_t count; /* number of characters filled into buffer */
char *page; char *page;
...@@ -505,15 +505,11 @@ show_list (struct ohci_hcd *ohci, char *buf, size_t count, struct ed *ed) ...@@ -505,15 +505,11 @@ show_list (struct ohci_hcd *ohci, char *buf, size_t count, struct ed *ed)
static ssize_t fill_async_buffer(struct debug_buffer *buf) static ssize_t fill_async_buffer(struct debug_buffer *buf)
{ {
struct usb_bus *bus;
struct usb_hcd *hcd;
struct ohci_hcd *ohci; struct ohci_hcd *ohci;
size_t temp; size_t temp;
unsigned long flags; unsigned long flags;
bus = dev_get_drvdata(buf->dev); ohci = buf->ohci;
hcd = bus_to_hcd(bus);
ohci = hcd_to_ohci(hcd);
/* display control and bulk lists together, for simplicity */ /* display control and bulk lists together, for simplicity */
spin_lock_irqsave (&ohci->lock, flags); spin_lock_irqsave (&ohci->lock, flags);
...@@ -529,8 +525,6 @@ static ssize_t fill_async_buffer(struct debug_buffer *buf) ...@@ -529,8 +525,6 @@ static ssize_t fill_async_buffer(struct debug_buffer *buf)
static ssize_t fill_periodic_buffer(struct debug_buffer *buf) static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
{ {
struct usb_bus *bus;
struct usb_hcd *hcd;
struct ohci_hcd *ohci; struct ohci_hcd *ohci;
struct ed **seen, *ed; struct ed **seen, *ed;
unsigned long flags; unsigned long flags;
...@@ -542,9 +536,7 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf) ...@@ -542,9 +536,7 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
return 0; return 0;
seen_count = 0; seen_count = 0;
bus = (struct usb_bus *)dev_get_drvdata(buf->dev); ohci = buf->ohci;
hcd = bus_to_hcd(bus);
ohci = hcd_to_ohci(hcd);
next = buf->page; next = buf->page;
size = PAGE_SIZE; size = PAGE_SIZE;
...@@ -626,7 +618,6 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf) ...@@ -626,7 +618,6 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
static ssize_t fill_registers_buffer(struct debug_buffer *buf) static ssize_t fill_registers_buffer(struct debug_buffer *buf)
{ {
struct usb_bus *bus;
struct usb_hcd *hcd; struct usb_hcd *hcd;
struct ohci_hcd *ohci; struct ohci_hcd *ohci;
struct ohci_regs __iomem *regs; struct ohci_regs __iomem *regs;
...@@ -635,9 +626,8 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf) ...@@ -635,9 +626,8 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf)
char *next; char *next;
u32 rdata; u32 rdata;
bus = (struct usb_bus *)dev_get_drvdata(buf->dev); ohci = buf->ohci;
hcd = bus_to_hcd(bus); hcd = ohci_to_hcd(ohci);
ohci = hcd_to_ohci(hcd);
regs = ohci->regs; regs = ohci->regs;
next = buf->page; next = buf->page;
size = PAGE_SIZE; size = PAGE_SIZE;
...@@ -710,7 +700,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf) ...@@ -710,7 +700,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf)
return PAGE_SIZE - size; return PAGE_SIZE - size;
} }
static struct debug_buffer *alloc_buffer(struct device *dev, static struct debug_buffer *alloc_buffer(struct ohci_hcd *ohci,
ssize_t (*fill_func)(struct debug_buffer *)) ssize_t (*fill_func)(struct debug_buffer *))
{ {
struct debug_buffer *buf; struct debug_buffer *buf;
...@@ -718,7 +708,7 @@ static struct debug_buffer *alloc_buffer(struct device *dev, ...@@ -718,7 +708,7 @@ static struct debug_buffer *alloc_buffer(struct device *dev,
buf = kzalloc(sizeof(struct debug_buffer), GFP_KERNEL); buf = kzalloc(sizeof(struct debug_buffer), GFP_KERNEL);
if (buf) { if (buf) {
buf->dev = dev; buf->ohci = ohci;
buf->fill_func = fill_func; buf->fill_func = fill_func;
mutex_init(&buf->mutex); mutex_init(&buf->mutex);
} }
...@@ -810,26 +800,25 @@ static int debug_registers_open(struct inode *inode, struct file *file) ...@@ -810,26 +800,25 @@ static int debug_registers_open(struct inode *inode, struct file *file)
static inline void create_debug_files (struct ohci_hcd *ohci) static inline void create_debug_files (struct ohci_hcd *ohci)
{ {
struct usb_bus *bus = &ohci_to_hcd(ohci)->self; struct usb_bus *bus = &ohci_to_hcd(ohci)->self;
struct device *dev = bus->dev;
ohci->debug_dir = debugfs_create_dir(bus->bus_name, ohci_debug_root); ohci->debug_dir = debugfs_create_dir(bus->bus_name, ohci_debug_root);
if (!ohci->debug_dir) if (!ohci->debug_dir)
goto dir_error; goto dir_error;
ohci->debug_async = debugfs_create_file("async", S_IRUGO, ohci->debug_async = debugfs_create_file("async", S_IRUGO,
ohci->debug_dir, dev, ohci->debug_dir, ohci,
&debug_async_fops); &debug_async_fops);
if (!ohci->debug_async) if (!ohci->debug_async)
goto async_error; goto async_error;
ohci->debug_periodic = debugfs_create_file("periodic", S_IRUGO, ohci->debug_periodic = debugfs_create_file("periodic", S_IRUGO,
ohci->debug_dir, dev, ohci->debug_dir, ohci,
&debug_periodic_fops); &debug_periodic_fops);
if (!ohci->debug_periodic) if (!ohci->debug_periodic)
goto periodic_error; goto periodic_error;
ohci->debug_registers = debugfs_create_file("registers", S_IRUGO, ohci->debug_registers = debugfs_create_file("registers", S_IRUGO,
ohci->debug_dir, dev, ohci->debug_dir, ohci,
&debug_registers_fops); &debug_registers_fops);
if (!ohci->debug_registers) if (!ohci->debug_registers)
goto registers_error; goto registers_error;
......
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