diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2009-04-27 16:12:58 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-06-16 00:44:43 -0400 |
commit | 109833417cd0bf27089fcca5b0d6a44c8d592452 (patch) | |
tree | 33e10aadbcd3f3de64ffabf502d39c7d658b01f6 /drivers/usb/host/ohci-dbg.c | |
parent | 74675a58507e769beee7d949dbed788af3c4139d (diff) |
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: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/ohci-dbg.c')
-rw-r--r-- | drivers/usb/host/ohci-dbg.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c index d3269656aa4d..811f5dfdc582 100644 --- a/drivers/usb/host/ohci-dbg.c +++ b/drivers/usb/host/ohci-dbg.c | |||
@@ -431,7 +431,7 @@ static struct dentry *ohci_debug_root; | |||
431 | 431 | ||
432 | struct debug_buffer { | 432 | struct debug_buffer { |
433 | ssize_t (*fill_func)(struct debug_buffer *); /* fill method */ | 433 | ssize_t (*fill_func)(struct debug_buffer *); /* fill method */ |
434 | struct device *dev; | 434 | struct ohci_hcd *ohci; |
435 | struct mutex mutex; /* protect filling of buffer */ | 435 | struct mutex mutex; /* protect filling of buffer */ |
436 | size_t count; /* number of characters filled into buffer */ | 436 | size_t count; /* number of characters filled into buffer */ |
437 | char *page; | 437 | char *page; |
@@ -505,15 +505,11 @@ show_list (struct ohci_hcd *ohci, char *buf, size_t count, struct ed *ed) | |||
505 | 505 | ||
506 | static ssize_t fill_async_buffer(struct debug_buffer *buf) | 506 | static ssize_t fill_async_buffer(struct debug_buffer *buf) |
507 | { | 507 | { |
508 | struct usb_bus *bus; | ||
509 | struct usb_hcd *hcd; | ||
510 | struct ohci_hcd *ohci; | 508 | struct ohci_hcd *ohci; |
511 | size_t temp; | 509 | size_t temp; |
512 | unsigned long flags; | 510 | unsigned long flags; |
513 | 511 | ||
514 | bus = dev_get_drvdata(buf->dev); | 512 | ohci = buf->ohci; |
515 | hcd = bus_to_hcd(bus); | ||
516 | ohci = hcd_to_ohci(hcd); | ||
517 | 513 | ||
518 | /* display control and bulk lists together, for simplicity */ | 514 | /* display control and bulk lists together, for simplicity */ |
519 | spin_lock_irqsave (&ohci->lock, flags); | 515 | spin_lock_irqsave (&ohci->lock, flags); |
@@ -529,8 +525,6 @@ static ssize_t fill_async_buffer(struct debug_buffer *buf) | |||
529 | 525 | ||
530 | static ssize_t fill_periodic_buffer(struct debug_buffer *buf) | 526 | static ssize_t fill_periodic_buffer(struct debug_buffer *buf) |
531 | { | 527 | { |
532 | struct usb_bus *bus; | ||
533 | struct usb_hcd *hcd; | ||
534 | struct ohci_hcd *ohci; | 528 | struct ohci_hcd *ohci; |
535 | struct ed **seen, *ed; | 529 | struct ed **seen, *ed; |
536 | unsigned long flags; | 530 | unsigned long flags; |
@@ -542,9 +536,7 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf) | |||
542 | return 0; | 536 | return 0; |
543 | seen_count = 0; | 537 | seen_count = 0; |
544 | 538 | ||
545 | bus = (struct usb_bus *)dev_get_drvdata(buf->dev); | 539 | ohci = buf->ohci; |
546 | hcd = bus_to_hcd(bus); | ||
547 | ohci = hcd_to_ohci(hcd); | ||
548 | next = buf->page; | 540 | next = buf->page; |
549 | size = PAGE_SIZE; | 541 | size = PAGE_SIZE; |
550 | 542 | ||
@@ -626,7 +618,6 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf) | |||
626 | 618 | ||
627 | static ssize_t fill_registers_buffer(struct debug_buffer *buf) | 619 | static ssize_t fill_registers_buffer(struct debug_buffer *buf) |
628 | { | 620 | { |
629 | struct usb_bus *bus; | ||
630 | struct usb_hcd *hcd; | 621 | struct usb_hcd *hcd; |
631 | struct ohci_hcd *ohci; | 622 | struct ohci_hcd *ohci; |
632 | struct ohci_regs __iomem *regs; | 623 | struct ohci_regs __iomem *regs; |
@@ -635,9 +626,8 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf) | |||
635 | char *next; | 626 | char *next; |
636 | u32 rdata; | 627 | u32 rdata; |
637 | 628 | ||
638 | bus = (struct usb_bus *)dev_get_drvdata(buf->dev); | 629 | ohci = buf->ohci; |
639 | hcd = bus_to_hcd(bus); | 630 | hcd = ohci_to_hcd(ohci); |
640 | ohci = hcd_to_ohci(hcd); | ||
641 | regs = ohci->regs; | 631 | regs = ohci->regs; |
642 | next = buf->page; | 632 | next = buf->page; |
643 | size = PAGE_SIZE; | 633 | size = PAGE_SIZE; |
@@ -710,7 +700,7 @@ done: | |||
710 | return PAGE_SIZE - size; | 700 | return PAGE_SIZE - size; |
711 | } | 701 | } |
712 | 702 | ||
713 | static struct debug_buffer *alloc_buffer(struct device *dev, | 703 | static struct debug_buffer *alloc_buffer(struct ohci_hcd *ohci, |
714 | ssize_t (*fill_func)(struct debug_buffer *)) | 704 | ssize_t (*fill_func)(struct debug_buffer *)) |
715 | { | 705 | { |
716 | struct debug_buffer *buf; | 706 | struct debug_buffer *buf; |
@@ -718,7 +708,7 @@ static struct debug_buffer *alloc_buffer(struct device *dev, | |||
718 | buf = kzalloc(sizeof(struct debug_buffer), GFP_KERNEL); | 708 | buf = kzalloc(sizeof(struct debug_buffer), GFP_KERNEL); |
719 | 709 | ||
720 | if (buf) { | 710 | if (buf) { |
721 | buf->dev = dev; | 711 | buf->ohci = ohci; |
722 | buf->fill_func = fill_func; | 712 | buf->fill_func = fill_func; |
723 | mutex_init(&buf->mutex); | 713 | mutex_init(&buf->mutex); |
724 | } | 714 | } |
@@ -810,26 +800,25 @@ static int debug_registers_open(struct inode *inode, struct file *file) | |||
810 | static inline void create_debug_files (struct ohci_hcd *ohci) | 800 | static inline void create_debug_files (struct ohci_hcd *ohci) |
811 | { | 801 | { |
812 | struct usb_bus *bus = &ohci_to_hcd(ohci)->self; | 802 | struct usb_bus *bus = &ohci_to_hcd(ohci)->self; |
813 | struct device *dev = bus->dev; | ||
814 | 803 | ||
815 | ohci->debug_dir = debugfs_create_dir(bus->bus_name, ohci_debug_root); | 804 | ohci->debug_dir = debugfs_create_dir(bus->bus_name, ohci_debug_root); |
816 | if (!ohci->debug_dir) | 805 | if (!ohci->debug_dir) |
817 | goto dir_error; | 806 | goto dir_error; |
818 | 807 | ||
819 | ohci->debug_async = debugfs_create_file("async", S_IRUGO, | 808 | ohci->debug_async = debugfs_create_file("async", S_IRUGO, |
820 | ohci->debug_dir, dev, | 809 | ohci->debug_dir, ohci, |
821 | &debug_async_fops); | 810 | &debug_async_fops); |
822 | if (!ohci->debug_async) | 811 | if (!ohci->debug_async) |
823 | goto async_error; | 812 | goto async_error; |
824 | 813 | ||
825 | ohci->debug_periodic = debugfs_create_file("periodic", S_IRUGO, | 814 | ohci->debug_periodic = debugfs_create_file("periodic", S_IRUGO, |
826 | ohci->debug_dir, dev, | 815 | ohci->debug_dir, ohci, |
827 | &debug_periodic_fops); | 816 | &debug_periodic_fops); |
828 | if (!ohci->debug_periodic) | 817 | if (!ohci->debug_periodic) |
829 | goto periodic_error; | 818 | goto periodic_error; |
830 | 819 | ||
831 | ohci->debug_registers = debugfs_create_file("registers", S_IRUGO, | 820 | ohci->debug_registers = debugfs_create_file("registers", S_IRUGO, |
832 | ohci->debug_dir, dev, | 821 | ohci->debug_dir, ohci, |
833 | &debug_registers_fops); | 822 | &debug_registers_fops); |
834 | if (!ohci->debug_registers) | 823 | if (!ohci->debug_registers) |
835 | goto registers_error; | 824 | goto registers_error; |