Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp674973rwb; Thu, 10 Nov 2022 06:08:49 -0800 (PST) X-Google-Smtp-Source: AMsMyM4chkmZxnuNkpzn8EprfEUuHYHHcso1RKBPLZwl9ECpK2i87IhyjSc5kCSr9zz6WKSWZVAX X-Received: by 2002:a17:906:8a47:b0:7a3:86dd:d33b with SMTP id gx7-20020a1709068a4700b007a386ddd33bmr60816970ejc.67.1668089328940; Thu, 10 Nov 2022 06:08:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668089328; cv=none; d=google.com; s=arc-20160816; b=j5RA0jAjL7HQ1roycIHWksNYQNhHV7M59HvchAiui4ef14gDlP2g6VO/OoxY9FK4wy RSpM0B/P1k873ovPxvQzh/DkRTcUGrEeVQUEoNZClHZKEuFv6u+tf3sIfbniTZa4Unjs QR7kj3L5KvbVlB2xxw0Ux5k2UPOatW7B0g7n9pgxZR2qMugu9NPp8M2cLPPrN6B8/Lzl PEXWNM0NxyMg0c+X8DPUGjCb2eub/zZs9+LDUsMNm2o5ZfOy/QpALHT/tEHs5pOemYWZ aJa1qkAFiCbbdxK+FeVu+D8Z6y+3KxULJ8rHY7GteOvASpTW8+DKjH5od+g1DgY+3Hb5 sCRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=W9gAlgK59K3GYVN1pexux5Shff1JGMx2AGh3/W1sEoo=; b=PpHGBdWv5Ei+C5VIBnwzxjk+X77JuiL5nBkmRDDKNfFikZM6faetLKhCa106SRIWKu nudinIHy0PNFj6Ek13G8fXG7fvttTIM+5VnuIZbmcAxm6+rEafyLvYf7LAOyF2LPyoOn J1cCWvg/4PAHSyTiBiA+8D/hryYAsrkNIlP6p7cn6+nQ7p1Ll9amoeo5nsp/2B5qCXK1 SLiNzo9XQnX8pn0RT44qPNhb0rH6aTVfrQb8pjLLkTXr3VrT8YEW4ZcXFRL7gcJQVISV VMVZ3BHdNFRgVU7w4N1sBmD7zU24WaxXaglErj9JhbwKxMfg7CpF4r5KNf7v2OMIPh6J o5lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=nGrAAys6; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s22-20020a056402521600b00461f44d7bfcsi22712555edd.573.2022.11.10.06.08.17; Thu, 10 Nov 2022 06:08:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=nGrAAys6; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231167AbiKJNq3 (ORCPT + 93 others); Thu, 10 Nov 2022 08:46:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231182AbiKJNqZ (ORCPT ); Thu, 10 Nov 2022 08:46:25 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EE4C6B219; Thu, 10 Nov 2022 05:46:23 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668087981; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=W9gAlgK59K3GYVN1pexux5Shff1JGMx2AGh3/W1sEoo=; b=nGrAAys6AP0r4qx6oHZchp43VEZmz20vcT+t1BaNy27TPPFm4TQtF0+nUf15FVU8Z7FDRu iVTzsJDR6E8nzaADMzn953RkpQP9GGUuKkJX++fD7VpUoRVKxJikK8zXQCP1LqO13RHYC6 /FZu+D+KFveJlRPM02AyaOd1HbecEn2XMmnIICNlE3GjsBd6IXROjlPRBQQeYlmbz2OcA1 +9BO1F/SchFFRyYUeSPx81KvAfQ6NEEYf6xua0LtvI1/1c5ooWpx7XVysd7qgAWvqwL1O2 s2efj4opntJMieDi/H/q0DjXAiKBEcSW09ZqiYo8kS7zS/x21I+48gl9U3SA8A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668087981; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=W9gAlgK59K3GYVN1pexux5Shff1JGMx2AGh3/W1sEoo=; b=J2wQ2EmfTl7/Zy284MB9bR5WsxeYkNSFqUxMX4V5DLw8iHX2H04ziDoqljASf8tQo0C173 xOtYi20o3hDNtICQ== To: Petr Mladek , Geert Uytterhoeven Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko , Ilpo =?utf-8?Q?J=C3=A4rvi?= =?utf-8?Q?nen?= , Geert Uytterhoeven , Tony Lindgren , Lukas Wunner , linux-serial@vger.kernel.org Subject: Re: [PATCH printk v3 23/40] serial_core: replace uart_console_enabled() with uart_console_registered() In-Reply-To: References: <20221107141638.3790965-1-john.ogness@linutronix.de> <20221107141638.3790965-24-john.ogness@linutronix.de> Date: Thu, 10 Nov 2022 14:52:20 +0106 Message-ID: <87fseq6hxv.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,INVALID_DATE_TZ_ABSURD, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-11-10, Petr Mladek wrote: >>> -static inline bool uart_console_enabled(struct uart_port *port) >>> +/* Variant of uart_console_registered() when the console_list_lock is held. */ >>> +static inline bool uart_console_registered_locked(struct uart_port *port) >>> { >>> - return uart_console(port) && (port->cons->flags & CON_ENABLED); >>> + return uart_console(port) && console_is_registered_locked(port->cons); >>> +} >>> + >>> +static inline bool uart_console_registered(struct uart_port *port) >>> +{ >>> + bool ret; >>> + >>> + console_list_lock(); >>> + ret = uart_console_registered_locked(port); >>> + console_list_unlock(); >>> + return ret; >> >> Perhaps >> >> return uart_console(port) && console_is_registered(); >> >> to avoid locking the list when the first condition is not true? > > I do not have strong opinion on this. It is true that the code > duplication is trivial but it is a code duplication. Either > way would work for me. I will go with Geert's suggestion for v4. It is important that we reduce lock contention for non-console ports. > The reset of the code looks good. Feel free to use: > > Reviewed-by: Petr Mladek Thanks. John