From patchwork Mon Nov 14 16:29:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Ogness X-Patchwork-Id: 19903 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2238721wru; Mon, 14 Nov 2022 08:32:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf5uGA2RRVNa7XA/xNlD49KKTo2bK3aHQ3tSN+9ow4reRcfzrWteFMRGidbiA0QhKerbOlea X-Received: by 2002:a05:6402:3719:b0:462:6ace:c522 with SMTP id ek25-20020a056402371900b004626acec522mr11526831edb.91.1668443545281; Mon, 14 Nov 2022 08:32:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668443545; cv=none; d=google.com; s=arc-20160816; b=kydqL3rZcmfkZMb+alAR25ACStaQGdMc52EVGIu1JwsISSRTReC9syJimtDISrkTzO z27Ru67MK7LMDoRQ8XTJFJ+DWSrMEEDBYgSag0wAGVgaf/tG+MNOcIGEp7O9g/u8iViN OJdVkw3pyC0BzDeRLnBtKUgk0dBCkTq9UCscIK3tjspwc2pLil2o6vkt8Ug3/QLww9/5 xDI4NthK9WAcdMfs6coVs3t2YS6Lyx4GDgpMe8I/J/7kiFRwOdig3rMTXqGDo2HIwWwt +0s0MD5YBYOYdBGzH9558SS3bpN/XowhBwB0F58uiPrtVsuRZeRwss9vFdbgVIW+bUDg i71Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=6hf4u/s4+AojpME8OJwmFCYo46PpjYxYo+DIhKotoZ0=; b=EqmQXjOap0cxqPTppHRxE4+BATEPUG6p6nDYUK/EBF9XjFAAX1kDRDWeaG525TRQUx 3sBBWFFlyoJuCzNHitvjNdiCV1G6JQtZXSEo8LJ5iunLMIM5KZkFuaodHEXCYLJOdRqS MXVIpgHAVI3jTn/BrVnCHtAQrh3wOBx8DE8MRABsb6gA/M2J1hQFCDJx4AL5M87Rb4IK CdZCER6ctrnKGBW2VXTUiNy1cmbop+D3Pd81i+zGP6CTXm0mGSBZmyl4AXDXpFYmqPZM jffXVukcntznxLTbpm1dQrWOrs/8dqGCinysmLqZ/QUDfX0IlwdLk0Qtg7RsBYFwvJaQ 6Qag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=3A3qm8uD; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id js6-20020a17090797c600b0073dda1430b9si9778285ejc.403.2022.11.14.08.31.45; Mon, 14 Nov 2022 08:32:25 -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=3A3qm8uD; 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 S237814AbiKNQbV (ORCPT + 99 others); Mon, 14 Nov 2022 11:31:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237633AbiKNQaZ (ORCPT ); Mon, 14 Nov 2022 11:30:25 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 462A3248DA; Mon, 14 Nov 2022 08:29:46 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668443385; 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=6hf4u/s4+AojpME8OJwmFCYo46PpjYxYo+DIhKotoZ0=; b=3A3qm8uDKxldk2T+hFZX4oojBNblkduXllzMasj4W0ht7c2/3fqnH3zNEGNyz7UDm86I4R t9xNaY7SebfdzeMGbytN95G8jY2ce/0FUqYYjWsk9XkYvi0nWdcZqHayxg0mH0TEdFDQM4 wcluFDiKhfi2ejqyWTs4wTolKa2I3oGyg5K0MdUThrH4GzDkdygFjO3jy0bdDbtootI8Tp RraaolWi+bzN9nt6VpvWHUx+FDJczUk5x/EllO8pyEK37fhDFX8v1L3/vnC/0HqNpDH01l T5t20yuqcBRRSb3YbAfmH68OtB10CA4Es9BqH7O+2scnn3tvpqr8PLQ3kXlYzg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668443385; 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=6hf4u/s4+AojpME8OJwmFCYo46PpjYxYo+DIhKotoZ0=; b=6SYcyGF1KYOUi2rQepMLbRowh0PZ02xDI4iFmHmOD+BhQAJdnS81gt5fyN4spMhZcaCS2/ rPEVeTTT6MB5zXDQ== 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 25/39] tty: serial: earlycon: use console_is_registered() Date: Mon, 14 Nov 2022 17:35:18 +0106 Message-Id: <20221114162932.141883-26-john.ogness@linutronix.de> In-Reply-To: <20221114162932.141883-1-john.ogness@linutronix.de> References: <20221114162932.141883-1-john.ogness@linutronix.de> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749489859036047638?= X-GMAIL-MSGID: =?utf-8?q?1749489859036047638?= It is not reliable to check for CON_ENABLED in order to identify if a console is registered. Use console_is_registered() instead. Signed-off-by: John Ogness Reviewed-by: Petr Mladek --- drivers/tty/serial/earlycon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c index a5f380584cda..4f6e9bf57169 100644 --- a/drivers/tty/serial/earlycon.c +++ b/drivers/tty/serial/earlycon.c @@ -181,7 +181,7 @@ int __init setup_earlycon(char *buf) if (!buf || !buf[0]) return -EINVAL; - if (early_con.flags & CON_ENABLED) + if (console_is_registered(&early_con)) return -EALREADY; again: @@ -253,7 +253,7 @@ int __init of_setup_earlycon(const struct earlycon_id *match, bool big_endian; u64 addr; - if (early_con.flags & CON_ENABLED) + if (console_is_registered(&early_con)) return -EALREADY; spin_lock_init(&port->lock);