Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [5.0] USB device ignored on boot



On Sun, 19 Jul 2009, Andreas Wrede wrote:

> I also noticed that the output from the attach of the second uplcom(4) adapter
> gets intermixed with other boot messages:
>
> [...]
> ucom0 at uplcom0
> uplcom1 at uhub1 port 1boot device: wd0
> root on wd0a dumps on wd0b
>
> uplcom1: Prolific Technology Inc. USB-Serial Controller, rev 1.10/3.00, addr 2
> [...]

going back to this, I've noticed the same issues with several other USB
drivers during attachment and I think I've tracked it down to the
following construct:

        devinfop = usbd_devinfo_alloc(dev, 0);
        USB_ATTACH_SETUP;
        aprint_normal_dev(self, "%s\n", devinfop);
        usbd_devinfo_free(devinfop);

the USB_ATTACH_SETUP is printing the newline but (perhaps) when we call
usbd_devinfo_alloc() it does some malloc() and allows a context switch
The following patch should fix the issue with uplcom:

Index: uplcom.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/uplcom.c,v
retrieving revision 1.67
diff -u -r1.67 uplcom.c
--- uplcom.c    20 Nov 2008 10:50:42 -0000      1.67
+++ uplcom.c    22 Sep 2009 08:13:29 -0000
@@ -227,8 +227,8 @@

        sc->sc_dev = self;

-       devinfop = usbd_devinfo_alloc(dev, 0);
        USB_ATTACH_SETUP;
+       devinfop = usbd_devinfo_alloc(dev, 0);
        aprint_normal_dev(self, "%s\n", devinfop);
        usbd_devinfo_free(devinfop);

are there any objections to committing a similar change in all the USB
drivers? (personally, I would prefer to expand the macro too but thats
another issue :)

iain




Home | Main Index | Thread Index | Old Index