Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2356793lqz; Tue, 2 Apr 2024 15:13:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV8OWHb4peAQef5bKyuRJYZhgv9BTAzA2rgGXugFnieATkbrB5/g9KcC95MYeNoDXTU1VYJCrMusRxjsoQMxD9GwPiW+K3kDOyvmkiVTg== X-Google-Smtp-Source: AGHT+IF0V/zy4lx+mME13MOnfTtVRCYoz75iNCwDFn+LKfRW62P1BV/SCShsJ5WA2rqHcIF5W0Uk X-Received: by 2002:a17:906:39c6:b0:a4e:26a4:bc36 with SMTP id i6-20020a17090639c600b00a4e26a4bc36mr7881298eje.7.1712095991694; Tue, 02 Apr 2024 15:13:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712095991; cv=pass; d=google.com; s=arc-20160816; b=NoZ0ocViN/ZOakCZxjbn5qRSq829HXmWU7L10BsxvvqSAdL2Cq1Z50sIUcc5e881NS FZ9bCHWyGeW3r7X0KqgjsIz0hIxlj3D3NuiFsUCMsZIg6cfTOnngVYjpT6Lj6SceTkAt AS9DN6mabH/4bncLyX1ouqh8Og0lPPrBvtf+u8cmbtbDktkZneIWdDtzTPVW9WjpQ4Ye 2nu1avDmVcu66K4zZTxasVau6jCwnRZ8iIBg9j+nnyvUL8DAnfwxr1rj2yivAE4Uc1of 7UZYi80FWnASMkcJ1/RrIDA4RgT7IjkTq06sqYi3wauvkPTWXe3xLi1MyME+1u21Njp7 y24A== 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=np/D3T0A0n/PKPue9SIuCwjpbic3bBzP+cAanQ+lkJw=; fh=HKaqXHh+fz3Srk83AIMeiRhuuxUdJ/iTyHPcHN2kxVI=; b=LjtSjr94WX2mQvg4wHhD0/3mz8LMLy4mdumDsvuDLjfYOSfDjbRQYBDIafZDGDa03X +PtEM7wQHphiu74M3HAFDlcSPcCPVTeXjACATC6btsfpQNqinKYzYAzZeAeYuqeBJ4gP 6TmYm0+edZ1KCIiL14ovz8mqxKOPqOz+gQ0K6rRYIQQyTEmMaCLWfGlJTOHqp4Apsm7z /b1s45Be/K9f0yXuLMsshmMBb2svVfhcCAc6TA4G+HW12/kb7zWTcFF1pgn6kzYRAslz 2fl2o95eF/KCvxescMaDPUudQWQqyH72vxCz8bjIbXakq/B581ic4qD09vslH+XKw7KL HVBQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=pV1zFXK7; 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-128767-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128767-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. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id bl3-20020a170906c24300b00a4e7e293299si1592849ejb.143.2024.04.02.15.13.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 15:13:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-128767-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=pV1zFXK7; 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-128767-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128767-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 A96AB1F259DD for ; Tue, 2 Apr 2024 22:13:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5235015FA66; Tue, 2 Apr 2024 22:11:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="pV1zFXK7"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="zluu/oDS" 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 8192F15EFBE; Tue, 2 Apr 2024 22:11:39 +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=1712095901; cv=none; b=skC+nYvAMzO2W7ZH8tLb5v6UyhAWpJnEyTn97Y8ZWpCmdjqrxxtg9yyWxPhNIryOO+/yRVLBtBD6oUSMZh/cM3J+0e0noTDu3ivFltnr6EudkahLOm2spIfpOlDsSoZYDVTBTR7Ue2M/OMDR3w1vKJUSqoGXePc+vf6eqx5GTjM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712095901; c=relaxed/simple; bh=/X5uefQjhA750hOZTgQlvyUovMXIIaaI0zWJuuBr4mg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=D/UTyo8ERb5QH2ivoEwuh+PWsMa6fxF9FgyYm7hWMvk5A8BbuNDYwMNkTnzmAWpNHYAwgth9k5uvllJKZq22upEqFjT0H8J9M6IzmkR7eBFYby7UFwDJ+T+HFRq5kd19YaSmWaSdJ8QKD67Jl2DlKmLzLg2/6F4WIZhvhV5T0sw= 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=pV1zFXK7; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=zluu/oDS; 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=1712095897; 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=np/D3T0A0n/PKPue9SIuCwjpbic3bBzP+cAanQ+lkJw=; b=pV1zFXK7RAbppXFv2IS8dg+AhtNAnjopkWGUF2CklgX9leSv1mvngtanG0zDD1M9HcNiHt 8fgHYo5P8BbLt/aOwP3OikrckUHgIXnFXFsFnXgxKX6BmLbStdCMdhu9kpQFllBVHoQg0h fj0rw92Zqk/LjGUqdggnaA60qWJODj5iJZjC9jGuIgMQqR8SCMdwE5PNERKXlHQiHLXheJ BbP2Umkls+hFnaKPkQFa4K9qFA79Cu2raSBpUaIArQx1ryayBkqFCkT9MK3nowVRGRGkOG EYSjzfuOKFdN1ETE8z4xRRDNz47WK0PjleGmNUApfrmwkJjihrO7Xf8FImquyA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1712095897; 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=np/D3T0A0n/PKPue9SIuCwjpbic3bBzP+cAanQ+lkJw=; b=zluu/oDSmszLBYJ/hpp2azudGkY5hPIYhQCXTs+b4t6Ld8QirZSsrSrRdoTSFQ98bEea+L RS7F5AOcNjPlSuAg== 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 v4 08/27] serial: core: Provide low-level functions to lock port Date: Wed, 3 Apr 2024 00:17:10 +0206 Message-Id: <20240402221129.2613843-9-john.ogness@linutronix.de> In-Reply-To: <20240402221129.2613843-1-john.ogness@linutronix.de> References: <20240402221129.2613843-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 --- 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