Message ID | 20221116162152.193147-25-john.ogness@linutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp233460wru; Wed, 16 Nov 2022 08:25:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf5iogzm3Cw6p7e/Z6Mrv+H9KkaqiXK1yJInIOStaqSw4a8ZMH7iDP5dtDWWLlfufo0/slaT X-Received: by 2002:a17:903:32cb:b0:187:337a:b692 with SMTP id i11-20020a17090332cb00b00187337ab692mr9079183plr.166.1668615954280; Wed, 16 Nov 2022 08:25:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668615954; cv=none; d=google.com; s=arc-20160816; b=G0Dao/sEopGU5EDXEcxA4EC2asdYV2b+X6/G3RRGPSzpBo3ELss2zmIfLhqkFxZEZQ 8Gwh8UsAzQL9fXXl+sbFHcB9YfBZUxQetVxOCBgjz3oRnolbkuVzSXYiNgLa7K5z5ySV RbaWMU9yfnzBHMpSxJrwbaoGo7DdC/EPuSqWp5GKFAgPF2PnSfIuVuirOOoKDM46tBQm UCoqqPY6da+xGaRkc/L5U12Kf99mMjyl+WAaavxYih20k2E2ta2mu4DjM/als1Oj39U1 uAh/xAe3ky7cjapbPrWYzvkc4xxiNimVP0p65j79ZFAfGxBgMvMmCSt3Edf7RwDrhoIh ZVgA== 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=pnYsucPfrpcazGqKeRJP+E7nPSCgbYv1OZ+fSFJF3FE=; b=V7Hkje0axlEzxRZ71ecZb6721rDF0q9vqy8F0WWKNhVaKaqdsaO0hTBlTlAA2dlYi5 UEvPNieXDaF9jvAYf1f0NzAGOeLarYP7XazhsqEWBI6/x7fy1he087V1Y0fZgcxrRCEK hSRxN3SooQrq77/1sJSdYMWHLLSXTYaSgYf7bA/GY12YAw08EAGzfHTA2mcWctOU2s9s kZiKSE78zchkJXt8yMFRJwMPQ9vIKEgQAFdbqMmdes3W94i5jJwMISxMplWHP4XHwhlH RUtPZA4CuTVaZri9FHwLkGylpP1D/ZUm1lhSd9gFRT6uuK8TX/j1VUDuTzZTmsywPZfp tZIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Mij3VvRC; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=rPN9XGHV; 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 x1-20020a17090a8a8100b001f31f339134si2199809pjn.152.2022.11.16.08.25.40; Wed, 16 Nov 2022 08:25:54 -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=Mij3VvRC; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=rPN9XGHV; 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 S238865AbiKPQZE (ORCPT <rfc822;just.gull.subs@gmail.com> + 99 others); Wed, 16 Nov 2022 11:25:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234873AbiKPQWi (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 16 Nov 2022 11:22:38 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A837B4AF0F; Wed, 16 Nov 2022 08:22:09 -0800 (PST) From: John Ogness <john.ogness@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668615728; 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=pnYsucPfrpcazGqKeRJP+E7nPSCgbYv1OZ+fSFJF3FE=; b=Mij3VvRC/6EFTcGjMoRfMHKmgufFADNOVvPxUDDVOOSOrPddxUf/MjL2jIte04n+xoT2hr 91sUQeFxNGfr+TLQTWsfBfqspOt9n255fq7uCyNxCtf0H/QmixcO5zuiecKTJ3HQk8EGPB unRmNVM+bEFHt6BoKHxnkKeoU7Etnpubat9VOidw3dLcm2+nPy7+2Cr+fSr0huD9IC4zh+ 8Otv988TZ1oHvi2a69DyX5RNZMMV2/uuj2Lf0QofQOj5pJKVcTjQOkAZvEIcREllQs2jcf P12Ld2nSBgsjL9MKh+b3ogWx23jDl8wStPXMiAee30DgS5qWmgh+dzU9u8vmjA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668615728; 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=pnYsucPfrpcazGqKeRJP+E7nPSCgbYv1OZ+fSFJF3FE=; b=rPN9XGHVg2e7lvGMMTXZazg1MjVG50yjAsBuQPQhCpeWSPiuq/4enuNAqKmPa7UzDRTB0I 9YoMKvyB5Px6vWCQ== To: Petr Mladek <pmladek@suse.com> Cc: Sergey Senozhatsky <senozhatsky@chromium.org>, Steven Rostedt <rostedt@goodmis.org>, Thomas Gleixner <tglx@linutronix.de>, linux-kernel@vger.kernel.org, Ard Biesheuvel <ardb@kernel.org>, linux-efi@vger.kernel.org Subject: [PATCH printk v5 24/40] efi: earlycon: use console_is_registered() Date: Wed, 16 Nov 2022 17:27:36 +0106 Message-Id: <20221116162152.193147-25-john.ogness@linutronix.de> In-Reply-To: <20221116162152.193147-1-john.ogness@linutronix.de> References: <20221116162152.193147-1-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749670642745195501?= X-GMAIL-MSGID: =?utf-8?q?1749670642745195501?= |
Series |
reduce console_lock scope
|
|
Commit Message
John Ogness
Nov. 16, 2022, 4:21 p.m. UTC
The CON_ENABLED status of a console is a runtime setting that does not involve the console driver. Drivers must not assume that if the console is disabled then proper hardware management is not needed. For the EFI earlycon case, it is about remapping/unmapping memory for the framebuffer. Use console_is_registered() instead of checking CON_ENABLED. Signed-off-by: John Ogness <john.ogness@linutronix.de> Reviewed-by: Petr Mladek <pmladek@suse.com> --- drivers/firmware/efi/earlycon.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/firmware/efi/earlycon.c b/drivers/firmware/efi/earlycon.c index a52236e11e5f..4d6c5327471a 100644 --- a/drivers/firmware/efi/earlycon.c +++ b/drivers/firmware/efi/earlycon.c @@ -29,8 +29,8 @@ static void *efi_fb; */ static int __init efi_earlycon_remap_fb(void) { - /* bail if there is no bootconsole or it has been disabled already */ - if (!earlycon_console || !(earlycon_console->flags & CON_ENABLED)) + /* bail if there is no bootconsole or it was unregistered already */ + if (!earlycon_console || !console_is_registered(earlycon_console)) return 0; efi_fb = memremap(fb_base, screen_info.lfb_size, @@ -42,8 +42,8 @@ early_initcall(efi_earlycon_remap_fb); static int __init efi_earlycon_unmap_fb(void) { - /* unmap the bootconsole fb unless keep_bootcon has left it enabled */ - if (efi_fb && !(earlycon_console->flags & CON_ENABLED)) + /* unmap the bootconsole fb unless keep_bootcon left it registered */ + if (efi_fb && !console_is_registered(earlycon_console)) memunmap(efi_fb); return 0; }