summaryrefslogtreecommitdiffstats
path: root/sys/dev/evdev/evdev_private.h
diff options
context:
space:
mode:
authorgonzo <gonzo@FreeBSD.org>2016-10-22 16:38:39 +0000
committergonzo <gonzo@FreeBSD.org>2016-10-22 16:38:39 +0000
commit32ea5f778d1dc67ab08967d62ad31b12e70b7095 (patch)
tree62fe2fd620968748a2d93b9bf101cb13a040fcd2 /sys/dev/evdev/evdev_private.h
parent797c95b142be87731cfeb6bb6f2268e2218742cf (diff)
downloadFreeBSD-src-32ea5f778d1dc67ab08967d62ad31b12e70b7095.zip
FreeBSD-src-32ea5f778d1dc67ab08967d62ad31b12e70b7095.tar.gz
MFC r306647, r306855, r306857
r306647: const-ify struct evdev_methods Submitted by: Vladimir Kondratiev <wulf@cicgroup.ru> Suggested by: hselasky r306855: 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> r306857: Implement EVDEV_FLAG_MT_AUTOREL flag (autorelease touchpoints) Automaticaly release (send ABS_MT_TRACKING_ID = -1) MT-slots that has not been listed in current MT protocol type B report. Slot is counted as listed if corresponding ABS_MT_SLOT event has been sent regardless of other MT events. Events are sent on SYN_REPORT event. Submitted by: Vladimir Kondratiev <wulf@cicgroup.ru>
Diffstat (limited to 'sys/dev/evdev/evdev_private.h')
-rw-r--r--sys/dev/evdev/evdev_private.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/dev/evdev/evdev_private.h b/sys/dev/evdev/evdev_private.h
index 8e44ae5..b3de1bf 100644
--- a/sys/dev/evdev/evdev_private.h
+++ b/sys/dev/evdev/evdev_private.h
@@ -71,6 +71,12 @@ enum evdev_clock_id
EV_CLOCK_BOOTTIME /* monotonic, suspend-awared */
};
+enum evdev_lock_type
+{
+ EV_LOCK_INTERNAL = 0, /* Internal evdev mutex */
+ EV_LOCK_MTX, /* Driver`s mutex */
+};
+
struct evdev_dev
{
char ev_name[NAMELEN];
@@ -78,6 +84,8 @@ struct evdev_dev
char ev_serial[NAMELEN];
struct cdev * ev_cdev;
int ev_unit;
+ enum evdev_lock_type ev_lock_type;
+ struct mtx * ev_lock;
struct mtx ev_mtx;
struct input_id ev_id;
struct evdev_client * ev_grabber;
@@ -116,16 +124,16 @@ struct evdev_dev
uint64_t ev_report_count;
/* Parent driver callbacks: */
- struct evdev_methods * ev_methods;
+ const struct evdev_methods * ev_methods;
void * ev_softc;
LIST_ENTRY(evdev_dev) ev_link;
LIST_HEAD(, evdev_client) ev_clients;
};
-#define EVDEV_LOCK(evdev) mtx_lock(&(evdev)->ev_mtx)
-#define EVDEV_UNLOCK(evdev) mtx_unlock(&(evdev)->ev_mtx)
-#define EVDEV_LOCK_ASSERT(evdev) mtx_assert(&(evdev)->ev_mtx, MA_OWNED)
+#define EVDEV_LOCK(evdev) mtx_lock((evdev)->ev_lock)
+#define EVDEV_UNLOCK(evdev) mtx_unlock((evdev)->ev_lock)
+#define EVDEV_LOCK_ASSERT(evdev) mtx_assert((evdev)->ev_lock, MA_OWNED)
struct evdev_client
{
@@ -184,6 +192,7 @@ void evdev_set_last_mt_slot(struct evdev_dev *, int32_t);
int32_t evdev_get_mt_value(struct evdev_dev *, int32_t, int16_t);
void evdev_set_mt_value(struct evdev_dev *, int32_t, int16_t, int32_t);
void evdev_send_mt_compat(struct evdev_dev *);
+void evdev_send_mt_autorel(struct evdev_dev *);
/* Utility functions: */
void evdev_client_dumpqueue(struct evdev_client *);
OpenPOWER on IntegriCloud