Message ID | 20221107141638.3790965-26-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 l7csp2079565wru; Mon, 7 Nov 2022 06:22:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf7+XkjWaZhRwxUIatCoo5wj724EP8mrG6DWnAwwr8ppW2lixSXi9wYo6wmjgg+hBmOVw08Q X-Received: by 2002:a17:907:6e14:b0:7ad:b45c:7e0d with SMTP id sd20-20020a1709076e1400b007adb45c7e0dmr1711980ejc.413.1667830951858; Mon, 07 Nov 2022 06:22:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667830951; cv=none; d=google.com; s=arc-20160816; b=j8rksGShnoGDixOTYw3t9QgZquKTlkY2lSO2NPMiPL3AsXTDD3sQvEJ7QdmpPk5Cqw dsrE21L9lPtg7M/nWiz5S5yll6A5Iy4Htx8dVyDRXQAFt1QL6Z9LnFyYa4lYm6ssfntV Sdrqdb6MTq26W7AItF8if0Hv5fkJiXJpELpVgU5fdG0eLjm43ZdRtzO5jkjiSZPRsU5v OamshgGP/OiN4sTkDqzNsOJJ+mq3Fty0atEhuyVcHTRoyuUIVsNCjDGaF2s9xH3429As YNwBWpci6NyE3cdZi2/jOdrtvtkGLEhzU8J4ZTisQd11R9haxAMGtldABZCPg9fys/nO /48A== 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=LyZS5uMfYU/cffNHBb1twOFg15bMKL8z2VkdH4RqLnI=; b=qMOKg9gZqf7XyC6evVJrtfUntQF+/+cgJk8hc76GJTytx8GpFuUXl9ogxiOwQRYIGU UmfiotMS6y/9xHeHGBJbQ9CZPPSkUYOFsSfcXhmgDvQyJpbZ7jbzwIDiHsb58n4upC/u tCNIAowl9cVofKqW210c5DcdmuxWXdNq1J09Pbg3VrjJ3Py0IeoI95AxoFFK5x/kdYkT 0Qp/yL12pYSwzX7lhugOx/lp0BY5TR0Iyv+3/Vl+lIVsxwRhKp3N28qr4xQUPft4CfAt DkuK5bmAHhjRoNTyZvK7DInss4nlJ8s0UvE08PbtC+6vyHmqAnAqa8v2PTZlFNV4igqN 9BQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=GnMxuG19; 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 e6-20020a17090658c600b007ae4c686a4esi11435077ejs.159.2022.11.07.06.22.06; Mon, 07 Nov 2022 06:22:31 -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=GnMxuG19; 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 S232222AbiKGOSp (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Mon, 7 Nov 2022 09:18:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232208AbiKGOQx (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 7 Nov 2022 09:16:53 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE9541D0DC; Mon, 7 Nov 2022 06:16:52 -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=1667830611; 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=LyZS5uMfYU/cffNHBb1twOFg15bMKL8z2VkdH4RqLnI=; b=GnMxuG19cPyqFuF8fXFkyp6BckB8w0fTGzzoUGJW8OTZHW07pe6cy3yQ25K6+xuc6WJkZa B0OrWffeC4/SJIQIT9xZt/HoXDv4h4MxdvAwssBmQqJM24HIhAIsPhBzkzGE9zvU33IcQT D2P3bTLx/IkzIFXS4KfIrlsBroeIvcJKo2YMSTI23KfFDdpTkFxT1gU7vbNMUyG3iHI6+h uN7ALdebM9zPKMj3un1XnXnedrgbRFVNUxpMdtNWUryG53Q34bInxDwv86YnyZ6srrhERh /7nrPnXmTf9zKKAlkUi4DAVF7yXXGyC6fbqRe/BupROVIvSHYPn7TPVztHThzA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1667830611; 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=LyZS5uMfYU/cffNHBb1twOFg15bMKL8z2VkdH4RqLnI=; b=BXFh3bD41IX3Cmqunb4gjOg4lZQztyE321oMZc+jZMFZefEKXR4aE/imyimsbONLhG0A9F H3tEdsW+XTu/0VCA== 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 v3 25/40] efi: earlycon: use console_is_registered() Date: Mon, 7 Nov 2022 15:22:23 +0106 Message-Id: <20221107141638.3790965-26-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 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?1748847507746407267?= X-GMAIL-MSGID: =?utf-8?q?1748847507746407267?= |
Series |
reduce console_lock scope
|
|
Commit Message
John Ogness
Nov. 7, 2022, 2:16 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>
---
drivers/firmware/efi/earlycon.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Comments
On Mon 2022-11-07 15:22:23, John Ogness wrote: > 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> Best Regards, Petr
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; }