Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1425039lqm; Thu, 2 May 2024 14:39:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWMpF+6dY/rR8pS9SOhi9mFQgrQYCG/yNtqB3f+pXvllak6JGSolfx8/anbOvt4rp2dLfsM7roF9l5M19B6ebGzcm3eE3YsUnpuuhCdJQ== X-Google-Smtp-Source: AGHT+IEpbKaX9yDefDbJ0Caw/nD+cCkxjZHh5qfmAK70LmoGz37AzEjgWsl3aKk7v/+egr/WIfCg X-Received: by 2002:a17:906:4888:b0:a55:b020:fce5 with SMTP id v8-20020a170906488800b00a55b020fce5mr341864ejq.61.1714685991809; Thu, 02 May 2024 14:39:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714685991; cv=pass; d=google.com; s=arc-20160816; b=faBZ8mrHwCPxThBw6HUlkL5ROCoDjdZ2Ph2PqZUESYSbvPSJXQwpEVSwDAGCpqPOWh iFXvvZfokFJ4RCPojuLTnKyuebewGIeAkhLPJOlZAmfEstmvbgG2WqhM5hqQp3/4T+SD KSY0zw5+kj62ddnegrt0T0Mh6fipFdxDS4Uobun94YgEk1Z04NQ8ibqbUIP0JZoKjYVg ZaIOZHrdMbFzQGJF/eWIS0CJ+H/CRhmyvRKJLRts+hRdE1/vX49ry/FW+E9gZR1Dn0LQ 68TnWpM4vcH7kYUomFZ8orx+XXdHj2cm+WswzXQGYLKE5+drmruIggb6lNrrI6xMibUh eeSg== 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=eIZJ3Y1dK38E2Kp2XgHqxumRn8fsxDM1I71FdOp4+wHsD46O6QvHBooU12Rv9pzFoy b1InxbsTvG2i0RI3NwrhnttPkZE/DW0X82SNHgArEK/XwErwHNsNLc7G9p3DJ3Ye8M9r sxnGS4UrWRAT2SujIigj4jJBvQTnnoqthJePkWC43hnlsX1gWUqHqKgMypFa4LPTF1c2 RtY27bgrzkKj2/R+mEZGfJobwxufqwcUb8riGlQqW8odsli3ULFaXTdG64P4mTqGypTH 6y5X06xSpxVYSyk8wl0GLPXoMNeo238ScaPMoEHKoJjACpHW4strc/6PrlcYsMPEy/Q4 DNdA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=kk8VD7pT; 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-166957-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166957-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id k4-20020a170906680400b00a54f054f523si869957ejr.876.2024.05.02.14.39.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 14:39:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166957-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=kk8VD7pT; 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-166957-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166957-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 84FA11F217CA for ; Thu, 2 May 2024 21:39:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8D5C41C2310; Thu, 2 May 2024 21:38:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="kk8VD7pT"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="s8Ey1dq2" 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 1C61C194C82; Thu, 2 May 2024 21:38:48 +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=1714685930; cv=none; b=UemXEzY6e5xIShaGgDe2nxpylwVmn2hE6Y/3KXRZJ1liQFIGNMVSd9naS6Jr+YfyJ28moXwXB1GfgJG/kPTqsgYXQj9IVhQDTzVY0TeKsDoCz4VRI0VsUwQN6w/iPdCNiLko2CoW0RX2Kv5svjC00uTuMBpcQPugcGeGYOgFoOY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714685930; c=relaxed/simple; bh=AiH8EnN6GRzi8B2qcObkU/HEqg04wntd+nSfmS7tVhM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=obfO9Jx9jODlMDaiI9uhEyvOHV+zyYGQLwlOSwF4VPhLWTYwLkv9SGfbA6R8ogWlPB9hN/mjNHhTa5JDdnrQv6dlH078UmLhx05AYS2oBd89JgLay1sz9gEYBE1rj3j6/sLtW2RuZbIjI5GNQrgNGLraLEeYtJQqe2xDeN4/nY4= 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=kk8VD7pT; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=s8Ey1dq2; 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=1714685927; 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=kk8VD7pTXAIheqaqkPXOTdrJTW8fze+gim+F43pfEbl+kcsw+kE55hvDaaTRjDKKW3IU64 XJIxmLXffSvx19JZym3M30yfv6/1oez7u9mOwI2a9AA9oFwgb7kWBjt+kG3vZQWuddTDLH tYBQttmPIKGxkPVj4w/O66KaFyTcZFFBxqrlAFst1cMDAYu7A1ISvzjvZfuJcMrVbx0YAn iFRrXMhBh2+aVEAg3Ls8RiZVaDMiBbI5ut6MEonRVYqIttJq8uF6V0GZlPhpVwQG1710dr Yz3nXr3UYp+13YjUlj7NFxMj27bDsQBdX/t6Y85xNSszUr6MbeYETGvTqSaSWg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1714685927; 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=s8Ey1dq2S0Xo9P9sf+bTQCXOfYgSv/3zPCVQmslOZEzOEnoaaNgTxYePAeg0mWF2R+TPew Er6mGVceIF4vDOBw== 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 v5 08/30] serial: core: Provide low-level functions to lock port Date: Thu, 2 May 2024 23:44:17 +0206 Message-Id: <20240502213839.376636-9-john.ogness@linutronix.de> In-Reply-To: <20240502213839.376636-1-john.ogness@linutronix.de> References: <20240502213839.376636-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