Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932407AbbLSBuR (ORCPT ); Fri, 18 Dec 2015 20:50:17 -0500 Received: from mail-pf0-f175.google.com ([209.85.192.175]:32898 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751478AbbLSBuP (ORCPT ); Fri, 18 Dec 2015 20:50:15 -0500 Date: Fri, 18 Dec 2015 17:50:12 -0800 From: Dmitry Torokhov To: Benjamin Tissoires Cc: David Herrmann , Peter Hutterer , "open list:HID CORE LAYER" , linux-kernel Subject: Re: [PATCH v3] Input: uinput - add new UINPUT_DEV_SETUP and UI_ABS_SETUP ioctl Message-ID: <20151219015012.GC26333@dtor-ws> References: <1440515579-5359-1-git-send-email-benjamin.tissoires@redhat.com> <20151024225341.GA17120@dtor-pixel> <20151028151006.GB20468@mail.corp.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151028151006.GB20468@mail.corp.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2672 Lines: 75 On Wed, Oct 28, 2015 at 11:10:06AM -0400, Benjamin Tissoires wrote: > Hi, > > On Oct 25 2015 or thereabouts, David Herrmann wrote: > > Hi > > > > On Sun, Oct 25, 2015 at 12:53 AM, Dmitry Torokhov > > wrote: > > > Hi Benjamin, > > > > > > On Tue, Aug 25, 2015 at 11:12:59AM -0400, Benjamin Tissoires wrote: > > >> +static int uinput_abs_setup(struct uinput_device *udev, > > >> + struct uinput_setup __user *arg, size_t size) > > >> +{ > > >> + struct uinput_abs_setup setup = {}; > > >> + struct input_dev *dev; > > >> + > > >> + if (size > sizeof(setup)) > > >> + return -E2BIG; > > >> + if (udev->state == UIST_CREATED) > > >> + return -EINVAL; > > >> + if (copy_from_user(&setup, arg, size)) > > >> + return -EFAULT; > > >> + if (setup.code > ABS_MAX) > > >> + return -ERANGE; > > >> + > > >> + dev = udev->dev; > > >> + > > >> + input_alloc_absinfo(dev); > > >> + if (!dev->absinfo) > > >> + return -ENOMEM; > > >> + > > >> + set_bit(setup.code, dev->absbit); > > >> + dev->absinfo[setup.code] = setup.absinfo; > > >> + > > >> + /* > > >> + * We restore the state to UIST_NEW_DEVICE because the user has to call > > >> + * UI_DEV_SETUP in the last place before UI_DEV_CREATE to check the > > >> + * validity of the absbits. > > >> + */ > > > > > > Do we have to be this strict? It seems to me that with the new IOCTLs > > > you naturally want to use the new ioctl to setup the device, then adjust > > > various axes and bits and then validate everything. > > > > Indeed, we now force the order to be abs-setup first, then > > device-setup as last step. Appended is a follow-up patch to cleanup > > ABS handling in uinput. It is untested. Benjamin, care to give it a > > spin? > > > > Sorry it took so long for the tests/review. > > So the test part is fine. It works as expected. (Tested-by: BT > ) > > For the review part, everything looks good except that now the doc for > UI_ABS_SETUP in uapi/linux/uinput.h should be changed to reflect the > fact that UI_DEV_SETUP is not a pre-requirement before calling > UI_ABS_SETUP. > > With the doc change, the patch is also Reviewed-by: me. OK, I applied the original and also adjusted the docs and applied this one as a separate patch. Thanks. -- Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/