From patchwork Thu Sep 5 04:17:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13791711 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 337F6CD4F56 for ; Thu, 5 Sep 2024 04:24:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=T7/TrOieKDmokvB+76CstcAo/MHXLXuZvmD2LpyYQbI=; b=X/3fOnxGni8jyByzUwoVbdn68o bBcPSHSxHoIJnVyBnUYL2WhcQL4oTaD/Wpx7ABqD0eXOzz9CUUAkZn2Ge9YnG6zBnKCc9ASFrHRFC xWbzHWQS0H6uy9BD6W3KH5O7WZ3KGwZRmhIz30RqfWuUcB33tn/gxX4gCyh5oGeN4Z5fF228pwuQU pdwYVMeHPpUcoSWDGY7BQAY92zDCCAsSWvQNJ//RhJ7KAjZAKdnpXvbGRrv0wTxPhdUtk9tTbBmNf DPtHFsMtyoMTvbxYN3aeqkL6DIbKtzuth/hPbiQhrPBaZr58kPlmKC4ltgKPne4VGbaU50/TBObve cC4o6exA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sm42p-00000006vCs-2mUO; Thu, 05 Sep 2024 04:24:31 +0000 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sm3wP-00000006tNk-4AqF for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2024 04:17:55 +0000 Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-7cf5e179b68so220040a12.1 for ; Wed, 04 Sep 2024 21:17:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725509873; x=1726114673; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T7/TrOieKDmokvB+76CstcAo/MHXLXuZvmD2LpyYQbI=; b=bILP9RfoCOD1JOGCAvJzlZUI5MIf7nsTUQI4v22XoXGuFl4OH5zvRHovQ/YlvE4YG2 s2jLSDehNk/lZ1FeRXNg+DiTKOqlaqQd7vrlujV1DUyLgTBnLFvCOWBI2EVgOcXehfce QzZww98b028TVP9OKkUECdIZsjs5nBcpaoPpFhgrX6JDbXvVjTI20bhpIgLMcsB434r2 D9CrYFw9fgDpxeTKLdXvMEx4bQJ6vDhywIw0BU2UwARkZqPH04qi0uApXw+Z8krAkXUx C9l/hs4HVRlS6vqodJj3bsvtg2xAmVGmvWQ3+tUa+3gR80kXMfnPKjYKFvrWL1owY96H M1jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725509873; x=1726114673; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T7/TrOieKDmokvB+76CstcAo/MHXLXuZvmD2LpyYQbI=; b=l+3m2M6t6a6OfDNNOB2yPo7N1nXlEIgyIhp/8i/lqHR0nd461SHGijAIUtgqpoA8c5 Hh+j+KJ7UPKa/5uDaMn8QqwzceWqLkCEXWAaAdF9kEOzK2CQ47BZT2GuNRDyzYJKmGVg mpvcyymbCx6YBFcO6uh7kDFZzl4u6gz5AFnSf1KSq6fOpBexy8WBGLIMnySx8HAg0WOS mburGF+S7R7EyQMKYsKxc4Lh/UuNCOvEbxgYdm1vN2+LpI+W5LHGZtoos4zkFGXqJkld poB680l3Q8TO+8kQEd1BZ8A/MQiupOwW9uvIeDqkSueZPYTjajPiGah2ze5DOydXhAhL iwWg== X-Forwarded-Encrypted: i=1; AJvYcCWEI8+9+u1+fYTR2RmIvGoZtogxIPG3N5MIJJYYIj122mT8O01rJ8N+0sc8zxgIAyLcFqkNfqwqvvN9t6hNlOxD@lists.infradead.org X-Gm-Message-State: AOJu0YzNZpNk6lqMoo/ZCoU4BvNmv32p/gYsCcswX4BV5aWLoeMIRczt UMdiIa7OtQunt8OLkbdO7fv9jqeXcAfsW93nVgxrSoyaXHF++m/3 X-Google-Smtp-Source: AGHT+IEVTNgBOGvJQB0FLDExyZ1paUWKmbJHsocyoE4L6WqC4aDyBtqt1vWJsKWhqiIBmoYibKVEkg== X-Received: by 2002:a17:902:e5ce:b0:206:a6fe:2343 with SMTP id d9443c01a7336-206b7d0aaf2mr83347615ad.8.1725509872338; Wed, 04 Sep 2024 21:17:52 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:13bd:b4e:4c0f:4c37]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d4fbd8d52esm2450216a12.32.2024.09.04.21.17.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 21:17:52 -0700 (PDT) From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: =?utf-8?q?Pali_Roh=C3=A1r?= , Helge Deller , "K. Y. Srinivasan" , Wei Liu , Dexuan Cui , Samuel Holland , Lyude Paul , Michal Simek , Hans de Goede , linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: [PATCH 06/24] Input: atkbd - use guard notation when pausing serio port Date: Wed, 4 Sep 2024 21:17:11 -0700 Message-ID: <20240905041732.2034348-7-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.469.g59c65b2a67-goog In-Reply-To: <20240905041732.2034348-1-dmitry.torokhov@gmail.com> References: <20240905041732.2034348-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240904_211754_058564_1B034799 X-CRM114-Status: GOOD ( 10.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Using guard notation makes the code more compact and error handling more robust by ensuring that serio ports are resumed in all code paths when control leaves critical section. Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/atkbd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 5855d4fc6e6a..ec94fcfa4cde 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c @@ -713,9 +713,9 @@ static int atkbd_event(struct input_dev *dev, static inline void atkbd_enable(struct atkbd *atkbd) { - serio_pause_rx(atkbd->ps2dev.serio); + guard(serio_pause_rx)(atkbd->ps2dev.serio); + atkbd->enabled = true; - serio_continue_rx(atkbd->ps2dev.serio); } /* @@ -725,9 +725,9 @@ static inline void atkbd_enable(struct atkbd *atkbd) static inline void atkbd_disable(struct atkbd *atkbd) { - serio_pause_rx(atkbd->ps2dev.serio); + guard(serio_pause_rx)(atkbd->ps2dev.serio); + atkbd->enabled = false; - serio_continue_rx(atkbd->ps2dev.serio); } static int atkbd_activate(struct atkbd *atkbd)