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: 10666831 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 214961591 for ; Sun, 4 Nov 2018 10:34:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED538299A0 for ; Sun, 4 Nov 2018 10:34:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DCF11299D8; Sun, 4 Nov 2018 10:34:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72F30299A0 for ; Sun, 4 Nov 2018 10:34:55 +0000 (UTC) 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-Google-Smtp-Source: AJdET5c3Qbl9Crxiqt0IjWs0tr4QdVKurnXAf/TXQ5vZFX2CwAvDQnVjNEWBqvSXFRCNjdfkQHysCw== 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 X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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