Amit Kulkarni <[email protected]> wrote:

> Hi,
> 
> Referring to the end of mpi's message, and also mlarkin@ later comment 
> https://marc.info/?l=openbsd-tech&m=154577028830964&w=2
> 
> I am trying to replace some easy timeout_add() calls with timeout_add_msec().
> 
> My current understanding with the occurences of timeout_add() in the tree is 
> that: if there is a hardcoded call like timeout_add(struct timeout, 1), then 
> replace with timeout_add_msec(struct timeout, 10). That is, 1 tick = 10 msec.
> 
> So if there's a hardcoded call like timeout_add(struct timeout, 5), then 
> replace with timeout_add_msec(struct timeout, 50).
> 
> If there are hz calculations which I don't understand like for example in 
> /sys/arch/alpha/tc/ioasic.c, then I am skipping these for now.
>         if (alpha_led_blink != 0) {
>                 timeout_set(&led_blink_state.tmo, ioasic_led_blink, NULL);
>                 timeout_add(&led_blink_state.tmo,
>                     (((averunnable.ldavg[0] + FSCALE) * hz) >> (FSHIFT + 3)));
>         }
> 
> A call like timeout_add(struct timeout, 0) is replaced by an equivalent call 
> to timeout_add_msec(struct timeout, 0).
> 
> Both the above scenarios are in the following diff and un-tested (not 
> compiled also, for now), no way I can test some of these, as I don't have 
> access to hardware. Mainly looking for critical review and feedback to get 
> this going in the right direction.
> 
> Thanks for your time!
> 
> diff --git arch/alpha/alpha/promcons.c arch/alpha/alpha/promcons.c
> index 9efabd3bf1c..b872f6e3931 100644
> --- arch/alpha/alpha/promcons.c
> +++ arch/alpha/alpha/promcons.c
> @@ -100,7 +100,7 @@ promopen(dev, flag, mode, p)
>       error = (*linesw[tp->t_line].l_open)(dev, tp, p);
>       if (error == 0 && setuptimeout) {
>               timeout_set(&prom_to, promtimeout, tp);
> -             timeout_add(&prom_to, 1);
> +             timeout_add_msec(&prom_to, 10);
>       }
>       return error;
>  }
> @@ -220,7 +220,7 @@ promtimeout(v)
>               if (tp->t_state & TS_ISOPEN)
>                       (*linesw[tp->t_line].l_rint)(c, tp);
>       }
> -     timeout_add(&prom_to, 1);
> +     timeout_add_msec(&prom_to, 10);
>  }
>  
>  struct tty *

I am glad you have an alpha, and will be able to test your proposed change.

Reply via email to