sunkbd: timeout_add(9) -> timeout_add_msec(9)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

sunkbd: timeout_add(9) -> timeout_add_msec(9)

Scott Cheloha
As per dev/wscons/wsconsio.h, wskbd_bell_data.period is a count of
milliseconds.

ok?

Index: sunkbd.c
===================================================================
RCS file: /cvs/src/sys/dev/sun/sunkbd.c,v
retrieving revision 1.27
diff -u -p -r1.27 sunkbd.c
--- sunkbd.c 19 Mar 2016 11:41:56 -0000 1.27
+++ sunkbd.c 22 Dec 2019 19:28:46 -0000
@@ -84,7 +84,7 @@ sunkbd_attach(struct sunkbd_softc *sc, s
 void
 sunkbd_bell(struct sunkbd_softc *sc, u_int period, u_int pitch, u_int volume)
 {
- int nticks, s;
+ int s;
  u_int8_t c = SKBD_CMD_BELLON;
 
 #if NTCTRL > 0
@@ -103,14 +103,10 @@ sunkbd_bell(struct sunkbd_softc *sc, u_i
  return;
  }
  if (sc->sc_bellactive == 0) {
- nticks = (period * hz) / 1000;
- if (nticks <= 0)
- nticks = 1;
-
  sc->sc_bellactive = 1;
  sc->sc_belltimeout = 1;
  (*sc->sc_sendcmd)(sc, &c, 1);
- timeout_add(&sc->sc_bellto, nticks);
+ timeout_add_msec(&sc->sc_bellto, period);
  }
  splx(s);
 }

Reply | Threaded
Open this post in threaded view
|

Re: sunkbd: timeout_add(9) -> timeout_add_msec(9)

Scott Cheloha
On Sun, Dec 22, 2019 at 01:34:54PM -0600, Scott Cheloha wrote:
> As per dev/wscons/wsconsio.h, wskbd_bell_data.period is a count of
> milliseconds.
>
> ok?

1 month bump.

> Index: sunkbd.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/sun/sunkbd.c,v
> retrieving revision 1.27
> diff -u -p -r1.27 sunkbd.c
> --- sunkbd.c 19 Mar 2016 11:41:56 -0000 1.27
> +++ sunkbd.c 22 Dec 2019 19:28:46 -0000
> @@ -84,7 +84,7 @@ sunkbd_attach(struct sunkbd_softc *sc, s
>  void
>  sunkbd_bell(struct sunkbd_softc *sc, u_int period, u_int pitch, u_int volume)
>  {
> - int nticks, s;
> + int s;
>   u_int8_t c = SKBD_CMD_BELLON;
>  
>  #if NTCTRL > 0
> @@ -103,14 +103,10 @@ sunkbd_bell(struct sunkbd_softc *sc, u_i
>   return;
>   }
>   if (sc->sc_bellactive == 0) {
> - nticks = (period * hz) / 1000;
> - if (nticks <= 0)
> - nticks = 1;
> -
>   sc->sc_bellactive = 1;
>   sc->sc_belltimeout = 1;
>   (*sc->sc_sendcmd)(sc, &c, 1);
> - timeout_add(&sc->sc_bellto, nticks);
> + timeout_add_msec(&sc->sc_bellto, period);
>   }
>   splx(s);
>  }