From patchwork Thu Sep 5 04:17:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13791706 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 F0800CD4F56 for ; Thu, 5 Sep 2024 04:19:51 +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=jSQ5nHDaIzTNEy48GC2iLuCGQVf+qFQuSKyHZ16Sx1U=; b=kdKKgvvwnDxN4hb539I/ATB6R5 a0NpqQb6kX30ZaYJrsPPcY0nZ9HoOfRVjAedphvH0e4AGxtVL2P6jtKvNFBbuIhXx6RXIens2NDX8 u3xuR4qn2jj/KurzVYu+hhW/u79FNL07g5BTOFrhxhB9ukOUbbV1hOKggUrjS+jMVrq3dsOIibdb9 V72tqRBXzoLbl0r/QfyxscG6+lMK3Iz027AEW1EGmnAcDQI5hA+OI1Bq/TbC8aQcXNarPmPzH2Unp 9r6sWmfrZcb1yw48PfOSQiWDqbs/oLp7smW4eNoTSnZJ8lRKYsEtGkIHgwxM9vBnpYROEKhS6gIE3 ad8yWIww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sm3yB-00000006twX-204T; Thu, 05 Sep 2024 04:19:43 +0000 Received: from mail-oi1-x235.google.com ([2607:f8b0:4864:20::235]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sm3wH-00000006tKL-2IGw for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2024 04:17:46 +0000 Received: by mail-oi1-x235.google.com with SMTP id 5614622812f47-3df0a54623dso175772b6e.0 for ; Wed, 04 Sep 2024 21:17:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725509864; x=1726114664; 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=jSQ5nHDaIzTNEy48GC2iLuCGQVf+qFQuSKyHZ16Sx1U=; b=gANojXn+wCrXcWr25w2rwfZoM57qr6vnqtPuuYBe8/ohWt/XjsS8nd65Qt40Usvcit oIxH8D3ye0k9A4X0cj3n3XDCo8IwDcUjNMt/FX9AW3yuJPH5fGe/j9E0B4MIGfH99aD5 C96L8Sk5bcJJnZ7JLU6yXn7LVBkWfqbVnAGfevngxZg9UfT3bUk1oQGhcwtAwIS3uCz5 tr35bhRQcPYNzKN5EG1O9OftS3Na47Z6fVoHnpunW/862Sn1GAyQ6ED7++KnATRne369 aUGsgB0sxgi5xnZ1ZlsFbuLCAEHh+8L/LI44ZRbpUEp4w+5mi41rxIds22+jSbLrhk7i X0fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725509864; x=1726114664; 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=jSQ5nHDaIzTNEy48GC2iLuCGQVf+qFQuSKyHZ16Sx1U=; b=lZoHcUPCop8x6J2O+o9FtJErs6B9mcVGpzktrLQhRamdCykgNvmG7KkpYwfVh2nKKl +APHw0Gv/0e+4Vrk1DqNexM/tGgRZ94Q+YE1Z+BiPf0MrX77bJarOSHKlklAgj6Gnuta yLKYDvwh7K/RcOYXCbc/zSI0XCZNEjlZpmQWDMt7HSWnzbUMDdLPeDmVR0wBpLAclAV1 v1NtXE1MFHjgT3G7sT4fLLhRw9SXaruH7Dr8d1sF+RTgdf4tRVwTSPp5/G0qHWKeLZyg 4c3NjFUvRDBt9aeJr3d1x7rI4UFgAhK0WZ6twzxTB78GT7k9WVBoZ0eCdzg1XH/V7ygz +3yw== X-Forwarded-Encrypted: i=1; AJvYcCUcPDrXh/EbwIUFHmRnx6ZhUYjohh+tYj6v+wleaWyxdmaAq2yUmnDWq4WzDNito4tvP4da8FBGpnjT5GMUgNEf@lists.infradead.org X-Gm-Message-State: AOJu0YxXyQjNlunFrLrGyXgLqjbUvR4hWsvRFuLg6MqeOdn3wiZL0sJN h/KIPGFkF1esUAGX/3w/UYDQ2rSm5n6ufTvNKYZ13PXa4FHnp9+Q X-Google-Smtp-Source: AGHT+IFOWA+kffVJfvYihB03juJQybTpapwcpoQKqlaiy/ZyXN6NKX8+I0jp6NbDCWaxTJ0rpgLL2A== X-Received: by 2002:a05:6808:10c3:b0:3d9:e109:a6d3 with SMTP id 5614622812f47-3df1c98f83dmr19335301b6e.26.1725509864123; Wed, 04 Sep 2024 21:17:44 -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.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 21:17:43 -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 01/24] Input: serio - define serio_pause_rx guard to pause and resume serio ports Date: Wed, 4 Sep 2024 21:17:06 -0700 Message-ID: <20240905041732.2034348-2-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_211745_626303_AC7530FE X-CRM114-Status: GOOD ( 10.32 ) 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 serio_pause_rx() and serio_continue_rx() are usually used together to temporarily stop receiving interrupts/data for a given serio port. Define "serio_pause_rx" guard for this so that the port is always resumed once critical section is over. Example: scoped_guard(serio_pause_rx, elo->serio) { elo->expected_packet = toupper(packet[0]); init_completion(&elo->cmd_done); } Signed-off-by: Dmitry Torokhov --- include/linux/serio.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/serio.h b/include/linux/serio.h index 1911827bbe0d..f4ca0aa37553 100644 --- a/include/linux/serio.h +++ b/include/linux/serio.h @@ -6,6 +6,7 @@ #define _SERIO_H +#include #include #include #include @@ -161,4 +162,6 @@ static inline void serio_continue_rx(struct serio *serio) spin_unlock_irq(&serio->lock); } +DEFINE_GUARD(serio_pause_rx, struct serio *, serio_pause_rx(_T), serio_continue_rx(_T)) + #endif