Re: uow(4) & tsleep

2020-01-01 Thread Alexander Bluhm
On Wed, Jan 01, 2020 at 03:32:09PM +0100, Martin Pieuchot wrote:
> UOW_TIMEOUT is expressed in msec, so use MSEC_TO_NSEC() and tsleep_nsec(9)
> instead of dereferencing `hz'.
>
> Ok?

OK bluhm@

> Index: uow.c
> ===
> RCS file: /cvs/src/sys/dev/usb/uow.c,v
> retrieving revision 1.35
> diff -u -p -r1.35 uow.c
> --- uow.c 6 Nov 2016 12:58:01 -   1.35
> +++ uow.c 1 Jan 2020 14:23:19 -
> @@ -424,8 +424,8 @@ uow_cmd(struct uow_softc *sc, int type,
>   }
>
>  again:
> - if (tsleep(sc->sc_regs, PRIBIO, "uowcmd",
> - (UOW_TIMEOUT * hz) / 1000) != 0) {
> + if (tsleep_nsec(sc->sc_regs, PRIBIO, "uowcmd",
> + MSEC_TO_NSEC(UOW_TIMEOUT)) != 0) {
>   printf("%s: cmd timeout, type 0x%02x, cmd 0x%04x, "
>   "param 0x%04x\n", sc->sc_dev.dv_xname, type, cmd,
>   param);



uow(4) & tsleep

2020-01-01 Thread Martin Pieuchot
UOW_TIMEOUT is expressed in msec, so use MSEC_TO_NSEC() and tsleep_nsec(9)
instead of dereferencing `hz'.

Ok?

Index: uow.c
===
RCS file: /cvs/src/sys/dev/usb/uow.c,v
retrieving revision 1.35
diff -u -p -r1.35 uow.c
--- uow.c   6 Nov 2016 12:58:01 -   1.35
+++ uow.c   1 Jan 2020 14:23:19 -
@@ -424,8 +424,8 @@ uow_cmd(struct uow_softc *sc, int type, 
}
 
 again:
-   if (tsleep(sc->sc_regs, PRIBIO, "uowcmd",
-   (UOW_TIMEOUT * hz) / 1000) != 0) {
+   if (tsleep_nsec(sc->sc_regs, PRIBIO, "uowcmd",
+   MSEC_TO_NSEC(UOW_TIMEOUT)) != 0) {
printf("%s: cmd timeout, type 0x%02x, cmd 0x%04x, "
"param 0x%04x\n", sc->sc_dev.dv_xname, type, cmd,
param);