Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2305185imm; Wed, 16 May 2018 10:48:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpeyZB1mUSfuUM8z4WI5vWGQIQxmc43OswcU10h7ciVqYNcDfrWksup8WfpiQn1/OaIWY/E X-Received: by 2002:a17:902:8a81:: with SMTP id p1-v6mr1928660plo.33.1526492882796; Wed, 16 May 2018 10:48:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526492882; cv=none; d=google.com; s=arc-20160816; b=mavxttpQ12Z/ApP+ZV8UjPieEpaeYjybjcJGH8Q71f6/VNS0RW992kPgnUPBQ7ZkH4 w9CM/TQl28d2fRosxMrXKjU9bCnyCBVkvFv5rqnnsZGsQJ/8UgTrFEWV+dh78Mbb6ErQ Mej0IibQGBzExkVcHiiNJAXF8ESyZnUcc4+dHUsX94Lw1Xdug5OMYtuk+wWBNHRF2Knc rYWXuLwX4FMpJZRkIwjb7H+zJpqpLJ4KbRwEOevZVkSO32VpIC9ytjdj9t+XJ78orupn o7LdIVLxc0iOCR/6nnS7VekHf8mqNe5Qxz6JU2F6ns7Tcxryaz8H9M1P0cWEqtHnW/xD eWog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=Pb/BQDea8AkY+TWQnTttdO74hlVoPbq/opkATyUzJSE=; b=MY2odmwF65UeIimhfZdyxlYRENIrgB3NxXDOXTMr1wXgF5w7fjrBaTxm/7TCrudxFr aaTLXbLfvhlia2nCWJ1VXQHk64O8lxPmzXFVf8EPNdgUCd+KL5C6gWsmmHFUv9gFj0RW 0QMyuLxE2HZzFXWTY3WBORzGxHivSoc3GK35etOQ6PgzFjgfzpUm7kiGIeYdriHTmRDW +ZhVrkh0SRH/pJkfodYmWIRV1on8+lXnhEXZ1TyYbGigeN4tKHhIBMunrwpHnLqK23Vx etAk1Fv1SC1lt+71G2wPAHlkuxVUZkSa4JjVwc0BZfqjuWeTrluaAtcRfhWvEzUZklKD nGpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Vilb5hhb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r10-v6si2230707pgv.499.2018.05.16.10.47.47; Wed, 16 May 2018 10:48:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Vilb5hhb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751228AbeEPRrg (ORCPT + 99 others); Wed, 16 May 2018 13:47:36 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:42379 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750799AbeEPRre (ORCPT ); Wed, 16 May 2018 13:47:34 -0400 Received: by mail-wr0-f193.google.com with SMTP id v5-v6so2448190wrf.9; Wed, 16 May 2018 10:47:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=Pb/BQDea8AkY+TWQnTttdO74hlVoPbq/opkATyUzJSE=; b=Vilb5hhbhczbFJphIwnR+3v/VZxJFtWpbZ+UxBpb2cSE4OfOFLGPWKMPUxJDjKfBOn wpmi8PSc4acmV76s6DAPuV07OI5zWFbTo/FD38XtKXWqhcaBKrqf1ssWJ5lkfe/pHSYj k3S7XieuY9SwR2K96Su73r8XUdhIjRSL//+fZCMvJC3T7JkhYIBBLE3cXEsp40hZvBWN Gafi8IGf9VAiP9gGvpusfVFtS37EeGJsYZK1gM6PSWUuKUUdygkAsFZQsWpeqL+tDlGO mKkY/1ahJBJwNX5Csd/wRPczXWjyBMxS2ECP5dwce7t7oMVKhH2pNnbBF/t+67OIaiCa 486g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=Pb/BQDea8AkY+TWQnTttdO74hlVoPbq/opkATyUzJSE=; b=a0Tfako+W7fnQkJSax8vqKz0fNZWPTSUCPsueSMzKQblSputetaK99kdbdwYKRFrnG 4jh/1EaB6PJM4EBO7DLL1jfcJBfmrPrU4yvUX7GnA2SlylUGQo6XkDsbk+O2jL9DnuMs /2SEXfLT3yqP+VU3dAnqxx7wQbrGbdiVdqtFx3ZhvhWyLxQdB/7USOFcYryFsg563KPm 6iokj/DuNlX34QBBNOpR4Gl9l/cL3jj0qUIvWxxi2vfmePohjOHn3LQ49obvMlY7RNJZ 2JrBwF5M/4gGyejC0sGg9UX6YWaz/uc0U6AcSGdAXyh2eZl6Pg3MC4BzEBmOX9Y6kidA sSiw== X-Gm-Message-State: ALKqPwcZma3ToXDOyIYGVdvV5EpVEH3pq7+fknNUf19+pKDOSu7RpeHh ZUEEA2LchJwzdHD+azrgpPw= X-Received: by 2002:a19:5512:: with SMTP id n18-v6mr13095404lfe.24.1526492853149; Wed, 16 May 2018 10:47:33 -0700 (PDT) Received: from [192.168.0.20] (58-0-132-95.pool.ukrtel.net. [95.132.0.58]) by smtp.googlemail.com with ESMTPSA id a14-v6sm735169lfh.80.2018.05.16.10.47.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 May 2018 10:47:32 -0700 (PDT) Subject: Re: [PATCH v3 2/2] Input: xen-kbdfront - allow better run-time configuration To: Dmitry Torokhov Cc: xen-devel@lists.xenproject.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, jgross@suse.com, lyan@suse.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com, andrii_chepurnyi@epam.com, Oleksandr Andrushchenko References: <20180514144029.16019-1-andr2000@gmail.com> <20180514144029.16019-2-andr2000@gmail.com> <20180516171528.GD21971@dtor-ws> From: Oleksandr Andrushchenko Message-ID: Date: Wed, 16 May 2018 20:47:30 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180516171528.GD21971@dtor-ws> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/16/2018 08:15 PM, Dmitry Torokhov wrote: > Hi Oleksandr, > > On Mon, May 14, 2018 at 05:40:29PM +0300, Oleksandr Andrushchenko wrote: >> @@ -211,93 +220,114 @@ static int xenkbd_probe(struct xenbus_device *dev, >> if (!info->page) >> goto error_nomem; >> >> - /* Set input abs params to match backend screen res */ >> - abs = xenbus_read_unsigned(dev->otherend, >> - XENKBD_FIELD_FEAT_ABS_POINTER, 0); >> - ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend, >> - XENKBD_FIELD_WIDTH, >> - ptr_size[KPARAM_X]); >> - ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend, >> - XENKBD_FIELD_HEIGHT, >> - ptr_size[KPARAM_Y]); >> - if (abs) { >> - ret = xenbus_write(XBT_NIL, dev->nodename, >> - XENKBD_FIELD_REQ_ABS_POINTER, "1"); >> - if (ret) { >> - pr_warn("xenkbd: can't request abs-pointer\n"); >> - abs = 0; >> - } >> - } >> + /* >> + * The below are reverse logic, e.g. if the feature is set, then >> + * do not expose the corresponding virtual device. >> + */ >> + with_kbd = !xenbus_read_unsigned(dev->nodename, >> + XENKBD_FIELD_FEAT_DSBL_KEYBRD, 0); >> >> - touch = xenbus_read_unsigned(dev->nodename, >> - XENKBD_FIELD_FEAT_MTOUCH, 0); >> - if (touch) { >> + with_ptr = !xenbus_read_unsigned(dev->nodename, >> + XENKBD_FIELD_FEAT_DSBL_POINTER, 0); >> + >> + /* Direct logic: if set, then create multi-touch device. */ >> + with_mtouch = xenbus_read_unsigned(dev->nodename, >> + XENKBD_FIELD_FEAT_MTOUCH, 0); >> + if (with_mtouch) { >> ret = xenbus_write(XBT_NIL, dev->nodename, >> XENKBD_FIELD_REQ_MTOUCH, "1"); >> if (ret) { >> pr_warn("xenkbd: can't request multi-touch"); >> - touch = 0; >> + with_mtouch = 0; >> } >> } > Does it make sense to still end up calling xenkbd_connect_backend() when > all interfaces (keyboard, pointer, and multitouch) are disabled? Should > we do: > > if (!(with_kbd || || with_ptr || with_mtouch)) > return -ENXIO; > > ? It does make sense. Then we probably need to move all xenbus_read_unsigned calls to the very beginning of the .probe, so no memory allocations are made which will be useless if we return -ENXIO, e.g. something like static int xenkbd_probe(struct xenbus_device *dev,                   const struct xenbus_device_id *id) {     int ret, i;     bool with_mtouch, with_kbd, with_ptr;     struct xenkbd_info *info;     struct input_dev *kbd, *ptr, *mtouch; if (!(with_kbd | with_ptr | with_mtouch))         return -ENXIO; Does the above looks ok? > Thanks. > Thank you, Oleksandr