From patchwork Sun Nov 4 10:32:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 150103 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1397411ljp; Sun, 4 Nov 2018 02:34:55 -0800 (PST) X-Google-Smtp-Source: AJdET5d8gUE0KOen6ow9AmFYXCEuEJ+zk5lP4tZDQr09myEEJ7NFpWzCWl9/cgwoPPSiYHSgBzzt X-Received: by 2002:a17:902:a717:: with SMTP id w23-v6mr18029659plq.24.1541327695329; Sun, 04 Nov 2018 02:34:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541327695; cv=none; d=google.com; s=arc-20160816; b=ReI/+Gty18M1OMPQFfua0T/IH5i/vxPYGTVM8NDwrqtpDnzt/dBb74fw901qnVzOUO eH9fpSNPW0haVuOoXQoXphUJStGPbR4SJ05VJTHm1DzzCGJq5zcGJ5DTr887pfDgHEl+ 0mjVpMsWC4L8CCM5LsRKoU64+9LmEKA1iGj1veJoces0Ya2GSEfToaa4y2kMjlcBhMqQ VX/fhwKA/pqg3SyLdZtEJNq0x1kTFM/SXyRKqon0UncDyWGkyX5T4YiJpS9IhWS2M/st 1q4Z/l+/bgX6JIXmP7Wp9qTYlazxImEIs9DGZesopvg58kElAw0PON6zM0luaIFK2bbS BxtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=bnlprPfPUl1eCcNvt7jds5qKCRKQNsLnexrxcD7Wclc=; b=XYvFBBux5vP33G+WPLkCoHIX0V7LI4cttCS/IQXwGaS4gMK8xkB6H0n6PnJ2Mxmwvt BayVzr8Pu0kQ0d+fAvX2U0UbcQyG5TAACd3iP5D5rGbfF+BIRNWSYPsBvcfQxI6Z/Agc lSL3IiIQcpm1HRb8199x+hVY5/kMSJsrQcaiK5HWci4QSzsqW4Y95Qw5MG6rgDkwgRzp 7X/63ftu3yS6TPrmHRLe5mHIBD4Qa/AZ6/JAPnAvHnwLPHItuxrLbRDOUcDfUBONKbIR CQ1sarmt6VmLUytfMF4SSTTa0PrABUPzpDQTquoWo6xO1GOZj2W8NxfWiNgLDZZXrLDV 9W9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gWI7dXly; spf=pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h13-v6si38717874pgq.285.2018.11.04.02.34.55 for ; Sun, 04 Nov 2018 02:34:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-input-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=@linaro.org header.s=google header.b=gWI7dXly; spf=pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728860AbeKDTtX (ORCPT ); Sun, 4 Nov 2018 14:49:23 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:39205 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726556AbeKDTtX (ORCPT ); Sun, 4 Nov 2018 14:49:23 -0500 Received: by mail-lf1-f65.google.com with SMTP id n18so4096421lfh.6 for ; Sun, 04 Nov 2018 02:34:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=bnlprPfPUl1eCcNvt7jds5qKCRKQNsLnexrxcD7Wclc=; b=gWI7dXlyNcEs8Xs0uDaBAp54whft3TFA0kD8bV9LrxWdgbDw2OVXzlJ0jCJkXPoKW1 CiYZUzj9oYdDN37xPGygDhLvW5kvTupKBOU1KN4gkaMex/hEpfnXSBtiSazO7SkMjoYP UUOBknox2gRJmCrlCG3c3bxRpHs5oO8CEsPrM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=bnlprPfPUl1eCcNvt7jds5qKCRKQNsLnexrxcD7Wclc=; b=Pm7I0YX8bBo75tP3TWKkanw4AgJ1DzER23LbFJ2NgQTGXy+ZGJIkgIj9xhN3mKk5Sr /8dYaJ7Q2qM9GK4waQlQQBI4cr5SMBew4RBb3ADi1AeINU0WMtmiQnQS18C6OQnFu9tf RVZ8+PcoLEKor4XFDp8QqPzfRYTjHa/lqsOM1ywlmsY4fss4c3t3gaMGu3t0/cGywUgX 6ZZc/hGtqpe3WdM8gVcRy4Yp3lT6qKVNYQfxwPdWbLYPILaL5G0+ZiqGoHvXIdR/s3iI 9xpwbwQg9dDEDYMV+fVZuq54qVKeL2C98UympONN0z6bQ/rveapOLGI0Q3mKJXzzlBhc 3/+Q== X-Gm-Message-State: AGRZ1gL8ZIKeF6IjGsM7kBFrwjClTz6+587803zMbnwHFQvLLH2HxRHK +mvWtdNnkUTtl/CzCoxCTOqdxeIQ5T7tMQ== X-Received: by 2002:a19:9609:: with SMTP id y9mr9980760lfd.114.1541327692179; Sun, 04 Nov 2018 02:34:52 -0800 (PST) Received: from localhost.localdomain (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id x11sm906158lfd.81.2018.11.04.02.34.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 04 Nov 2018 02:34:50 -0800 (PST) From: Linus Walleij To: Jiri Kosina , Benjamin Tissoires Cc: linux-input@vger.kernel.org, Linus Walleij Subject: [PATCH] HID: fix up .raw_event() documentation Date: Sun, 4 Nov 2018 11:32:47 +0100 Message-Id: <20181104103247.32691-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.2 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The documentation for the .raw_event() callback says that if the driver return 1, there will be no further processing of the event, but this is not true, the actual code in hid-core.c looks like this: if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) { ret = hdrv->raw_event(hid, report, data, size); if (ret < 0) goto unlock; } ret = hid_report_raw_event(hid, type, data, size, interrupt); The only return value that has any effect on the processing is a negative error. Correct this as it seems to confuse people: I found bogus code in the Razer out-of-tree driver attempting to return 1 here. Signed-off-by: Linus Walleij --- include/linux/hid.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.17.2 diff --git a/include/linux/hid.h b/include/linux/hid.h index 2827b87590d8..387c70df6f29 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -722,8 +722,8 @@ struct hid_usage_id { * input will not be passed to raw_event unless hid_device_io_start is * called. * - * raw_event and event should return 0 on no action performed, 1 when no - * further processing should be done and negative on error + * raw_event and event should return negative on error, any other value will + * pass the event on to .event() typically return 0 for success. * * input_mapping shall return a negative value to completely ignore this usage * (e.g. doubled or invalid usage), zero to continue with parsing of this