From patchwork Tue Apr 24 08:04:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 10358895 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C65436038F for ; Tue, 24 Apr 2018 08:05:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB06C28D1E for ; Tue, 24 Apr 2018 08:05:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B02C728D31; Tue, 24 Apr 2018 08:05:33 +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=-7.9 required=2.0 tests=BAYES_00, 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 2B26A28D1E for ; Tue, 24 Apr 2018 08:05:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756468AbeDXIEq (ORCPT ); Tue, 24 Apr 2018 04:04:46 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:60686 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756323AbeDXIEo (ORCPT ); Tue, 24 Apr 2018 04:04:44 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DEDFC401F9AF; Tue, 24 Apr 2018 08:04:43 +0000 (UTC) Received: from plouf.banquise.eu.com (ovpn-117-207.ams2.redhat.com [10.36.117.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F4F0215CDC8; Tue, 24 Apr 2018 08:04:42 +0000 (UTC) From: Benjamin Tissoires To: Jiri Kosina Cc: Dmitry Torokhov , Peter Hutterer , Mario.Limonciello@dell.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Benjamin Tissoires Subject: [PATCH v2 1/6] HID: store the full list of reports in the hidinput Date: Tue, 24 Apr 2018 10:04:32 +0200 Message-Id: <20180424080437.21367-2-benjamin.tissoires@redhat.com> In-Reply-To: <20180424080437.21367-1-benjamin.tissoires@redhat.com> References: <20180424080437.21367-1-benjamin.tissoires@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 24 Apr 2018 08:04:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 24 Apr 2018 08:04:43 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'benjamin.tissoires@redhat.com' RCPT:'' 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 We were only storing the report in case of QUIRK_MULTI_INPUT. It is interesting for the upcoming HID_QUIRK_INPUT_PER_APP to also store the full list of reports that are attached to it. We need the full list because a device (Advanced Silicon has some) might want to use a different report ID for the Input reports and the Output reports. Storing the full list allows the drivers to have all the data. Signed-off-by: Benjamin Tissoires --- drivers/hid/hid-input.c | 6 ++++++ include/linux/hid.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index a8a33e56b43e..62e42664955e 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -1536,9 +1536,12 @@ static struct hid_input *hidinput_allocate(struct hid_device *hid) input_dev->id.product = hid->product; input_dev->id.version = hid->version; input_dev->dev.parent = &hid->dev; + hidinput->input = input_dev; list_add_tail(&hidinput->list, &hid->inputs); + INIT_LIST_HEAD(&hidinput->reports); + return hidinput; } @@ -1688,6 +1691,9 @@ int hidinput_connect(struct hid_device *hid, unsigned int force) if (hid->quirks & HID_QUIRK_MULTI_INPUT) hidinput->report = report; + + list_add_tail(&report->hidinput_list, + &hidinput->reports); } } diff --git a/include/linux/hid.h b/include/linux/hid.h index 0a8d5c320b6c..e1ec7f91f926 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -464,6 +464,7 @@ struct hid_field { struct hid_report { struct list_head list; + struct list_head hidinput_list; unsigned id; /* id of this report */ unsigned type; /* report type */ struct hid_field *field[HID_MAX_FIELDS]; /* fields of the report */ @@ -510,6 +511,7 @@ struct hid_input { struct hid_report *report; struct input_dev *input; bool registered; + struct list_head reports; /* the list of reports */ }; enum hid_type {