Use callout_setfunc/callout_schedule instead of callout_reset.
Use mstohz for the calculations.
This commit is contained in:
parent
1e1c64c041
commit
55e50c10e7
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wsdisplay_compat_usl.c,v 1.41 2007/07/09 21:01:26 ad Exp $ */
|
||||
/* $NetBSD: wsdisplay_compat_usl.c,v 1.42 2007/10/16 21:06:09 joerg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: wsdisplay_compat_usl.c,v 1.41 2007/07/09 21:01:26 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: wsdisplay_compat_usl.c,v 1.42 2007/10/16 21:06:09 joerg Exp $");
|
||||
|
||||
#include "opt_compat_freebsd.h"
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
@ -110,7 +110,9 @@ usl_sync_init(struct wsscreen *scr, struct usl_syncdata **sdp,
|
|||
sd->s_relsig = relsig;
|
||||
sd->s_frsig = frsig;
|
||||
callout_init(&sd->s_attach_ch, 0);
|
||||
callout_setfunc(&sd->s_attach_ch, usl_attachtimeout, sd);
|
||||
callout_init(&sd->s_detach_ch, 0);
|
||||
callout_setfunc(&sd->s_detach_ch, usl_detachtimeout, sd);
|
||||
res = wsscreen_attach_sync(scr, &usl_syncops, sd);
|
||||
if (res) {
|
||||
free(sd, M_DEVBUF);
|
||||
|
@ -183,8 +185,7 @@ usl_detachproc(void *cookie, int waitok,
|
|||
mutex_enter(&proclist_mutex);
|
||||
psignal(sd->s_proc, sd->s_relsig);
|
||||
mutex_exit(&proclist_mutex);
|
||||
callout_reset(&sd->s_detach_ch, wscompat_usl_synctimeout * hz,
|
||||
usl_detachtimeout, sd);
|
||||
callout_schedule(&sd->s_detach_ch, wscompat_usl_synctimeout * hz);
|
||||
|
||||
return (EAGAIN);
|
||||
}
|
||||
|
@ -245,8 +246,7 @@ usl_attachproc(void *cookie, int waitok,
|
|||
mutex_enter(&proclist_mutex);
|
||||
psignal(sd->s_proc, sd->s_acqsig);
|
||||
mutex_exit(&proclist_mutex);
|
||||
callout_reset(&sd->s_attach_ch, wscompat_usl_synctimeout * hz,
|
||||
usl_attachtimeout, sd);
|
||||
callout_schedule(&sd->s_attach_ch, wscompat_usl_synctimeout * hz);
|
||||
|
||||
return (EAGAIN);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wskbd.c,v 1.105 2007/08/06 03:07:52 macallan Exp $ */
|
||||
/* $NetBSD: wskbd.c,v 1.106 2007/10/16 21:06:09 joerg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
|
||||
|
@ -79,7 +79,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.105 2007/08/06 03:07:52 macallan Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.106 2007/10/16 21:06:09 joerg Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_kgdb.h"
|
||||
|
@ -415,6 +415,7 @@ wskbd_attach(struct device *parent, struct device *self, void *aux)
|
|||
}
|
||||
|
||||
callout_init(&sc->sc_repeat_ch, 0);
|
||||
callout_setfunc(&sc->sc_repeat_ch, wskbd_repeat, sc);
|
||||
|
||||
sc->id->t_sc = sc;
|
||||
|
||||
|
@ -531,8 +532,7 @@ wskbd_repeat(void *v)
|
|||
sc->sc_repeat_value);
|
||||
#endif /* defined(WSKBD_EVENT_AUTOREPEAT) */
|
||||
}
|
||||
callout_reset(&sc->sc_repeat_ch,
|
||||
(hz * sc->sc_keyrepeat_data.delN) / 1000, wskbd_repeat, sc);
|
||||
callout_schedule(&sc->sc_repeat_ch, mstohz(sc->sc_keyrepeat_data.delN));
|
||||
splx(s);
|
||||
}
|
||||
|
||||
|
@ -568,6 +568,9 @@ wskbd_detach(struct device *self, int flags)
|
|||
wsmux_detach_sc(&sc->sc_base);
|
||||
#endif
|
||||
|
||||
callout_stop(&sc->sc_repeat_ch);
|
||||
callout_destroy(&sc->sc_repeat_ch);
|
||||
|
||||
if (sc->sc_isconsole) {
|
||||
KASSERT(wskbd_console_device == sc);
|
||||
wskbd_console_device = NULL;
|
||||
|
@ -639,9 +642,8 @@ wskbd_input(struct device *dev, u_int type, int value)
|
|||
|
||||
if (sc->sc_keyrepeat_data.del1 != 0) {
|
||||
sc->sc_repeating = num;
|
||||
callout_reset(&sc->sc_repeat_ch,
|
||||
(hz * sc->sc_keyrepeat_data.del1) / 1000,
|
||||
wskbd_repeat, sc);
|
||||
callout_schedule(&sc->sc_repeat_ch,
|
||||
mstohz(sc->sc_keyrepeat_data.del1));
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -656,9 +658,8 @@ wskbd_input(struct device *dev, u_int type, int value)
|
|||
sc->sc_repeat_type = type;
|
||||
sc->sc_repeat_value = value;
|
||||
sc->sc_repeating = 1;
|
||||
callout_reset(&sc->sc_repeat_ch,
|
||||
(hz * sc->sc_keyrepeat_data.del1) / 1000,
|
||||
wskbd_repeat, sc);
|
||||
callout_schedule(&sc->sc_repeat_ch,
|
||||
mstohz(sc->sc_keyrepeat_data.del1));
|
||||
}
|
||||
#endif /* defined(WSKBD_EVENT_AUTOREPEAT) */
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wsmouse.c,v 1.52 2007/07/09 21:01:26 ad Exp $ */
|
||||
/* $NetBSD: wsmouse.c,v 1.53 2007/10/16 21:06:10 joerg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006 The NetBSD Foundation, Inc.
|
||||
|
@ -111,7 +111,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.52 2007/07/09 21:01:26 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.53 2007/10/16 21:06:10 joerg Exp $");
|
||||
|
||||
#include "wsmouse.h"
|
||||
#include "wsdisplay.h"
|
||||
|
@ -256,6 +256,7 @@ wsmouse_attach(struct device *parent, struct device *self, void *aux)
|
|||
sc->sc_repeat_button = -1;
|
||||
sc->sc_repeat_delay = 0;
|
||||
callout_init(&sc->sc_repeat_callout, 0);
|
||||
callout_setfunc(&sc->sc_repeat_callout, wsmouse_repeat, sc);
|
||||
|
||||
#if NWSMUX > 0
|
||||
sc->sc_base.me_ops = &wsmouse_srcops;
|
||||
|
@ -485,9 +486,8 @@ wsmouse_input(struct device *wsmousedev, u_int btns /* 0 is up */,
|
|||
sc->sc_repeat.wr_delay_first > 0) {
|
||||
sc->sc_repeat_button = btnno;
|
||||
sc->sc_repeat_delay = sc->sc_repeat.wr_delay_first;
|
||||
callout_reset(&sc->sc_repeat_callout,
|
||||
(hz * sc->sc_repeat_delay) / 1000, wsmouse_repeat,
|
||||
sc);
|
||||
callout_schedule(&sc->sc_repeat_callout,
|
||||
mstohz(sc->sc_repeat_delay));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -552,8 +552,7 @@ wsmouse_repeat(void *v)
|
|||
* Reprogram the repeating event.
|
||||
*/
|
||||
sc->sc_repeat_delay = newdelay;
|
||||
callout_reset(&sc->sc_repeat_callout, (hz * newdelay) / 1000,
|
||||
wsmouse_repeat, sc);
|
||||
callout_schedule(&sc->sc_repeat_callout, mstohz(newdelay));
|
||||
|
||||
splx(oldspl);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue