On Wed, Jan 01, 2020 at 03:22:30PM +0100, Martin Pieuchot wrote:
> `sce' timeouts, like most of the USB timeouts are expressed in ms. So
> use MSEC_TO_NSEC() and tsleep_nsec(9) accordingly.
>
> Ok?
OK bluhm@
I prefer unique sleeping strings for easier debugging.
Can we change that to "ugenrint" and "ugenriso"?
> Index: ugen.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/usb/ugen.c,v
> retrieving revision 1.100
> diff -u -p -r1.100 ugen.c
> --- ugen.c 31 Dec 2019 13:48:31 -0000 1.100
> +++ ugen.c 1 Jan 2020 14:20:14 -0000
> @@ -510,8 +510,8 @@ ugen_do_read(struct ugen_softc *sc, int
> }
> sce->state |= UGEN_ASLP;
> DPRINTFN(5, ("ugenread: sleep on %p\n", sce));
> - error = tsleep(sce, PZERO | PCATCH, "ugenri",
> - (sce->timeout * hz) / 1000);
> + error = tsleep_nsec(sce, PZERO | PCATCH, "ugenri",
> + MSEC_TO_NSEC(sce->timeout));
> sce->state &= ~UGEN_ASLP;
> DPRINTFN(5, ("ugenread: woke, error=%d\n", error));
> if (usbd_is_dying(sc->sc_udev))
> @@ -582,8 +582,8 @@ ugen_do_read(struct ugen_softc *sc, int
> }
> sce->state |= UGEN_ASLP;
> DPRINTFN(5, ("ugenread: sleep on %p\n", sce));
> - error = tsleep(sce, PZERO | PCATCH, "ugenri",
> - (sce->timeout * hz) / 1000);
> + error = tsleep_nsec(sce, PZERO | PCATCH, "ugenri",
> + MSEC_TO_NSEC(sce->timeout));
> sce->state &= ~UGEN_ASLP;
> DPRINTFN(5, ("ugenread: woke, error=%d\n", error));
> if (usbd_is_dying(sc->sc_udev))