Commit 023c5be4 authored by Kevin Brosius's avatar Kevin Brosius Committed by Greg Kroah-Hartman

[PATCH] ohci/ehci debug updates for 2.5.56

  These two files needed to be touched after the recent changes to
DRIVER_ATTR/driver_attribute structure members in 2.5.56.  Personally,
it doesn't look to me like the size parameter should be removed, as now
users will need to hardcode PAGE_SIZE into their functions, rather than
it being passed from the place of allocation.  But I'm not familiar with
the driverfs changes, so can't really say.

These changes, or something similar, are needed to make ohci-dbg and
ehci-dbg work at all in 2.5.56.  ehci is untested, but compiles here.
I've tested the ohci changes and they appear to work.
parent fa4229ad
...@@ -325,7 +325,7 @@ static void qh_lines (struct ehci_qh *qh, char **nextp, unsigned *sizep) ...@@ -325,7 +325,7 @@ static void qh_lines (struct ehci_qh *qh, char **nextp, unsigned *sizep)
} }
static ssize_t static ssize_t
show_async (struct device *dev, char *buf, size_t count, loff_t off) show_async (struct device *dev, char *buf)
{ {
struct pci_dev *pdev; struct pci_dev *pdev;
struct ehci_hcd *ehci; struct ehci_hcd *ehci;
...@@ -334,13 +334,10 @@ show_async (struct device *dev, char *buf, size_t count, loff_t off) ...@@ -334,13 +334,10 @@ show_async (struct device *dev, char *buf, size_t count, loff_t off)
char *next; char *next;
struct ehci_qh *qh; struct ehci_qh *qh;
if (off != 0)
return 0;
pdev = container_of (dev, struct pci_dev, dev); pdev = container_of (dev, struct pci_dev, dev);
ehci = container_of (pci_get_drvdata (pdev), struct ehci_hcd, hcd); ehci = container_of (pci_get_drvdata (pdev), struct ehci_hcd, hcd);
next = buf; next = buf;
size = count; size = PAGE_SIZE;
/* dumps a snapshot of the async schedule. /* dumps a snapshot of the async schedule.
* usually empty except for long-term bulk reads, or head. * usually empty except for long-term bulk reads, or head.
...@@ -358,14 +355,14 @@ show_async (struct device *dev, char *buf, size_t count, loff_t off) ...@@ -358,14 +355,14 @@ show_async (struct device *dev, char *buf, size_t count, loff_t off)
} }
spin_unlock_irqrestore (&ehci->lock, flags); spin_unlock_irqrestore (&ehci->lock, flags);
return count - size; return PAGE_SIZE - size;
} }
static DEVICE_ATTR (async, S_IRUGO, show_async, NULL); static DEVICE_ATTR (async, S_IRUGO, show_async, NULL);
#define DBG_SCHED_LIMIT 64 #define DBG_SCHED_LIMIT 64
static ssize_t static ssize_t
show_periodic (struct device *dev, char *buf, size_t count, loff_t off) show_periodic (struct device *dev, char *buf)
{ {
struct pci_dev *pdev; struct pci_dev *pdev;
struct ehci_hcd *ehci; struct ehci_hcd *ehci;
...@@ -375,8 +372,6 @@ show_periodic (struct device *dev, char *buf, size_t count, loff_t off) ...@@ -375,8 +372,6 @@ show_periodic (struct device *dev, char *buf, size_t count, loff_t off)
char *next; char *next;
unsigned i, tag; unsigned i, tag;
if (off != 0)
return 0;
if (!(seen = kmalloc (DBG_SCHED_LIMIT * sizeof *seen, SLAB_ATOMIC))) if (!(seen = kmalloc (DBG_SCHED_LIMIT * sizeof *seen, SLAB_ATOMIC)))
return 0; return 0;
seen_count = 0; seen_count = 0;
...@@ -384,7 +379,7 @@ show_periodic (struct device *dev, char *buf, size_t count, loff_t off) ...@@ -384,7 +379,7 @@ show_periodic (struct device *dev, char *buf, size_t count, loff_t off)
pdev = container_of (dev, struct pci_dev, dev); pdev = container_of (dev, struct pci_dev, dev);
ehci = container_of (pci_get_drvdata (pdev), struct ehci_hcd, hcd); ehci = container_of (pci_get_drvdata (pdev), struct ehci_hcd, hcd);
next = buf; next = buf;
size = count; size = PAGE_SIZE;
temp = snprintf (next, size, "size = %d\n", ehci->periodic_size); temp = snprintf (next, size, "size = %d\n", ehci->periodic_size);
size -= temp; size -= temp;
...@@ -468,14 +463,14 @@ show_periodic (struct device *dev, char *buf, size_t count, loff_t off) ...@@ -468,14 +463,14 @@ show_periodic (struct device *dev, char *buf, size_t count, loff_t off)
spin_unlock_irqrestore (&ehci->lock, flags); spin_unlock_irqrestore (&ehci->lock, flags);
kfree (seen); kfree (seen);
return count - size; return PAGE_SIZE - size;
} }
static DEVICE_ATTR (periodic, S_IRUGO, show_periodic, NULL); static DEVICE_ATTR (periodic, S_IRUGO, show_periodic, NULL);
#undef DBG_SCHED_LIMIT #undef DBG_SCHED_LIMIT
static ssize_t static ssize_t
show_registers (struct device *dev, char *buf, size_t count, loff_t off) show_registers (struct device *dev, char *buf)
{ {
struct pci_dev *pdev; struct pci_dev *pdev;
struct ehci_hcd *ehci; struct ehci_hcd *ehci;
...@@ -485,14 +480,11 @@ show_registers (struct device *dev, char *buf, size_t count, loff_t off) ...@@ -485,14 +480,11 @@ show_registers (struct device *dev, char *buf, size_t count, loff_t off)
static char fmt [] = "%*s\n"; static char fmt [] = "%*s\n";
static char label [] = ""; static char label [] = "";
if (off != 0)
return 0;
pdev = container_of (dev, struct pci_dev, dev); pdev = container_of (dev, struct pci_dev, dev);
ehci = container_of (pci_get_drvdata (pdev), struct ehci_hcd, hcd); ehci = container_of (pci_get_drvdata (pdev), struct ehci_hcd, hcd);
next = buf; next = buf;
size = count; size = PAGE_SIZE;
spin_lock_irqsave (&ehci->lock, flags); spin_lock_irqsave (&ehci->lock, flags);
...@@ -568,7 +560,7 @@ show_registers (struct device *dev, char *buf, size_t count, loff_t off) ...@@ -568,7 +560,7 @@ show_registers (struct device *dev, char *buf, size_t count, loff_t off)
spin_unlock_irqrestore (&ehci->lock, flags); spin_unlock_irqrestore (&ehci->lock, flags);
return count - size; return PAGE_SIZE - size;
} }
static DEVICE_ATTR (registers, S_IRUGO, show_registers, NULL); static DEVICE_ATTR (registers, S_IRUGO, show_registers, NULL);
......
...@@ -396,24 +396,21 @@ show_list (struct ohci_hcd *ohci, char *buf, size_t count, struct ed *ed) ...@@ -396,24 +396,21 @@ show_list (struct ohci_hcd *ohci, char *buf, size_t count, struct ed *ed)
} }
static ssize_t static ssize_t
show_async (struct device *dev, char *buf, size_t count, loff_t off) show_async (struct device *dev, char *buf)
{ {
struct ohci_hcd *ohci; struct ohci_hcd *ohci;
size_t temp; size_t temp;
unsigned long flags; unsigned long flags;
if (off != 0)
return 0;
ohci = dev_to_ohci(dev); ohci = dev_to_ohci(dev);
/* 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);
temp = show_list (ohci, buf, count, ohci->ed_controltail); temp = show_list (ohci, buf, PAGE_SIZE, ohci->ed_controltail);
count = show_list (ohci, buf + temp, count - temp, ohci->ed_bulktail); temp += show_list (ohci, buf + temp, PAGE_SIZE - temp, ohci->ed_bulktail);
spin_unlock_irqrestore (&ohci->lock, flags); spin_unlock_irqrestore (&ohci->lock, flags);
return temp + count; return temp;
} }
static DEVICE_ATTR (async, S_IRUGO, show_async, NULL); static DEVICE_ATTR (async, S_IRUGO, show_async, NULL);
...@@ -421,7 +418,7 @@ static DEVICE_ATTR (async, S_IRUGO, show_async, NULL); ...@@ -421,7 +418,7 @@ static DEVICE_ATTR (async, S_IRUGO, show_async, NULL);
#define DBG_SCHED_LIMIT 64 #define DBG_SCHED_LIMIT 64
static ssize_t static ssize_t
show_periodic (struct device *dev, char *buf, size_t count, loff_t off) show_periodic (struct device *dev, char *buf)
{ {
struct ohci_hcd *ohci; struct ohci_hcd *ohci;
struct ed **seen, *ed; struct ed **seen, *ed;
...@@ -430,15 +427,13 @@ show_periodic (struct device *dev, char *buf, size_t count, loff_t off) ...@@ -430,15 +427,13 @@ show_periodic (struct device *dev, char *buf, size_t count, loff_t off)
char *next; char *next;
unsigned i; unsigned i;
if (off != 0)
return 0;
if (!(seen = kmalloc (DBG_SCHED_LIMIT * sizeof *seen, SLAB_ATOMIC))) if (!(seen = kmalloc (DBG_SCHED_LIMIT * sizeof *seen, SLAB_ATOMIC)))
return 0; return 0;
seen_count = 0; seen_count = 0;
ohci = dev_to_ohci(dev); ohci = dev_to_ohci(dev);
next = buf; next = buf;
size = count; size = PAGE_SIZE;
temp = snprintf (next, size, "size = %d\n", NUM_INTS); temp = snprintf (next, size, "size = %d\n", NUM_INTS);
size -= temp; size -= temp;
...@@ -506,10 +501,11 @@ show_periodic (struct device *dev, char *buf, size_t count, loff_t off) ...@@ -506,10 +501,11 @@ show_periodic (struct device *dev, char *buf, size_t count, loff_t off)
spin_unlock_irqrestore (&ohci->lock, flags); spin_unlock_irqrestore (&ohci->lock, flags);
kfree (seen); kfree (seen);
return count - size; return PAGE_SIZE - size;
} }
static DEVICE_ATTR (periodic, S_IRUGO, show_periodic, NULL); static DEVICE_ATTR (periodic, S_IRUGO, show_periodic, NULL);
#undef DBG_SCHED_LIMIT #undef DBG_SCHED_LIMIT
static inline void create_debug_files (struct ohci_hcd *bus) static inline void create_debug_files (struct ohci_hcd *bus)
......
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