Received: by 2002:ab2:2997:0:b0:1ec:cbc4:63fb with SMTP id n23csp530695lqb; Thu, 29 Feb 2024 07:49:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVQUzOJtH8OnFvVLurqI7YVvDCIlUB8nz2718sOrbfSAmlAqRSt5NIqDDFVLj8YArDW7WF31lgraklip54jdSk+PnlaXN/lKuvgmS2o0Q== X-Google-Smtp-Source: AGHT+IFZAK8bCFz8HlA1TbP0K8X2efCLacKe7VQY19/q/mCHc3Y2Kme1nreuvsNqzKUo6jvbi8Fk X-Received: by 2002:a05:6214:b29:b0:690:4aaf:95ba with SMTP id w9-20020a0562140b2900b006904aaf95bamr1286874qvj.18.1709221788592; Thu, 29 Feb 2024 07:49:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709221788; cv=pass; d=google.com; s=arc-20160816; b=Lp5MefzpkjGgAOJez6a6BXqSf4tiboIQNpENB5pUK3kPUcWIfM2IFFOAsxYbyj1V0c gSh+7n9qtTybCJOWOsxggjb0lHsbFLQhLYFuih+/TFas0Vz6D/aGl6iJKxlG6CqdaEWU AZdi1hpiad6R9pRzcba9NSkOZaKO5uH/MF5h8+f/nQ3oqv3feLgYNrjsZ98eXt5UrZQA mTMhWvnSYmGTArvkqj7WaS0zehjKyNPntUNn+xynew2bz1dLkgRZus1wmFvZk1qWiUnC SEARyaRJujkKbsfmw8Xtb9aRmfkT7IxPjj2Kg5Q57OM05MIRWGfFl2lodXD0xi+FurOR om3w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=0INMNntGywK5aPJz1P/Qpo+WDtdiG0j9JGECrucxN88=; fh=Rj56hfEJ80vyePhMmV49TWqm0RqkOGjfYW/25dUiGMQ=; b=Za6mlKBSVY/38ZXlstdK0SlUzZ8adEB4UlGfBHLCmp3+kB4w0S5s/QbTNcg2j/3Jwj dq2sjHn6E340mpbZlaR939XaiFkTOyWXnaFWPM3JjA0BbOyoM/QKeT6KxxrRs0A6Tmfc K8R4x2HMn7UsiMNAiAG+NtgamZC1XZxnMF+iPzSb9vhQH+kij2EPNUeCGjf1br8km5sH eFEA80CZwy0fpR9ij8O4XzCWOnqumb82FUGl8mp+B4mKvLW+m1SdFBYDYR5ti16KhuDh eOE4dWs2v81/CV/sJTDqQ/nIZXDa2PJR/V88z62dc/tl+YUdHYcmRk9GCcKasvxnXZRx e2pA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pd5huMZz; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-86951-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86951-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 4-20020a0562140d0400b0068f59455cf3si1555520qvh.606.2024.02.29.07.49.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 07:49:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86951-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pd5huMZz; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-86951-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86951-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 561231C2279D for ; Thu, 29 Feb 2024 15:49:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E7B2151CD1; Thu, 29 Feb 2024 15:49:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pd5huMZz" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F7F21509B1; Thu, 29 Feb 2024 15:48:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709221739; cv=none; b=ooXh+UWdDeJLkAuv6dkokwosoibcVLAMFx+PuJ6VsjLjDZbvsggsV8dhDSE0gGlz/49hlBssdt+HyoSEJTeX2UuDSTs6r/GLQ8sMDNJDtymw3W29lOoW/MfVsggb64JGbDFHJ3m7Ljhr1c2RoAI7Yuh52bk8esUGuxFzepFLGe4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709221739; c=relaxed/simple; bh=aIRyXvmgRyZnTFWiYbSLRS3WFje6cM1cG1tedA4/0vw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EwHkmm0Y0ognL87cfLu8feffKRQNhMqVBIDto4plt0c6U6ckKEl+DBQPqHIQRXOTBX4nAgEZ2rxFe57QH2K39CHE8RS8FhPrX44TulKRb/6FA1ifQUgN7XSDuyWHQ635x4x8Syv61fopDeFmK03Vn8X5/PsoL7J8n/sm+D9ylN0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pd5huMZz; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 917D4C43390; Thu, 29 Feb 2024 15:48:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709221738; bh=aIRyXvmgRyZnTFWiYbSLRS3WFje6cM1cG1tedA4/0vw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pd5huMZzMxtJ1DwTqQhnTK9n1rcPIyrnhp0GTLxZZx5qI++DOVTyf/l53pwQgWWFx ccuyE/JnhxKglde654biDyHYiieuqVdHwaSwEhBJKctfOQW5coEBOZkxraTNB7lS6G 3bdUYHO0Ug+yggG+/FULxrbYcWBGpa//+8+w3dRNwTtGekOcoHxSPTvRJ9o1+3gFdu MOP9DtNi3mK0wATyNle901+/JTFPfw4VvYhVcIpU1CD7CHjiDX/5cBEfEOV7tHpi87 TvEnL4Snm2mR8JN0oJrHBlECMpRwq5SAC2MfHKFoM+XK6q2zBrJBslUtqOYgUd3F/h li4c+MZz4psKw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Oleksandr Natalenko , Hans de Goede , Jiri Kosina , Sasha Levin , jikos@kernel.org, benjamin.tissoires@redhat.com, linux-input@vger.kernel.org Subject: [PATCH AUTOSEL 6.7 04/26] HID: logitech-hidpp: Do not flood kernel log Date: Thu, 29 Feb 2024 10:48:23 -0500 Message-ID: <20240229154851.2849367-4-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240229154851.2849367-1-sashal@kernel.org> References: <20240229154851.2849367-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.7.6 Content-Transfer-Encoding: 8bit From: Oleksandr Natalenko [ Upstream commit 411a20db905b44e18cc9129b745f1d5deba4eae5 ] Since commit 680ee411a98e ("HID: logitech-hidpp: Fix connect event race") the following messages appear in the kernel log from time to time: logitech-hidpp-device 0003:046D:408A.0005: HID++ 4.5 device connected. logitech-hidpp-device 0003:046D:408A.0005: HID++ 4.5 device connected. logitech-hidpp-device 0003:046D:4051.0006: Disconnected logitech-hidpp-device 0003:046D:408A.0005: Disconnected As discussed, print the first per-device "device connected" message at info level, demoting subsequent messages to debug level. Also, demote the "Disconnected message" to debug level unconditionally. Link: https://lore.kernel.org/lkml/3277085.44csPzL39Z@natalenko.name/ Signed-off-by: Oleksandr Natalenko Reviewed-by: Hans de Goede Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-logitech-hidpp.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c index fd6d8f1d9b8f6..6ecf40a902369 100644 --- a/drivers/hid/hid-logitech-hidpp.c +++ b/drivers/hid/hid-logitech-hidpp.c @@ -203,6 +203,8 @@ struct hidpp_device { struct hidpp_scroll_counter vertical_wheel_counter; u8 wireless_feature_index; + + bool connected_once; }; /* HID++ 1.0 error codes */ @@ -988,8 +990,13 @@ static int hidpp_root_get_protocol_version(struct hidpp_device *hidpp) hidpp->protocol_minor = response.rap.params[1]; print_version: - hid_info(hidpp->hid_dev, "HID++ %u.%u device connected.\n", - hidpp->protocol_major, hidpp->protocol_minor); + if (!hidpp->connected_once) { + hid_info(hidpp->hid_dev, "HID++ %u.%u device connected.\n", + hidpp->protocol_major, hidpp->protocol_minor); + hidpp->connected_once = true; + } else + hid_dbg(hidpp->hid_dev, "HID++ %u.%u device connected.\n", + hidpp->protocol_major, hidpp->protocol_minor); return 0; } @@ -4184,7 +4191,7 @@ static void hidpp_connect_event(struct work_struct *work) /* Get device version to check if it is connected */ ret = hidpp_root_get_protocol_version(hidpp); if (ret) { - hid_info(hidpp->hid_dev, "Disconnected\n"); + hid_dbg(hidpp->hid_dev, "Disconnected\n"); if (hidpp->battery.ps) { hidpp->battery.online = false; hidpp->battery.status = POWER_SUPPLY_STATUS_UNKNOWN; -- 2.43.0