diff options
| author | Vladimir Kondratyev <wulf@FreeBSD.org> | 2017-10-19 20:16:40 +0000 |
|---|---|---|
| committer | Vladimir Kondratyev <wulf@FreeBSD.org> | 2017-10-19 20:16:40 +0000 |
| commit | b99304f34f675d4d07bae220e70cfb36ed07a620 (patch) | |
| tree | 6f9f0a512c211fa41e1013d6d21cc80ee3745582 /sys/dev/evdev | |
| parent | 2f8f6dd4ed2d327174a54de3233f58f9d864951d (diff) | |
Notes
Diffstat (limited to 'sys/dev/evdev')
| -rw-r--r-- | sys/dev/evdev/cdev.c | 19 | ||||
| -rw-r--r-- | sys/dev/evdev/evdev.c | 24 | ||||
| -rw-r--r-- | sys/dev/evdev/evdev_mt.c | 22 | ||||
| -rw-r--r-- | sys/dev/evdev/evdev_private.h | 17 | ||||
| -rw-r--r-- | sys/dev/evdev/evdev_utils.c | 11 | ||||
| -rw-r--r-- | sys/dev/evdev/input-event-codes.h | 2 | ||||
| -rw-r--r-- | sys/dev/evdev/input.h | 4 | ||||
| -rw-r--r-- | sys/dev/evdev/uinput.c | 19 | ||||
| -rw-r--r-- | sys/dev/evdev/uinput.h | 2 |
9 files changed, 58 insertions, 62 deletions
diff --git a/sys/dev/evdev/cdev.c b/sys/dev/evdev/cdev.c index 62534a4c339e..f53002929b9a 100644 --- a/sys/dev/evdev/cdev.c +++ b/sys/dev/evdev/cdev.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Jakub Wojciech Klama <jceel@FreeBSD.org> - * Copyright (c) 2015-2016 Vladimir Kondratyev <wulf@cicgroup.ru> + * Copyright (c) 2015-2016 Vladimir Kondratyev <wulf@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,24 +29,23 @@ #include "opt_evdev.h" -#include <sys/types.h> -#include <sys/bitstring.h> -#include <sys/systm.h> #include <sys/param.h> -#include <sys/kernel.h> +#include <sys/bitstring.h> #include <sys/conf.h> -#include <sys/uio.h> -#include <sys/proc.h> -#include <sys/poll.h> #include <sys/filio.h> #include <sys/fcntl.h> -#include <sys/selinfo.h> +#include <sys/kernel.h> #include <sys/malloc.h> +#include <sys/poll.h> +#include <sys/proc.h> +#include <sys/selinfo.h> +#include <sys/systm.h> #include <sys/time.h> +#include <sys/uio.h> -#include <dev/evdev/input.h> #include <dev/evdev/evdev.h> #include <dev/evdev/evdev_private.h> +#include <dev/evdev/input.h> #ifdef EVDEV_DEBUG #define debugf(client, fmt, args...) printf("evdev cdev: "fmt"\n", ##args) diff --git a/sys/dev/evdev/evdev.c b/sys/dev/evdev/evdev.c index 9827a7a9cd91..e580a08f98f6 100644 --- a/sys/dev/evdev/evdev.c +++ b/sys/dev/evdev/evdev.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Jakub Wojciech Klama <jceel@FreeBSD.org> - * Copyright (c) 2015-2016 Vladimir Kondratyev <wulf@cicgroup.ru> + * Copyright (c) 2015-2016 Vladimir Kondratyev <wulf@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,19 +29,18 @@ #include "opt_evdev.h" -#include <sys/types.h> -#include <sys/systm.h> #include <sys/param.h> -#include <sys/kernel.h> -#include <sys/module.h> +#include <sys/bitstring.h> #include <sys/conf.h> +#include <sys/kernel.h> #include <sys/malloc.h> -#include <sys/bitstring.h> +#include <sys/module.h> #include <sys/sysctl.h> +#include <sys/systm.h> -#include <dev/evdev/input.h> #include <dev/evdev/evdev.h> #include <dev/evdev/evdev_private.h> +#include <dev/evdev/input.h> #ifdef EVDEV_DEBUG #define debugf(evdev, fmt, args...) printf("evdev: " fmt "\n", ##args) @@ -758,14 +757,11 @@ evdev_push_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, int32_t value) { - if (evdev->ev_lock_type != EV_LOCK_INTERNAL) - EVDEV_LOCK_ASSERT(evdev); - if (evdev_check_event(evdev, type, code, value) != 0) return (EINVAL); - if (evdev->ev_lock_type == EV_LOCK_INTERNAL) - EVDEV_LOCK(evdev); + EVDEV_ENTER(evdev); + evdev_modify_event(evdev, type, code, &value); if (type == EV_SYN && code == SYN_REPORT && bit_test(evdev->ev_flags, EVDEV_FLAG_MT_AUTOREL)) @@ -774,8 +770,8 @@ evdev_push_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, bit_test(evdev->ev_flags, EVDEV_FLAG_MT_STCOMPAT)) evdev_send_mt_compat(evdev); evdev_send_event(evdev, type, code, value); - if (evdev->ev_lock_type == EV_LOCK_INTERNAL) - EVDEV_UNLOCK(evdev); + + EVDEV_EXIT(evdev); return (0); } diff --git a/sys/dev/evdev/evdev_mt.c b/sys/dev/evdev/evdev_mt.c index 82f36d8478e2..fc19e497c691 100644 --- a/sys/dev/evdev/evdev_mt.c +++ b/sys/dev/evdev/evdev_mt.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Vladimir Kondratyev <wulf@cicgroup.ru> + * Copyright (c) 2016 Vladimir Kondratyev <wulf@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,14 +27,14 @@ */ #include <sys/param.h> -#include <sys/malloc.h> #include <sys/lock.h> +#include <sys/malloc.h> #include <sys/mutex.h> #include <sys/systm.h> -#include <dev/evdev/input.h> #include <dev/evdev/evdev.h> #include <dev/evdev/evdev_private.h> +#include <dev/evdev/input.h> #ifdef DEBUG #define debugf(fmt, args...) printf("evdev: " fmt "\n", ##args) @@ -224,13 +224,9 @@ void evdev_push_nfingers(struct evdev_dev *evdev, int32_t nfingers) { - if (evdev->ev_lock_type == EV_LOCK_INTERNAL) - EVDEV_LOCK(evdev); - else - EVDEV_LOCK_ASSERT(evdev); + EVDEV_ENTER(evdev); evdev_send_nfingers(evdev, nfingers); - if (evdev->ev_lock_type == EV_LOCK_INTERNAL) - EVDEV_UNLOCK(evdev); + EVDEV_EXIT(evdev); } void @@ -264,13 +260,9 @@ void evdev_push_mt_compat(struct evdev_dev *evdev) { - if (evdev->ev_lock_type == EV_LOCK_INTERNAL) - EVDEV_LOCK(evdev); - else - EVDEV_LOCK_ASSERT(evdev); + EVDEV_ENTER(evdev); evdev_send_mt_compat(evdev); - if (evdev->ev_lock_type == EV_LOCK_INTERNAL) - EVDEV_UNLOCK(evdev); + EVDEV_EXIT(evdev); } void diff --git a/sys/dev/evdev/evdev_private.h b/sys/dev/evdev/evdev_private.h index b3de1bf0fa40..05206a9d09bd 100644 --- a/sys/dev/evdev/evdev_private.h +++ b/sys/dev/evdev/evdev_private.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Jakub Wojciech Klama <jceel@FreeBSD.org> - * Copyright (c) 2015-2016 Vladimir Kondratyev <wulf@cicgroup.ru> + * Copyright (c) 2015-2016 Vladimir Kondratyev <wulf@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,10 +31,11 @@ #define _DEV_EVDEV_EVDEV_PRIVATE_H #include <sys/bitstring.h> -#include <sys/queue.h> -#include <sys/malloc.h> #include <sys/kbio.h> +#include <sys/malloc.h> +#include <sys/queue.h> #include <sys/selinfo.h> + #include <dev/evdev/evdev.h> #include <dev/evdev/input.h> #include <dev/kbd/kbdreg.h> @@ -134,6 +135,16 @@ struct evdev_dev #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) +#define EVDEV_ENTER(evdev) do { \ + if ((evdev)->ev_lock_type == EV_LOCK_INTERNAL) \ + EVDEV_LOCK(evdev); \ + else \ + EVDEV_LOCK_ASSERT(evdev); \ +} while (0) +#define EVDEV_EXIT(evdev) do { \ + if ((evdev)->ev_lock_type == EV_LOCK_INTERNAL) \ + EVDEV_UNLOCK(evdev); \ +} while (0) struct evdev_client { diff --git a/sys/dev/evdev/evdev_utils.c b/sys/dev/evdev/evdev_utils.c index 5436ab55d967..e0b1104f7424 100644 --- a/sys/dev/evdev/evdev_utils.c +++ b/sys/dev/evdev/evdev_utils.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Jakub Wojciech Klama <jceel@FreeBSD.org> - * Copyright (c) 2015-2016 Vladimir Kondratyev <wulf@cicgroup.ru> + * Copyright (c) 2015-2016 Vladimir Kondratyev <wulf@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,17 +27,16 @@ * $FreeBSD$ */ -#include <sys/types.h> -#include <sys/systm.h> #include <sys/param.h> #include <sys/bus.h> -#include <sys/kernel.h> #include <sys/conf.h> -#include <sys/malloc.h> #include <sys/kbio.h> +#include <sys/kernel.h> +#include <sys/malloc.h> +#include <sys/systm.h> -#include <dev/evdev/input.h> #include <dev/evdev/evdev.h> +#include <dev/evdev/input.h> #include <dev/kbd/kbdreg.h> diff --git a/sys/dev/evdev/input-event-codes.h b/sys/dev/evdev/input-event-codes.h index 78ba7d2ed900..cc1528f6e316 100644 --- a/sys/dev/evdev/input-event-codes.h +++ b/sys/dev/evdev/input-event-codes.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2016 Oleksandr Tymoshenko <gonzo@FreeBSD.org> - * Copyright (c) 2015-2016 Vladimir Kondratyev <wulf@cicgroup.ru> + * Copyright (c) 2015-2016 Vladimir Kondratyev <wulf@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/evdev/input.h b/sys/dev/evdev/input.h index 04638444d964..7639e0d67e0f 100644 --- a/sys/dev/evdev/input.h +++ b/sys/dev/evdev/input.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2016 Oleksandr Tymoshenko <gonzo@FreeBSD.org> - * Copyright (c) 2015-2016 Vladimir Kondratyev <wulf@cicgroup.ru> + * Copyright (c) 2015-2016 Vladimir Kondratyev <wulf@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,8 +31,8 @@ #define _EVDEV_INPUT_H #ifndef __KERNEL__ -#include <sys/time.h> #include <sys/ioccom.h> +#include <sys/time.h> #include <sys/types.h> #endif diff --git a/sys/dev/evdev/uinput.c b/sys/dev/evdev/uinput.c index f6d397605b9a..3ed2e13b2053 100644 --- a/sys/dev/evdev/uinput.c +++ b/sys/dev/evdev/uinput.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Jakub Wojciech Klama <jceel@FreeBSD.org> - * Copyright (c) 2015-2016 Vladimir Kondratyev <wulf@cicgroup.ru> + * Copyright (c) 2015-2016 Vladimir Kondratyev <wulf@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,25 +29,24 @@ #include "opt_evdev.h" -#include <sys/types.h> -#include <sys/systm.h> #include <sys/param.h> +#include <sys/conf.h> #include <sys/fcntl.h> #include <sys/kernel.h> +#include <sys/lock.h> +#include <sys/malloc.h> #include <sys/module.h> -#include <sys/conf.h> -#include <sys/uio.h> -#include <sys/proc.h> #include <sys/poll.h> +#include <sys/proc.h> #include <sys/selinfo.h> -#include <sys/malloc.h> -#include <sys/lock.h> +#include <sys/systm.h> #include <sys/sx.h> +#include <sys/uio.h> -#include <dev/evdev/input.h> -#include <dev/evdev/uinput.h> #include <dev/evdev/evdev.h> #include <dev/evdev/evdev_private.h> +#include <dev/evdev/input.h> +#include <dev/evdev/uinput.h> #ifdef UINPUT_DEBUG #define debugf(state, fmt, args...) printf("uinput: " fmt "\n", ##args) diff --git a/sys/dev/evdev/uinput.h b/sys/dev/evdev/uinput.h index f1721e19646c..dd4b0a82c1d3 100644 --- a/sys/dev/evdev/uinput.h +++ b/sys/dev/evdev/uinput.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2016 Oleksandr Tymoshenko <gonzo@FreeBSD.org> - * Copyright (c) 2015-2016 Vladimir Kondratyev <wulf@cicgroup.ru> + * Copyright (c) 2015-2016 Vladimir Kondratyev <wulf@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without |
