On Fri, Nov 27, 2020 at 07:42:52PM +0100, Marcus Glocker wrote:
> On Fri, Nov 27, 2020 at 12:57:02PM +0000, Mikolaj Kucharski wrote:
> 
> > I think something as simple as below would be okay. If requested I can
> > put in DPRINTFN()s based on current printf()s, like I proposed in
> > earlier diff in this thread. However more important part is, that I
> > think DIAGNOSTIC ifdef should be removed as rest of the code, which
> > relies on `if (curlen > len) curlen = len;` is not enclosed with
> > `#ifdef DIAGNOSTIC`
> 
> Right.  That code should be outside of DIAGNOSTIC.  Though I would
> leave the printf's in as DPRINTF's for the time being.  If you can
> send such a diff I'm fine.
>  

Sure. Here it is. Kernel GENERIC.MP builds and system with umb(4),
which started this email thread, runs with below diff.

Index: dev/usb/ehci.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/ehci.c,v
retrieving revision 1.212
diff -u -p -u -r1.212 ehci.c
--- dev/usb/ehci.c      23 Oct 2020 20:25:35 -0000      1.212
+++ dev/usb/ehci.c      27 Nov 2020 18:54:21 -0000
@@ -2393,16 +2406,16 @@ ehci_alloc_sqtd_chain(struct ehci_softc 
                        /* must use multiple TDs, fill as much as possible. */
                        curlen = EHCI_QTD_NBUFFERS * EHCI_PAGE_SIZE -
                                 EHCI_PAGE_OFFSET(dataphys);
-#ifdef DIAGNOSTIC
+
                        if (curlen > len) {
-                               printf("ehci_alloc_sqtd_chain: curlen=%u "
+                               DPRINTFN(1,("ehci_alloc_sqtd_chain: curlen=%u "
                                    "len=%u offs=0x%x\n", curlen, len,
-                                   EHCI_PAGE_OFFSET(dataphys));
-                               printf("lastpage=0x%x page=0x%x phys=0x%x\n",
-                                   dataphyslastpage, dataphyspage, dataphys);
+                                   EHCI_PAGE_OFFSET(dataphys)));
+                               DPRINTFN(1,("lastpage=0x%x page=0x%x 
phys=0x%x\n",
+                                   dataphyslastpage, dataphyspage, dataphys));
                                curlen = len;
                        }
-#endif
+
                        /* the length must be a multiple of the max size */
                        curlen -= curlen % mps;
                        DPRINTFN(1,("ehci_alloc_sqtd_chain: multiple QTDs, "

-- 
Regards,
 Mikolaj

Reply via email to