diff options
| author | Oleksandr Tymoshenko <gonzo@FreeBSD.org> | 2016-10-08 17:58:26 +0000 |
|---|---|---|
| committer | Oleksandr Tymoshenko <gonzo@FreeBSD.org> | 2016-10-08 17:58:26 +0000 |
| commit | bfbd1bb744b0f1091f0cd14467ec7d8b51560bee (patch) | |
| tree | 15b9c8641523314db1de35528ac5e4e1237ef8a8 /sys/dev/evdev/evdev_mt.c | |
| parent | ccb890b548216f9aa686131489d00d32a2ed55ea (diff) | |
Allow using of driver's mutex instead internal one for evdev locking.
Add new API call: evdev_register_mtx which takes lock argument that
should be used instead of internal one for evdev locking. Useful for
cases if evdev_push_event() is always called with driver's lock taken
and reduces amount of lock aquisitions. This allows to avoid LOR
between ev_open/ev_close invocations and evdev_push_event() Such LOR
can happen when ev_open/ev_close methods acquire driver lock and
evdev_push_event() is called with this lock taken.
Submitted by: Vladimir Kondratiev <wulf@cicgroup.ru>
Notes
svn path=/head/; revision=306855
Diffstat (limited to 'sys/dev/evdev/evdev_mt.c')
| -rw-r--r-- | sys/dev/evdev/evdev_mt.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/dev/evdev/evdev_mt.c b/sys/dev/evdev/evdev_mt.c index 1ff332cbaf30..ef36006ddaf6 100644 --- a/sys/dev/evdev/evdev_mt.c +++ b/sys/dev/evdev/evdev_mt.c @@ -227,9 +227,13 @@ void evdev_push_nfingers(struct evdev_dev *evdev, int32_t nfingers) { - EVDEV_LOCK(evdev); + if (evdev->ev_lock_type == EV_LOCK_INTERNAL) + EVDEV_LOCK(evdev); + else + EVDEV_LOCK_ASSERT(evdev); evdev_send_nfingers(evdev, nfingers); - EVDEV_UNLOCK(evdev); + if (evdev->ev_lock_type == EV_LOCK_INTERNAL) + EVDEV_UNLOCK(evdev); } void @@ -263,7 +267,11 @@ void evdev_push_mt_compat(struct evdev_dev *evdev) { - EVDEV_LOCK(evdev); + if (evdev->ev_lock_type == EV_LOCK_INTERNAL) + EVDEV_LOCK(evdev); + else + EVDEV_LOCK_ASSERT(evdev); evdev_send_mt_compat(evdev); - EVDEV_UNLOCK(evdev); + if (evdev->ev_lock_type == EV_LOCK_INTERNAL) + EVDEV_UNLOCK(evdev); } |
