Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp891322ybl; Tue, 13 Aug 2019 04:21:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZiu8CdqdEpUQIE6sGGNiWNnc/IE8ODHehC2JkZyjoYq1VkYU0qnUTifco9n1sW1OGbhsd X-Received: by 2002:a17:902:2f24:: with SMTP id s33mr26143267plb.314.1565695266779; Tue, 13 Aug 2019 04:21:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565695266; cv=none; d=google.com; s=arc-20160816; b=ix7GFUYWI1QZAvEtZJRCQUFp7gquAGLqBFZ+nBj2TiMvnv2UAKj7wIYCD3pLUcTSy2 IwUlfEnEG2G9ru7YrovO0Xn68RRZ7zazxS7PeBQxKHcmaPKOsvcpIZzm7wMfMBBKwFrd GbcYgnmQ3QkhDrv50CKFP/a2SKiNh1hltulFFh92CmlTZ1PUlKqQNDcnpONoyyJmxuzo lJo0oPFzWplD0INwN8eQ+Qs6k81dqw4rob0czUuN9MO3H6aEQ335ZHFYuAhDv7lny3RF 1KiYPEC4Uuh7IslOvF1eq1KBiXbXOCfyerW2FEy6v3T0ZddaVKmvtDqk5fNSlofCfy3y K6Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=B2F/cyp13A0IuHdjq2E+PIxCzbUQf5Y+nO9hEvaEw8c=; b=OaWjwX7QQulzZDuzhvEb83SN6SMPJlgbhqjNAp0zYGkHDJIJVG0gB2rCIpd4gWNriZ JYLiDqvTkLkrk8AER7Kn7O+xP7UTCWmNjZPEGUk77Y/ivOacOoQe/J0MDWi+YK5la4iw WDhIS4r9LXd/i+oPQfYCM97ZiIYMd9qghMFhtXzqD2Gyxb+8VVHf85IbY7OQogETFrTA QlJpcfqoiazDsOCr81UlWZ+9hOrRKED/tjV/c8tGcbyCDqpPtks3AD985dZ1cvUowS6p s3IjQKLrStg1Bh3HHam8R5zXisC/CHDywHP/mdoq6TUOxrHrV6cFGWdxnqzEYtZt9Xsc 84PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U9qr7mkH; 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 v19si63222366pff.229.2019.08.13.04.20.50; Tue, 13 Aug 2019 04:21:06 -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=U9qr7mkH; 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 S1728213AbfHMKuJ (ORCPT + 99 others); Tue, 13 Aug 2019 06:50:09 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:37658 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726298AbfHMKuJ (ORCPT ); Tue, 13 Aug 2019 06:50:09 -0400 Received: by mail-ot1-f68.google.com with SMTP id f17so35306497otq.4; Tue, 13 Aug 2019 03:50:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=B2F/cyp13A0IuHdjq2E+PIxCzbUQf5Y+nO9hEvaEw8c=; b=U9qr7mkH+zxRBYpLU7hxgwWbrgIBe2YS3lj8LGw2Y+bZQf4/bwGiH5JTVpMru1v9bi Gu2JEkoX1GWsMwfWTrG9CcZGyE4oY6qFZfrmnBal1NpCu/b7/fCmijLKzmJCFxGE0xDS gpS5/cYc5xo+fAp6X9ouRY+2ExMWM5vC29GjqhFIHDmkBQXvXL0upx3oLBd7czC7st4+ k2HYEnkStxG3EJN/jxhRV1JX8zB8KbDeyeWm+zFcRopC2snzuQVf2CToXr+emDcU7yv2 aiYu5c8dJekCR/1HrDqBmjSns9OsBNb14iFzuMhajiniB9JssWNhFFtmqneuUr2Cme9y YMjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=B2F/cyp13A0IuHdjq2E+PIxCzbUQf5Y+nO9hEvaEw8c=; b=phtsT0F38wB0iZYw/xJ6NY0Kckp7Zz0G/gMhuatiYcuYGaRt6OKxy2ZNKntTyXd+Tk cPmXuytspkWOIC7joV8USA0537EveI23PkUfhDmJ9Ro27XULE7v7YTv4bfoM0CNdcmUw oqARRku2TFzXkA/FxuLxQF596+RBQTGSAg++2YdP94UXYIeB5VyJTGwa9CYnDi+E1lI6 xYVUQC1BP0plLUI6pQ4oblmwWFh9SmXOfI5Ea6UHrcC157+lN3Pt6n3WN0gxT8/zuebK m5NAqwwETtlEAVxRnpQAOK8ksZm3WcreKvyoSxRD1JdiYjOcWbm2hORjmvnyM6U7lqtN 4AEQ== X-Gm-Message-State: APjAAAUxdc8D21cY8XJO9Lt5Bmt1Px0qqOCo7ffK0X7cE2Iu15kSIQjz ulYrHxJQ6gD8YMr4BqxtxcKer/lO5vKll/HdrlM= X-Received: by 2002:a6b:2b87:: with SMTP id r129mr12216812ior.308.1565693408222; Tue, 13 Aug 2019 03:50:08 -0700 (PDT) MIME-Version: 1.0 References: <20190812162105.13428-1-benjamin.tissoires@redhat.com> In-Reply-To: <20190812162105.13428-1-benjamin.tissoires@redhat.com> From: David Rheinsberg Date: Tue, 13 Aug 2019 12:49:57 +0200 Message-ID: Subject: Re: [PATCH] HID: uhid: actually use the err number from userspace To: Benjamin Tissoires Cc: Jiri Kosina , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hey On Mon, Aug 12, 2019 at 6:21 PM Benjamin Tissoires wrote: > > This can help debugging the situation > > Signed-off-by: Benjamin Tissoires > --- > > Hi, > > not entirely sure if we can use this in a such simple way. > > However, this is useful to mimic device behaviour from userspace. > > Cheers, > Benjamin > > drivers/hid/uhid.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c > index fa0cc0899827..2fa32e7fc733 100644 > --- a/drivers/hid/uhid.c > +++ b/drivers/hid/uhid.c > @@ -284,7 +284,7 @@ static int uhid_hid_set_report(struct hid_device *hid, unsigned char rnum, > goto unlock; > > if (uhid->report_buf.u.set_report_reply.err) > - ret = -EIO; > + ret = -uhid->report_buf.u.set_report_reply.err; I am generally in favor of this. But: 1) can you do this for both set_report *and* get_report? 2) I think you have to filter some of the error codes. For instance, if you return one of the -ERESTARTSYS codes, this might cause the syscall to restart (if auto-restart is enabled on this context). At the same time, this is not *that* bad. It might even be useful for the userspace driver to trigger an EINTR. At least we should be aware of this. So maybe filters are not necessary.. Mhhh. Comments? Thanks David > else > ret = count; > > -- > 2.19.2 >