From patchwork Mon Nov 2 13:35:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: WEN Pingbo X-Patchwork-Id: 7536701 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D8EF9BEEA4 for ; Mon, 2 Nov 2015 13:36:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01AD8203B4 for ; Mon, 2 Nov 2015 13:36:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F3DDB2035D for ; Mon, 2 Nov 2015 13:36:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752832AbbKBNgr (ORCPT ); Mon, 2 Nov 2015 08:36:47 -0500 Received: from mail-pa0-f48.google.com ([209.85.220.48]:33459 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752532AbbKBNgq (ORCPT ); Mon, 2 Nov 2015 08:36:46 -0500 Received: by pabfh17 with SMTP id fh17so25431850pab.0 for ; Mon, 02 Nov 2015 05:36:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/rw3R4lvkntLeJu/VcgiJUPwJFHQKQyFZ7RbMUEdr7I=; b=qPjnSGAkOWW5fxADykWwLT8nIzA5taG9szo9WwPP5FAE7tYKz4hrtoADEac6zVKrru 4cMml7rNWIsu6tHRIYOUWXtmrut1eEd57l13DYZKiJoNvBuX+3eCd7U/O7DycXNFulIl zARNZtdyCcTmxVVppQAB4abFdoGBfDZ8eAsmLd+y7mNQ+JfZ9Sf/iwIcjlCGt7bY1KaL EeqcGElnx9UOOesMwDYQIpRympxqGxxTLXV66822QTDuHPfd2O2wV3o/VXMbLHrqXPtc HVrAyj3CaHq5MKFq5QNWyY1Sx9Rs8rNb9TlwCTz63djmSgjlIKqK9Ah2HaX+R98wODYQ 36Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/rw3R4lvkntLeJu/VcgiJUPwJFHQKQyFZ7RbMUEdr7I=; b=gwBh8YOY11NgSgxGCEJVRcyk4w2WXijXKzEJYdpeA3s8e3S3Irj4G7ZQVLrVoqsQn9 RijRqsENXGiCMXIO9DJpk6lzqpGDAM/FUgDIvQj/FAmZIkWoulB4faB/umQa03joWrvt 5YMzpd3Smi9eCftBqolNI/fVK4/YqswqlTBuY/bDzXpEiMCuguysPKmIfEsKf9Lli49A KNv2OjCDx+GqVGFtxu2GrJoBCRJ8k2cwSeN6LZyLduZwn75IxoQlcIXuFfYnUL+eJPpi TnDlUMKlXWuB9valnIHSXS0WAkMfU2HJg8O86YjqaUb2U9Z9KHKbj6Gi/BzFii6nYX6C s4Ag== X-Gm-Message-State: ALoCoQnugt0jCxo1LIUZjU+hgg/UEmvOPfqHQkxQVWKotlhw9rQTVKnVAQU/Pi7IWOGF/9OSDnwN X-Received: by 10.66.102.97 with SMTP id fn1mr26806814pab.77.1446471406447; Mon, 02 Nov 2015 05:36:46 -0800 (PST) Received: from localhost.localdomain (edge03.meizu.com. [202.130.115.78]) by smtp.gmail.com with ESMTPSA id si10sm24240302pab.15.2015.11.02.05.36.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Nov 2015 05:36:45 -0800 (PST) From: WEN Pingbo To: linux-input@vger.kernel.org Cc: y2038@lists.linaro.org, arnd@arndb.de, dmitry.torokhov@gmail.com, WEN Pingbo Subject: [PATCH 3/3] uinput: convert input_event to input_event64 Date: Mon, 2 Nov 2015 21:35:39 +0800 Message-Id: <1446471339-25464-4-git-send-email-pingbo.wen@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446471339-25464-1-git-send-email-pingbo.wen@linaro.org> References: <1446471339-25464-1-git-send-email-pingbo.wen@linaro.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP evdev has converted to input_event64, so is uinput. Since uinput uses input_event to talk with driver, we hardcode is_input_event64 flag here directly. Signed-off-by: WEN Pingbo --- drivers/input/misc/uinput.c | 17 +++++++++++------ include/linux/uinput.h | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index 5adbced..d60dc6f 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c @@ -50,7 +50,7 @@ static int uinput_dev_event(struct input_dev *dev, udev->buff[udev->head].type = type; udev->buff[udev->head].code = code; udev->buff[udev->head].value = value; - do_gettimeofday(&udev->buff[udev->head].time); + getnstimeofday64(&udev->buff[udev->head].time); udev->head = (udev->head + 1) % UINPUT_BUFFER_SIZE; wake_up_interruptible(&udev->waitq); @@ -436,7 +436,7 @@ static int uinput_setup_device(struct uinput_device *udev, static ssize_t uinput_inject_events(struct uinput_device *udev, const char __user *buffer, size_t count) { - struct input_event ev; + struct input_event64 ev; size_t bytes = 0; if (count != 0 && count < input_event_size()) @@ -448,8 +448,10 @@ static ssize_t uinput_inject_events(struct uinput_device *udev, * we are still going to return EFAULT instead of partial * count to let userspace know that it got it's buffers * all wrong. + * + * Force set is_input_event64 to false */ - if (input_event_from_user(buffer + bytes, &ev)) + if (input_event_from_user(buffer + bytes, &ev, 0)) return -EFAULT; input_event(udev->dev, ev.type, ev.code, ev.value); @@ -482,7 +484,7 @@ static ssize_t uinput_write(struct file *file, const char __user *buffer, } static bool uinput_fetch_next_event(struct uinput_device *udev, - struct input_event *event) + struct input_event64 *event) { bool have_event; @@ -502,13 +504,16 @@ static bool uinput_fetch_next_event(struct uinput_device *udev, static ssize_t uinput_events_to_user(struct uinput_device *udev, char __user *buffer, size_t count) { - struct input_event event; + struct input_event64 event; size_t read = 0; while (read + input_event_size() <= count && uinput_fetch_next_event(udev, &event)) { - if (input_event_to_user(buffer + read, &event)) + /* + * Force set is_input_event64 to false + */ + if (input_event_to_user(buffer + read, &event, 0)) return -EFAULT; read += input_event_size(); diff --git a/include/linux/uinput.h b/include/linux/uinput.h index 0994c0d..17859c0 100644 --- a/include/linux/uinput.h +++ b/include/linux/uinput.h @@ -66,7 +66,7 @@ struct uinput_device { unsigned char ready; unsigned char head; unsigned char tail; - struct input_event buff[UINPUT_BUFFER_SIZE]; + struct input_event64 buff[UINPUT_BUFFER_SIZE]; unsigned int ff_effects_max; struct uinput_request *requests[UINPUT_NUM_REQUESTS];