]> git.hungrycats.org Git - linux/commitdiff
[PATCH] ohci/ehci debug updates for 2.5.56
authorKevin Brosius <cobra@compuserve.com>
Mon, 13 Jan 2003 05:53:41 +0000 (21:53 -0800)
committerGreg Kroah-Hartman <greg@kroah.com>
Mon, 13 Jan 2003 05:53:41 +0000 (21:53 -0800)
  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.

drivers/usb/host/ehci-dbg.c
drivers/usb/host/ohci-dbg.c

index 6dcc5b9fcdbee0a24c69c04c65eec904cfcbc0ef..5a5dbee4dd887d6aefead4029f20cba04ba7efb5 100644 (file)
@@ -325,7 +325,7 @@ static void qh_lines (struct ehci_qh *qh, char **nextp, unsigned *sizep)
 }
 
 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 ehci_hcd         *ehci;
@@ -334,13 +334,10 @@ show_async (struct device *dev, char *buf, size_t count, loff_t off)
        char                    *next;
        struct ehci_qh          *qh;
 
-       if (off != 0)
-               return 0;
-
        pdev = container_of (dev, struct pci_dev, dev);
        ehci = container_of (pci_get_drvdata (pdev), struct ehci_hcd, hcd);
        next = buf;
-       size = count;
+       size = PAGE_SIZE;
 
        /* dumps a snapshot of the async schedule.
         * 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)
        }
        spin_unlock_irqrestore (&ehci->lock, flags);
 
-       return count - size;
+       return PAGE_SIZE - size;
 }
 static DEVICE_ATTR (async, S_IRUGO, show_async, NULL);
 
 #define DBG_SCHED_LIMIT 64
 
 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 ehci_hcd         *ehci;
@@ -375,8 +372,6 @@ show_periodic (struct device *dev, char *buf, size_t count, loff_t off)
        char                    *next;
        unsigned                i, tag;
 
-       if (off != 0)
-               return 0;
        if (!(seen = kmalloc (DBG_SCHED_LIMIT * sizeof *seen, SLAB_ATOMIC)))
                return 0;
        seen_count = 0;
@@ -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);
        ehci = container_of (pci_get_drvdata (pdev), struct ehci_hcd, hcd);
        next = buf;
-       size = count;
+       size = PAGE_SIZE;
 
        temp = snprintf (next, size, "size = %d\n", ehci->periodic_size);
        size -= temp;
@@ -468,14 +463,14 @@ show_periodic (struct device *dev, char *buf, size_t count, loff_t off)
        spin_unlock_irqrestore (&ehci->lock, flags);
        kfree (seen);
 
-       return count - size;
+       return PAGE_SIZE - size;
 }
 static DEVICE_ATTR (periodic, S_IRUGO, show_periodic, NULL);
 
 #undef DBG_SCHED_LIMIT
 
 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 ehci_hcd         *ehci;
@@ -485,14 +480,11 @@ show_registers (struct device *dev, char *buf, size_t count, loff_t off)
        static char             fmt [] = "%*s\n";
        static char             label [] = "";
 
-       if (off != 0)
-               return 0;
-
        pdev = container_of (dev, struct pci_dev, dev);
        ehci = container_of (pci_get_drvdata (pdev), struct ehci_hcd, hcd);
 
        next = buf;
-       size = count;
+       size = PAGE_SIZE;
 
        spin_lock_irqsave (&ehci->lock, flags);
 
@@ -568,7 +560,7 @@ show_registers (struct device *dev, char *buf, size_t count, loff_t off)
 
        spin_unlock_irqrestore (&ehci->lock, flags);
 
-       return count - size;
+       return PAGE_SIZE - size;
 }
 static DEVICE_ATTR (registers, S_IRUGO, show_registers, NULL);
 
index 406290b54b8b3f8dc6ed2bab354bf2d7adc8c0a3..de2d530e8e7472ad2ecedc99bf92b92d7207cfcd 100644 (file)
@@ -9,7 +9,7 @@
  */
  
 /*-------------------------------------------------------------------------*/
+
 #ifdef DEBUG
 
 #define edstring(ed_type) ({ char *temp; \
@@ -396,24 +396,21 @@ show_list (struct ohci_hcd *ohci, char *buf, size_t count, struct ed *ed)
 }
 
 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;
        size_t                  temp;
        unsigned long           flags;
 
-       if (off != 0)
-               return 0;
-
        ohci = dev_to_ohci(dev);
 
        /* display control and bulk lists together, for simplicity */
        spin_lock_irqsave (&ohci->lock, flags);
-       temp = show_list (ohci, buf, count, ohci->ed_controltail);
-       count = show_list (ohci, buf + temp, count - temp, ohci->ed_bulktail);
+       temp = show_list (ohci, buf, PAGE_SIZE, ohci->ed_controltail);
+       temp += show_list (ohci, buf + temp, PAGE_SIZE - temp, ohci->ed_bulktail);
        spin_unlock_irqrestore (&ohci->lock, flags);
 
-       return temp + count;
+       return temp;
 }
 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
 
 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 ed               **seen, *ed;
@@ -430,15 +427,13 @@ show_periodic (struct device *dev, char *buf, size_t count, loff_t off)
        char                    *next;
        unsigned                i;
 
-       if (off != 0)
-               return 0;
        if (!(seen = kmalloc (DBG_SCHED_LIMIT * sizeof *seen, SLAB_ATOMIC)))
                return 0;
        seen_count = 0;
 
        ohci = dev_to_ohci(dev);
        next = buf;
-       size = count;
+       size = PAGE_SIZE;
 
        temp = snprintf (next, size, "size = %d\n", NUM_INTS);
        size -= temp;
@@ -506,10 +501,11 @@ show_periodic (struct device *dev, char *buf, size_t count, loff_t off)
        spin_unlock_irqrestore (&ohci->lock, flags);
        kfree (seen);
 
-       return count - size;
+       return PAGE_SIZE - size;
 }
 static DEVICE_ATTR (periodic, S_IRUGO, show_periodic, NULL);
 
+
 #undef DBG_SCHED_LIMIT
 
 static inline void create_debug_files (struct ohci_hcd *bus)