From patchwork Fri Nov 27 10:00:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: WEN Pingbo X-Patchwork-Id: 7712251 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 DBDBBBF90C for ; Fri, 27 Nov 2015 10:01:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 924352055A for ; Fri, 27 Nov 2015 10:01:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 97811205E7 for ; Fri, 27 Nov 2015 10:01:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754553AbbK0KBa (ORCPT ); Fri, 27 Nov 2015 05:01:30 -0500 Received: from mail-pa0-f53.google.com ([209.85.220.53]:36371 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754535AbbK0KB1 (ORCPT ); Fri, 27 Nov 2015 05:01:27 -0500 Received: by pacdm15 with SMTP id dm15so111021157pac.3 for ; Fri, 27 Nov 2015 02:01:26 -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=lW77FMbAzMblfiZE4hBZqtbuSInX9i/4UEw2J8/t0f0=; b=UJ01kkraCgX4TrdPi12/CyTPBnr7d0b+Y77R1R7XGLNA/rHVa15JgkOeZsoYXsu1y5 QtJ7Pfgvvo7xtlU+S5yuIwj6TJp/ZgbidWx4Wk9WbbeY/yJjB3DESVC4jXUdJdnoki5+ OcVi3iGziJxjiG/11T1dXXFHAOdKTC4h685vOOI4gEXSyzXWwAoEoAfjIJNEUCWj0EW1 zG+L+tcZup37+nuAmwl/ZCquVZEWi8Q2zYNpGzG3nu2hkwxxXraXn1kdo7PlmkETGooa 7kmqh3af50Vd6uGdiVr8c0fl9Rjxkha00fJtq2fWDENfjUgmfeIqonqoJXhO7nrq8pk9 RRUg== 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=lW77FMbAzMblfiZE4hBZqtbuSInX9i/4UEw2J8/t0f0=; b=LwgVssOpG/L4/3U8fjZkiZsLash9whybb/efzDe7B1WRWjsrItNjh7Tbi2kW105SUN elXIR1rslHsUBPMd+e9rlAqZsNdk+Fp9bgW4q4q6QjYhj/SO9QdIVBw8ZdIY5tcV0bIi wJfhcrXm2HrCJYFNO/rwq+q0GRZztTWYW5E3vTC6j2q/FLeFQbEbT1zeTFYzAUtd1EqU U8EMZih3TngMn21XUJrooopfdLQMPM5r5baXI+AuWvWZdQCEK5mIJulL2PIqQmHTuyt6 Lp6CYa0dO6tSETn+YmpYWbJBet3F3j0UHtrNK6K9A6GmReCF+RAZqcl8ri8EE0eq9XYz F6jA== X-Gm-Message-State: ALoCoQkTLsAopIe9v41kTgM2XPVPL6cT0vdltc/rSYtELP2a8Lz7eLk/S9yCT0EGQ3RE38JYi6NE X-Received: by 10.98.67.76 with SMTP id q73mr46709435pfa.73.1448618486742; Fri, 27 Nov 2015 02:01:26 -0800 (PST) Received: from localhost.localdomain ([103.26.122.10]) by smtp.gmail.com with ESMTPSA id tm4sm31768969pab.3.2015.11.27.02.01.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Nov 2015 02:01:26 -0800 (PST) From: WEN Pingbo To: y2038@list.linaro.org, dmitry.torokhov@gmail.com, aksgarg1989@gmail.com, arnd@arndb.de Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, WEN Pingbo Subject: [PATCH 3/3] uinput: convert input_event to input_value Date: Fri, 27 Nov 2015 18:00:32 +0800 Message-Id: <1448618432-32357-4-git-send-email-pingbo.wen@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1448618432-32357-1-git-send-email-pingbo.wen@linaro.org> References: <1448618432-32357-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 This patch depends on 'add new evdev interface'. We should not use input_event in kernel any more. Convert it in uinput, and adapt to new api changes. Signed-off-by: WEN Pingbo --- drivers/input/misc/uinput.c | 23 +++++++++++------------ include/linux/uinput.h | 2 +- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index 5adbced..d84c6d4 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c @@ -50,7 +50,6 @@ 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); udev->head = (udev->head + 1) % UINPUT_BUFFER_SIZE; wake_up_interruptible(&udev->waitq); @@ -436,24 +435,24 @@ 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_value ev; size_t bytes = 0; - if (count != 0 && count < input_event_size()) + if (count != 0 && count < input_event_size(EV_IF_LEGACY)) return -EINVAL; - while (bytes + input_event_size() <= count) { + while (bytes + input_event_size(EV_IF_LEGACY) <= count) { /* * Note that even if some events were fetched successfully * we are still going to return EFAULT instead of partial * count to let userspace know that it got it's buffers * all wrong. */ - if (input_event_from_user(buffer + bytes, &ev)) + if (input_event_from_user(buffer + bytes, &ev, EV_IF_LEGACY)) return -EFAULT; input_event(udev->dev, ev.type, ev.code, ev.value); - bytes += input_event_size(); + bytes += input_event_size(EV_IF_LEGACY); } return bytes; @@ -482,7 +481,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_value *event) { bool have_event; @@ -502,16 +501,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_value event; size_t read = 0; - while (read + input_event_size() <= count && + while (read + input_event_size(EV_IF_LEGACY) <= count && uinput_fetch_next_event(udev, &event)) { - if (input_event_to_user(buffer + read, &event)) + if (input_value_to_user(buffer + read, &event, EV_IF_LEGACY)) return -EFAULT; - read += input_event_size(); + read += input_event_size(EV_IF_LEGACY); } return read; @@ -523,7 +522,7 @@ static ssize_t uinput_read(struct file *file, char __user *buffer, struct uinput_device *udev = file->private_data; ssize_t retval; - if (count != 0 && count < input_event_size()) + if (count != 0 && count < input_event_size(EV_IF_LEGACY)) return -EINVAL; do { diff --git a/include/linux/uinput.h b/include/linux/uinput.h index 0994c0d..bdb6fca 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_value buff[UINPUT_BUFFER_SIZE]; unsigned int ff_effects_max; struct uinput_request *requests[UINPUT_NUM_REQUESTS];