From owner-svn-src-stable-11@freebsd.org Thu Oct 19 20:16:42 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14705E4642E; Thu, 19 Oct 2017 20:16:42 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E1EBA7E1BD; Thu, 19 Oct 2017 20:16:41 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9JKGfup031105; Thu, 19 Oct 2017 20:16:41 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9JKGeTc031095; Thu, 19 Oct 2017 20:16:40 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201710192016.v9JKGeTc031095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Thu, 19 Oct 2017 20:16:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r324768 - stable/11/sys/dev/evdev X-SVN-Group: stable-11 X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: stable/11/sys/dev/evdev X-SVN-Commit-Revision: 324768 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Oct 2017 20:16:42 -0000 Author: wulf Date: Thu Oct 19 20:16:40 2017 New Revision: 324768 URL: https://svnweb.freebsd.org/changeset/base/324768 Log: MFC r321397-r321399 r321397: evdev: style(9), sort headers alphabetically r321398: evdev: Macroize common locking sequences r321399: Change my email address to wulf@FreeBSD.org in copyright headers. Approved by: gonzo (mentor) Modified: stable/11/sys/dev/evdev/cdev.c stable/11/sys/dev/evdev/evdev.c stable/11/sys/dev/evdev/evdev_mt.c stable/11/sys/dev/evdev/evdev_private.h stable/11/sys/dev/evdev/evdev_utils.c stable/11/sys/dev/evdev/input-event-codes.h stable/11/sys/dev/evdev/input.h stable/11/sys/dev/evdev/uinput.c stable/11/sys/dev/evdev/uinput.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/evdev/cdev.c ============================================================================== --- stable/11/sys/dev/evdev/cdev.c Thu Oct 19 18:04:16 2017 (r324767) +++ stable/11/sys/dev/evdev/cdev.c Thu Oct 19 20:16:40 2017 (r324768) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Jakub Wojciech Klama - * Copyright (c) 2015-2016 Vladimir Kondratyev + * Copyright (c) 2015-2016 Vladimir Kondratyev * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,24 +29,23 @@ #include "opt_evdev.h" -#include -#include -#include #include -#include +#include #include -#include -#include -#include #include #include -#include +#include #include +#include +#include +#include +#include #include +#include -#include #include #include +#include #ifdef EVDEV_DEBUG #define debugf(client, fmt, args...) printf("evdev cdev: "fmt"\n", ##args) Modified: stable/11/sys/dev/evdev/evdev.c ============================================================================== --- stable/11/sys/dev/evdev/evdev.c Thu Oct 19 18:04:16 2017 (r324767) +++ stable/11/sys/dev/evdev/evdev.c Thu Oct 19 20:16:40 2017 (r324768) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Jakub Wojciech Klama - * Copyright (c) 2015-2016 Vladimir Kondratyev + * Copyright (c) 2015-2016 Vladimir Kondratyev * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,19 +29,18 @@ #include "opt_evdev.h" -#include -#include #include -#include -#include +#include #include +#include #include -#include +#include #include +#include -#include #include #include +#include #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 typ 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 typ 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); } Modified: stable/11/sys/dev/evdev/evdev_mt.c ============================================================================== --- stable/11/sys/dev/evdev/evdev_mt.c Thu Oct 19 18:04:16 2017 (r324767) +++ stable/11/sys/dev/evdev/evdev_mt.c Thu Oct 19 20:16:40 2017 (r324768) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Vladimir Kondratyev + * Copyright (c) 2016 Vladimir Kondratyev * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,14 +27,14 @@ */ #include -#include #include +#include #include #include -#include #include #include +#include #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 Modified: stable/11/sys/dev/evdev/evdev_private.h ============================================================================== --- stable/11/sys/dev/evdev/evdev_private.h Thu Oct 19 18:04:16 2017 (r324767) +++ stable/11/sys/dev/evdev/evdev_private.h Thu Oct 19 20:16:40 2017 (r324768) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Jakub Wojciech Klama - * Copyright (c) 2015-2016 Vladimir Kondratyev + * Copyright (c) 2015-2016 Vladimir Kondratyev * 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 -#include -#include #include +#include +#include #include + #include #include #include @@ -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 { Modified: stable/11/sys/dev/evdev/evdev_utils.c ============================================================================== --- stable/11/sys/dev/evdev/evdev_utils.c Thu Oct 19 18:04:16 2017 (r324767) +++ stable/11/sys/dev/evdev/evdev_utils.c Thu Oct 19 20:16:40 2017 (r324768) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Jakub Wojciech Klama - * Copyright (c) 2015-2016 Vladimir Kondratyev + * Copyright (c) 2015-2016 Vladimir Kondratyev * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,17 +27,16 @@ * $FreeBSD$ */ -#include -#include #include #include -#include #include -#include #include +#include +#include +#include -#include #include +#include #include Modified: stable/11/sys/dev/evdev/input-event-codes.h ============================================================================== --- stable/11/sys/dev/evdev/input-event-codes.h Thu Oct 19 18:04:16 2017 (r324767) +++ stable/11/sys/dev/evdev/input-event-codes.h Thu Oct 19 20:16:40 2017 (r324768) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2016 Oleksandr Tymoshenko - * Copyright (c) 2015-2016 Vladimir Kondratyev + * Copyright (c) 2015-2016 Vladimir Kondratyev * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/11/sys/dev/evdev/input.h ============================================================================== --- stable/11/sys/dev/evdev/input.h Thu Oct 19 18:04:16 2017 (r324767) +++ stable/11/sys/dev/evdev/input.h Thu Oct 19 20:16:40 2017 (r324768) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2016 Oleksandr Tymoshenko - * Copyright (c) 2015-2016 Vladimir Kondratyev + * Copyright (c) 2015-2016 Vladimir Kondratyev * 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 #include +#include #include #endif Modified: stable/11/sys/dev/evdev/uinput.c ============================================================================== --- stable/11/sys/dev/evdev/uinput.c Thu Oct 19 18:04:16 2017 (r324767) +++ stable/11/sys/dev/evdev/uinput.c Thu Oct 19 20:16:40 2017 (r324768) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Jakub Wojciech Klama - * Copyright (c) 2015-2016 Vladimir Kondratyev + * Copyright (c) 2015-2016 Vladimir Kondratyev * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,25 +29,24 @@ #include "opt_evdev.h" -#include -#include #include +#include #include #include +#include +#include #include -#include -#include -#include #include +#include #include -#include -#include +#include #include +#include -#include -#include #include #include +#include +#include #ifdef UINPUT_DEBUG #define debugf(state, fmt, args...) printf("uinput: " fmt "\n", ##args) Modified: stable/11/sys/dev/evdev/uinput.h ============================================================================== --- stable/11/sys/dev/evdev/uinput.h Thu Oct 19 18:04:16 2017 (r324767) +++ stable/11/sys/dev/evdev/uinput.h Thu Oct 19 20:16:40 2017 (r324768) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2016 Oleksandr Tymoshenko - * Copyright (c) 2015-2016 Vladimir Kondratyev + * Copyright (c) 2015-2016 Vladimir Kondratyev * All rights reserved. * * Redistribution and use in source and binary forms, with or without