Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1876643lqb; Sun, 26 May 2024 23:40:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW36qfgrheLYeqqC/wMwU49FhM+x3fEosXRosBpgbqjxvtIsGCZx1k9sYFzTZDxXAg37oOqZGtdWiMuZTOgvBV7fSZzyFCNPN7gIWHiyg== X-Google-Smtp-Source: AGHT+IGtwCg6QRnaLyt0EdtnHHtlDud6UA/3S8mrkqQEQnM+nXlxYWDYXnV6n3scjJu9/b3K70op X-Received: by 2002:a17:90b:8c5:b0:2a5:e087:768a with SMTP id 98e67ed59e1d1-2bf5f0122bemr8815579a91.29.1716792018828; Sun, 26 May 2024 23:40:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716792018; cv=pass; d=google.com; s=arc-20160816; b=we5LOOoz0JT0XcuzzBpfcDri3AirbVj7mNH55vqJIbSXtixy1+5xuQzdQnUXBO0qhU RAJZxMVbC2Z32G+hNKDHtxR3RnI7RsPTdvixS8yzJnkinFVUmxnWbNJWFrGMS8agFPU9 pb4opio/09g5TeJ2FS2PBHOzrvmEUm2Wg5hsuOj+vhn3VLgA4zleNALJxHG6dtdHrteZ 4wdTxdTKzZU8jEgMfvRzp/g/9CIUwux2oyAqUb1aMdOFS40T/wJz6UM8IK4VL6g6eV/q FkJkG5SXeKrx+dEV5pu3EVf3prVnnyy0AXbmonv2pOMPAJuzO2rIIcvP1eW0ZbF4fANh 8E2Q== 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:dkim-signature:dkim-signature:from; bh=TkEmSH+TeCzW4mgc3Qx6oM4UTLT7owCiQ5MwVZZnUf0=; fh=HKaqXHh+fz3Srk83AIMeiRhuuxUdJ/iTyHPcHN2kxVI=; b=cmmaL7Pi23WbF4f8Mj6kMakp94iY/4l9dL9nhMNvH8X0onI580aGBGNTTT2sv6NbAB Smm83s8BjbwudrolTzAAQBBxOamfGK7/JpmbV7q3mxj1ODyKc7ncRULAqUjz8c2PmqpY ZmQ89lQhT66WnNbMLJWuQUayEa4rbvi1Ds6DnSG6Af+j3wnxsMO/jIV2ueabhUh7C/xq 6F60GkcJ1EPuiFg+itjeGao/bM/cDc5QwMXXz/mIjC/fhRFpwVmJI2wPHuLcJJZWFYdx Qf9oN6ZIsUf4rHrNxQmngLYE48EoGypr7S7x0tDgFCgmxyOtfU2qbVnFmrnCDH7CUZnm chmQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="MWfm1v/S"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-190088-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190088-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bf5fccebdfsi5462342a91.52.2024.05.26.23.40.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 May 2024 23:40:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-190088-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="MWfm1v/S"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-190088-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190088-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id BC32D281DF6 for ; Mon, 27 May 2024 06:40:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3DE8812DDA2; Mon, 27 May 2024 06:38:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="MWfm1v/S"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="mtJG7MYi" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 EB0BB1C686; Mon, 27 May 2024 06:38:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716791905; cv=none; b=cAfby1CcgxzP3nD4E/B9yqrNSMuQjSPgfxQFhkPYM7hyEIK+vUzaUmOe2sm5lOivfKgfjtsHlr+gWPbhoktctuG2CKLu540dNLbBoh8Nb9DDdXuBhy0MJq24qKf0ORI90kz9t8znh4Btw82VH7G9h6HgTnkeN7um9i1iVPHFu2E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716791905; c=relaxed/simple; bh=AiH8EnN6GRzi8B2qcObkU/HEqg04wntd+nSfmS7tVhM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lf2IHOinTeNJW7o3QSgHm1xLWAoSZhia96Nl4NQTui93IwRvAVvtFA59e4SHOkf2Uy9syHwB2n2DE2HJRnLj8Vd1LyPKxx6Al/ihTgVQrBzdtSrg5t5QVNobdsIXDZRTRWhNUH7j+AXZ6STEcOzE4o4OLujqm8zkhBq62FON3i0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=MWfm1v/S; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=mtJG7MYi; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1716791899; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TkEmSH+TeCzW4mgc3Qx6oM4UTLT7owCiQ5MwVZZnUf0=; b=MWfm1v/SDq5UBs2uYn8xLpTUBfAUg6ebL8WM55kFJWkV7h2WuzJwfQ6sgmqQnn8fSy1SPK Rm7aGRiSkufQn6TiKr9IzTkSdChmnAFZECXuFb9Dnda+stuzrxGw7JI8pJ84zHxDe6jH5C fM1UShVvGDBI23d3RFshfkf1e936Rx7Lkr9L0C7YdhIcZVZZtOEXo30FYEWgpmBEkd5t0V EVSrWhW9rExqdc5qVmVgY0uEEZskuGTukTSO29YUpeMq3DEU21ItQS8BUROysuEKJ6uqev ddCH6o5QW0AaOPvxoF1xsZPg3uJ/sUKqacDDo8UCnEy6VfqPZ01zlMpOS0fgjQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1716791899; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TkEmSH+TeCzW4mgc3Qx6oM4UTLT7owCiQ5MwVZZnUf0=; b=mtJG7MYiy42HnHVpBuzvx+qMo0svogSYJ75Tg/hZgZsaUKanxZKF0fBDT0V/WWRBhJ6b8M GjR5PN9ws9T84yCg== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org Subject: [PATCH printk v6 08/30] serial: core: Provide low-level functions to lock port Date: Mon, 27 May 2024 08:43:27 +0206 Message-Id: <20240527063749.391035-9-john.ogness@linutronix.de> In-Reply-To: <20240527063749.391035-1-john.ogness@linutronix.de> References: <20240527063749.391035-1-john.ogness@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit It will be necessary at times for the uart nbcon console drivers to acquire the port lock directly (without the additional nbcon functionality of the port lock wrappers). These are special cases such as the implementation of the device_lock()/device_unlock() callbacks or for internal port lock wrapper synchronization. Provide low-level variants __uart_port_lock_irqsave() and __uart_port_unlock_irqrestore() for this purpose. Signed-off-by: John Ogness Reviewed-by: Petr Mladek Acked-by: Greg Kroah-Hartman --- include/linux/serial_core.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 55b1f3ba48ac..bb3324d49453 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -588,6 +588,24 @@ struct uart_port { void *private_data; /* generic platform data pointer */ }; +/* + * Only for console->device_lock()/_unlock() callbacks and internal + * port lock wrapper synchronization. + */ +static inline void __uart_port_lock_irqsave(struct uart_port *up, unsigned long *flags) +{ + spin_lock_irqsave(&up->lock, *flags); +} + +/* + * Only for console->device_lock()/_unlock() callbacks and internal + * port lock wrapper synchronization. + */ +static inline void __uart_port_unlock_irqrestore(struct uart_port *up, unsigned long flags) +{ + spin_unlock_irqrestore(&up->lock, flags); +} + /** * uart_port_lock - Lock the UART port * @up: Pointer to UART port structure -- 2.39.2