evdev: Use console lock as evdev lock for all supported keyboard drivers.
Now evdev part of keyboard drivers does not take any locks if corresponding input/eventN device node is not opened by userland consumers. Do not assert console lock inside evdev to handle the cases when keyboard driver is called from some special single-threaded context like shutdown thread.
This commit is contained in:
parent
b5532964e7
commit
f86e7267f5
@ -484,7 +484,7 @@ atkbd_init(int unit, keyboard_t **kbdp, void *arg, int flags)
|
|||||||
evdev_support_led(evdev, LED_CAPSL);
|
evdev_support_led(evdev, LED_CAPSL);
|
||||||
evdev_support_led(evdev, LED_SCROLLL);
|
evdev_support_led(evdev, LED_SCROLLL);
|
||||||
|
|
||||||
if (evdev_register(evdev))
|
if (evdev_register_mtx(evdev, &Giant))
|
||||||
evdev_free(evdev);
|
evdev_free(evdev);
|
||||||
else
|
else
|
||||||
state->ks_evdev = evdev;
|
state->ks_evdev = evdev;
|
||||||
|
@ -132,9 +132,14 @@ struct evdev_dev
|
|||||||
LIST_HEAD(, evdev_client) ev_clients;
|
LIST_HEAD(, evdev_client) ev_clients;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define SYSTEM_CONSOLE_LOCK &Giant
|
||||||
|
|
||||||
#define EVDEV_LOCK(evdev) mtx_lock((evdev)->ev_lock)
|
#define EVDEV_LOCK(evdev) mtx_lock((evdev)->ev_lock)
|
||||||
#define EVDEV_UNLOCK(evdev) mtx_unlock((evdev)->ev_lock)
|
#define EVDEV_UNLOCK(evdev) mtx_unlock((evdev)->ev_lock)
|
||||||
#define EVDEV_LOCK_ASSERT(evdev) mtx_assert((evdev)->ev_lock, MA_OWNED)
|
#define EVDEV_LOCK_ASSERT(evdev) do { \
|
||||||
|
if ((evdev)->ev_lock != SYSTEM_CONSOLE_LOCK) \
|
||||||
|
mtx_assert((evdev)->ev_lock, MA_OWNED); \
|
||||||
|
} while (0)
|
||||||
#define EVDEV_ENTER(evdev) do { \
|
#define EVDEV_ENTER(evdev) do { \
|
||||||
if ((evdev)->ev_lock_type == EV_LOCK_INTERNAL) \
|
if ((evdev)->ev_lock_type == EV_LOCK_INTERNAL) \
|
||||||
EVDEV_LOCK(evdev); \
|
EVDEV_LOCK(evdev); \
|
||||||
|
@ -505,7 +505,7 @@ kbdmux_init(int unit, keyboard_t **kbdp, void *arg, int flags)
|
|||||||
evdev_support_led(evdev, LED_CAPSL);
|
evdev_support_led(evdev, LED_CAPSL);
|
||||||
evdev_support_led(evdev, LED_SCROLLL);
|
evdev_support_led(evdev, LED_SCROLLL);
|
||||||
|
|
||||||
if (evdev_register(evdev))
|
if (evdev_register_mtx(evdev, &Giant))
|
||||||
evdev_free(evdev);
|
evdev_free(evdev);
|
||||||
else
|
else
|
||||||
state->ks_evdev = evdev;
|
state->ks_evdev = evdev;
|
||||||
|
@ -1361,7 +1361,7 @@ ukbd_attach(device_t dev)
|
|||||||
if (sc->sc_flags & UKBD_FLAG_SCROLLLOCK)
|
if (sc->sc_flags & UKBD_FLAG_SCROLLLOCK)
|
||||||
evdev_support_led(evdev, LED_SCROLLL);
|
evdev_support_led(evdev, LED_SCROLLL);
|
||||||
|
|
||||||
if (evdev_register(evdev))
|
if (evdev_register_mtx(evdev, &Giant))
|
||||||
evdev_free(evdev);
|
evdev_free(evdev);
|
||||||
else
|
else
|
||||||
sc->sc_evdev = evdev;
|
sc->sc_evdev = evdev;
|
||||||
|
Loading…
Reference in New Issue
Block a user