Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3194008pxb; Thu, 10 Feb 2022 14:50:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJw8HL2P+w+EaxOlT2mlyhKzd2jt4Xvjci1DNWkHw+m8UcSWYeZ5r1KNelAyZXOBLfm4gTuD X-Received: by 2002:a17:906:9f01:: with SMTP id fy1mr8189299ejc.525.1644533405815; Thu, 10 Feb 2022 14:50:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644533405; cv=none; d=google.com; s=arc-20160816; b=MWHHPkA6y0emHk1BRKNmHIt+o9EiXkWUYHuCUEGj1mhzaz6WudRuwV1R6TJKFx/erO NeGzTS4usdzwSJhw9Jzeta7t30BZo3nZCGHz9yhbfnONl5ZkpztmozWujYptjltETtw7 wSbmg3v05qx0AsBFUdFa4F4RWWK6wRcBuZpxUeZEcf140LWPQRongLRkN8c0ngx8e3Hx kzsIxpfP0xLVf8mRnP11ShtrUimCxp4FanAFBFuFFE3/AksuKaxlXMCNDKJ4xCrb5XFX DyPeRljQN89IHJ8/h94JeftdfM3EDh2acYAh9t0Dz5Uhw6tq8E8rR6oWZsOYyX6mPheg OrXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FHzlUdZJZAbrkir44zct42ZxWDwZutaTx2Vvtix3Wsk=; b=HUv7JSvDXx0BJCYQnPQ7apjNHCG/WEofSw538TRjD9QxN54Sl5v9rtlMwvldLztV8S 5/o/dldkvpItLkAqW4m/vUaWx5sMhgvBmd3LIiXIlBqGbypjl1sEO42gWsmmZ9hXVdJE NPWOQpID5Z/y5brf6cigRQh8kDRhUeSu2ILjC7qo/UnlztSD9fLvbptuaY+w9RZEpaSr 1yPycQT5gSjGYlnBNuBnvSPg+FHVeACJxlIN1VRdb0jgqM4rrsbK9mRRu4t/NmslVTOu PkBuNPV5RR11ebCPjrY7GwP13rVJI1vBIwSCEudc1TF2oKzbFBb3gEEXqMZtBCxN09bI PhcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QtyNOwJl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb40si12485460ejc.127.2022.02.10.14.49.41; Thu, 10 Feb 2022 14:50:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QtyNOwJl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1343689AbiBJTFI (ORCPT + 99 others); Thu, 10 Feb 2022 14:05:08 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343653AbiBJTE4 (ORCPT ); Thu, 10 Feb 2022 14:04:56 -0500 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A123C1084; Thu, 10 Feb 2022 11:04:56 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id m14so11223708wrg.12; Thu, 10 Feb 2022 11:04:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FHzlUdZJZAbrkir44zct42ZxWDwZutaTx2Vvtix3Wsk=; b=QtyNOwJlEwfIlA1ACJIS9aSGj9/JdtURJRuW3a5+/nH41Cz9p/J6jxM8MBncRmZDks 7xFIOaPp21W8f2vAkIrivTZkSH4xGSuO8nhzWILbi0dVBUOq5QEsk7GDzVOShZzgU3oC ne+E0qV5zyuzEuawaZw8eXJGGuLFp7xFq4Zk9M8r85qVnwFwzw+2/I2daWCmsNytB/lf K46F47os3erFsHeqyEYZTg+ILLCCNgULXGgHdgTAWBc03RjzWV/1pPMKjm+9fxAsjIBr NHhFX6osrQgsdoaCJ6BjpUCrCH1LdcG5tXRXDYYZ56qOrdCC5io+GhMy9PXvNKxC1ukj gmLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FHzlUdZJZAbrkir44zct42ZxWDwZutaTx2Vvtix3Wsk=; b=GJtsyFNj0G15t3LJztKkDlLC0hjdOIMzoMyJlKwOEPLVATkv2Z6DG7IuZCGmlE7eU0 N6uliPNUn4HMY7083ps0inancWFndSBJfXRphUADmfki8u44afh/HjRaC7++gtKoHFdv VA3rsSzpHPCcIjXbpvA1+eSiTYje899bF23KpvT+GuSGtFfnKsRxierZI60yowHV7Nsq FMLu/q++cQ4DNXc/yZLg+fwazZn5sPxYx6Z7Zh38QWRoAdqZaj9jOjxGt1VtotXlB46c 9NwmnIj3WqMvN/4lbGGYLwPOC+8O9B8zxoCpuKchk6wXeQWu6DcmGhqBD/970tThA6qj bPjw== X-Gm-Message-State: AOAM533wxxlPUg8Re9o0d2otHOvU1AK1Kvt8piEtWdH4unMwgnL2NW1y C+UrMwnLjpvI0wkAygob2VhWDdjC+G+Ceg== X-Received: by 2002:adf:e9c8:: with SMTP id l8mr7677639wrn.415.1644519895257; Thu, 10 Feb 2022 11:04:55 -0800 (PST) Received: from localhost.localdomain ([94.73.33.246]) by smtp.gmail.com with ESMTPSA id o10sm21794816wri.19.2022.02.10.11.04.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 11:04:54 -0800 (PST) From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= To: jikos@kernel.org Cc: benjamin.tissoires@redhat.com, spbnick@gmail.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= Subject: [PATCH 6/7] HID: uclogic: Skip non-input raw events earlier Date: Thu, 10 Feb 2022 20:04:36 +0100 Message-Id: <20220210190437.50152-7-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220210190437.50152-1-jose.exposito89@gmail.com> References: <20220210190437.50152-1-jose.exposito89@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nikolai Kondrashov Early return when a non-input raw event is received to simplify the logic present in uclogic_raw_event. Signed-off-by: Nikolai Kondrashov Signed-off-by: José Expósito --- drivers/hid/hid-uclogic-core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c index 56b76d9b46af..8aac3f7a9cda 100644 --- a/drivers/hid/hid-uclogic-core.c +++ b/drivers/hid/hid-uclogic-core.c @@ -368,9 +368,12 @@ static int uclogic_raw_event(struct hid_device *hdev, struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev); struct uclogic_params *params = &drvdata->params; + /* Do not handle anything but input reports */ + if (report->type != HID_INPUT_REPORT) + return 0; + /* Tweak pen reports, if necessary */ if (!params->pen_unused && - (report->type == HID_INPUT_REPORT) && (report->id == params->pen.id) && (size >= 2)) { /* If it's the "virtual" frame controls report */ @@ -384,8 +387,7 @@ static int uclogic_raw_event(struct hid_device *hdev, } /* Tweak frame control reports, if necessary */ - if ((report->type == HID_INPUT_REPORT) && - (report->id == params->frame.id)) + if (report->id == params->frame.id) return uclogic_raw_event_frame(drvdata, data, size); return 0; -- 2.25.1