From patchwork Mon Nov 7 14:16:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Ogness X-Patchwork-Id: 16437 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2078254wru; Mon, 7 Nov 2022 06:20:16 -0800 (PST) X-Google-Smtp-Source: AMsMyM7dS4GFrAM/0zz0nipa46IzoBdMwZGBeZGufiPpyZt027Z6JETopvANpLdPrZg0yf974pS7 X-Received: by 2002:a17:906:847b:b0:7a6:2ad9:298 with SMTP id hx27-20020a170906847b00b007a62ad90298mr47429368ejc.90.1667830816529; Mon, 07 Nov 2022 06:20:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667830816; cv=none; d=google.com; s=arc-20160816; b=QfLFfYTjwuRaTCXVdWhrnmpIaAAveVZSxgykCqP7V8X1l8FSJ3F8gwdqIe4VQAn+N3 /4TmZ1bvnJH0RJyjfHX5zOKqG0kEj+LXpmpgsVjWqstC9VF85+dBySl2OMoA4iQ7/7Wy 5oOfWK67VvT+QkI5EVeZ/d3YAMIOBglnyzf57Fwe7Fns7AgM8O90O7PH4odfwWM5butx n4jdomOAlWYbsyNsqhgcR+ZvR5VRiD69FpdvgQbdYR1PI28YZGJdi7kQhcq4lf6ZuoAG YFPeQI58UetfqyAEJuI3bMp2IsNMj2zFY+iWBEBMD3UjoVIz1Qjd4AvpPgxacGLHogPB /zTg== 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=rIFVvGo20s9m3a2ORQZJ6diZh72O0KdKN/vykqpOG6M=; b=QblSDsidHT6EMHfyuSpdTNl3P9q/HAHRHsQPm1khcll5wSpbKQ65aHWgdX/H6ccxhd 2Y76wdREm97ojzF/xpCp+KROVFeYzVM9z3PAI3WxuSswhOOJt/RJcX7BFwKAx4XMIFiz sDUZ2Lw+S+tlc2A2zq7dmRSmUL4MPFE1hJDSBvcMePSOddt3cN2pp9HIl4VFOSkvPZGO 4aOmDAtJRSel/ZEf4VGv2Xr2H6FU53erj37KVEtGBV3M3+BJmF3VCqw2NULFVqwMjJOg 2O1/oJigyZJTrk2E4Vcf18X8EN47rnfoObc/ECHAwNodpHA3i61Lyd1JxgdSb+nPzeWr +Dtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=MZJB5lX4; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 o11-20020a50fd8b000000b0045fca739593si8381394edt.188.2022.11.07.06.19.49; Mon, 07 Nov 2022 06:20:16 -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=MZJB5lX4; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 S232338AbiKGOSf (ORCPT + 99 others); Mon, 7 Nov 2022 09:18:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232222AbiKGOQy (ORCPT ); Mon, 7 Nov 2022 09:16:54 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE4911D0F7; Mon, 7 Nov 2022 06:16:53 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1667830612; 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=rIFVvGo20s9m3a2ORQZJ6diZh72O0KdKN/vykqpOG6M=; b=MZJB5lX42WcNqfQf/8Uy4aTmZOi552MX2XYZ5hG9OlguJgac67mF5BEXukX1d+qbynQc/L P13tXHiAAu9wRwaCfqN6TyjkrzUUkQNJA/l3DU53O6LkfVv5tI+qVxI2f8nZUIPn1b5S/E O3beP8Dac2x2r2ouaorlV9viccM6cVWYvKhliiBWguW38a07M6JzMV/CO5GqoyXLcp/hKW jHXOW3VMeEi4kzZGi3VPUxBDKxLeKLxdBzyFBTIAN8V4rNN9ZDGsAaQIH32Ozl5KcV6av/ 7DTDlBs1hTid01SHsrwLPYbWLGGbdYgc/xSMf9EqSBy9atMNjA4uSA1+zIlH3A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1667830612; 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=rIFVvGo20s9m3a2ORQZJ6diZh72O0KdKN/vykqpOG6M=; b=ALG9eKOl3s7Xt0eEnwNoL/F4GKWQMH6+qAGkok3zgVPzcLXBeHOOBayw+8bjy9jYTFLvj/ pW3IJBvcGaP2m1CA== 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 v3 27/40] tty: serial: earlycon: use console_is_registered() Date: Mon, 7 Nov 2022 15:22:25 +0106 Message-Id: <20221107141638.3790965-28-john.ogness@linutronix.de> In-Reply-To: <20221107141638.3790965-1-john.ogness@linutronix.de> References: <20221107141638.3790965-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?1748847366499662983?= X-GMAIL-MSGID: =?utf-8?q?1748847366499662983?= 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);