Download raw body.
wsmux(4): mp-safe filterops
On Tue, 21 Jan 2025 22:22:06 +0100,
Vitaliy Makkoveev <mvs@openbsd.org> wrote:
>
> The next one of the wscons(4) devices.
>
Tested on touchpad at Huawei Matebook X 2020 with and without connected TEX
Shinobi. Using both, touchpad and trackpoint, works as expected.
OK kirill@
> Index: sys/dev/wscons/wsmux.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/wscons/wsmux.c,v
> retrieving revision 1.60
> diff -u -p -r1.60 wsmux.c
> --- sys/dev/wscons/wsmux.c 30 Dec 2024 02:46:00 -0000 1.60
> +++ sys/dev/wscons/wsmux.c 21 Jan 2025 21:09:22 -0000
> @@ -208,7 +208,7 @@ wsmuxopen(dev_t dev, int flags, int mode
> return (EBUSY);
>
> evar = &sc->sc_base.me_evar;
> - if (wsevent_init(evar))
> + if (wsevent_init_flags(evar, WSEVENT_MPSAFE))
> return (EBUSY);
> #ifdef WSDISPLAY_COMPAT_RAWKBD
> sc->sc_rawkbd = 0;
> @@ -385,7 +385,7 @@ wsmux_do_ioctl(struct device *dv, u_long
> struct wsmux_softc *sc = (struct wsmux_softc *)dv;
> struct wsevsrc *me;
> int error, ok;
> - int s, put, get, n;
> + int put, get, n;
> struct wseventvar *evar;
> struct wscons_event *ev;
> struct wsmux_device_list *l;
> @@ -415,13 +415,12 @@ wsmux_do_ioctl(struct device *dv, u_long
> return (0);
> }
>
> - s = spltty();
> + mtx_enter(&evar->ws_mtx);
> get = evar->ws_get;
> put = evar->ws_put;
> ev = &evar->ws_q[put];
> if (++put % WSEVENT_QSIZE == get) {
> - put--;
> - splx(s);
> + mtx_leave(&evar->ws_mtx);
> return (ENOSPC);
> }
> if (put >= WSEVENT_QSIZE)
> @@ -429,8 +428,8 @@ wsmux_do_ioctl(struct device *dv, u_long
> *ev = *(struct wscons_event *)data;
> nanotime(&ev->time);
> evar->ws_put = put;
> - WSEVENT_WAKEUP(evar);
> - splx(s);
> + mtx_leave(&evar->ws_mtx);
> + wsevent_wakeup(evar);
> return (0);
> case WSMUXIO_ADD_DEVICE:
> #define d ((struct wsmux_device *)data)
> @@ -496,7 +495,9 @@ wsmux_do_ioctl(struct device *dv, u_long
> evar = sc->sc_base.me_evp;
> if (evar == NULL)
> return (EINVAL);
> + mtx_enter(&evar->ws_mtx);
> evar->ws_async = *(int *)data != 0;
> + mtx_leave(&evar->ws_mtx);
> return (0);
> case FIOGETOWN:
> case TIOCGPGRP:
--
wbr, Kirill
wsmux(4): mp-safe filterops