From patchwork Wed Dec 21 20:27:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Ogness X-Patchwork-Id: 35506 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3728060wrn; Wed, 21 Dec 2022 12:28:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXvuLlflBtuCvSn65Ru9LolrX3DbN/TlOkPk7cxxxNm4UOUK0BEAW+j741oinn2hGK/Y3rC2 X-Received: by 2002:a17:906:fb9a:b0:7c0:996b:be7f with SMTP id lr26-20020a170906fb9a00b007c0996bbe7fmr2687571ejb.29.1671654516204; Wed, 21 Dec 2022 12:28:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671654516; cv=none; d=google.com; s=arc-20160816; b=mXBkiz+VsXu0M8fuz6rAhTC0ESa70i148UpD1a+WdNI1ebMiRPFto1/S09YkMDDo2z /D7uAfl3G9o2D62UIDeBOF/vayUr8t1Ai0Dnik6lOb7NMwzwl5P8HFeR74civuVm5VR2 yPJHbpLo8cF+JvmcrlqMHuAoHeKI/b0DdfiQoci1SpkTI88FP7Vv2kUyLsdKsXAI0I0j hmIe7JXWDIMajAJFEmzoLRCG+w13ye0+BWrXH2VZdxXgnnh9h1wMDR3Z2KcCbsDH6XnD cFpBxw6eJIuYYCF9ZF9Dd5wvt6EfFAJg3DiMC2hsePE9IrH3t7nIbN00Rx1n+76GmbVS Xqtg== 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=XbYaurIRdFG+/mjMZ4Nnsd0tE8OMeEIDH+uE2KSAjBQ=; b=jsKJzT9uZam/h0QsO9kmL5yhlAPoevB8JCLQsAjJj2TagbrIiZbD+6HBb0RDSs/dit 6Jggam97WpCDD6u29EIthPzluheBgn0FiMHxmMHgbDLtf+zWvR8bqd/6Q/iesr9jS8ey 37qj3NZOojIZnxzGdfYWGXVOI6ukdMadNTV+WVVghOd7ZDYkTSuHcToyekKCbyqgmQWU QpNU0dc8KdXEc2zhTxGQ2Is4D5gczSDDYgFlduQscrsmwz2Wg+kxt91EKO/m3V4aju1b Zi8XHkzuh5agfjwGSc7t4fXvj+bBOl7KVL2rNb8wdhk544UKhife40nUwbV04QAaBX9V uNYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=cjIIarYa; 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 gn31-20020a1709070d1f00b0081feab6d351si7638091ejc.414.2022.12.21.12.28.12; Wed, 21 Dec 2022 12:28:36 -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=cjIIarYa; 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 S234848AbiLUU1s (ORCPT + 99 others); Wed, 21 Dec 2022 15:27:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230072AbiLUU1q (ORCPT ); Wed, 21 Dec 2022 15:27:46 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F4CC24F36 for ; Wed, 21 Dec 2022 12:27:44 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1671654456; 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=XbYaurIRdFG+/mjMZ4Nnsd0tE8OMeEIDH+uE2KSAjBQ=; b=cjIIarYaLNRrJ9U6jobnezJxa8LsxtUTGv6H0nvK2Zz0/oHmaL8DvY5jYMkW1hVz46Jc5B /2mAJmx1gQ1DEodvRzA6axnnYuC32/AGBMNqD6jpkiZJCRoamdPHNPLMdHtOVF5IGwijyt fFpJpcqFaAOV9E9M7TcjNnz379PenGUuoZ7XgkP6I2TQ8JebtZ5KUs/0slDpyzqNSEeC4j dRjv7B1RtcXNexb8vRb10shvgjiV35UM8J5cYdl9vA9pz4byitYhAfOl4nQE+qeUApvVUA 2GWsUFskZdGaf1CBhiNwpVSktrzg0cFhKmJrLQ0EpIJDU5WIeIq9KilCpQhqgQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1671654456; 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=XbYaurIRdFG+/mjMZ4Nnsd0tE8OMeEIDH+uE2KSAjBQ=; b=4TSiJ9Ap4RH/5TawmXK3mWI9q7LE9Be2M5rpkMiSed9fNwA00b+9qnT1Api1blU23G4aN1 OlO3YyYtzDFwMLCw== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: [PATCH printk v3 2/6] console: Use BIT() macros for @flags values Date: Wed, 21 Dec 2022 21:33:00 +0106 Message-Id: <20221221202704.857925-3-john.ogness@linutronix.de> In-Reply-To: <20221221202704.857925-1-john.ogness@linutronix.de> References: <20221221202704.857925-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?1752856805882721613?= X-GMAIL-MSGID: =?utf-8?q?1752856805882721613?= From: Thomas Gleixner Rather than manually calculating powers of 2, use the BIT() macros. Also take this opportunatity to cleanup and restructure the value comments into proper kerneldoc comments. Signed-off-by: Thomas Gleixner Signed-off-by: John Ogness Reviewed-by: Petr Mladek --- include/linux/console.h | 46 ++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/include/linux/console.h b/include/linux/console.h index 9cea254b34b8..ed804dd7c2e8 100644 --- a/include/linux/console.h +++ b/include/linux/console.h @@ -15,6 +15,7 @@ #define _LINUX_CONSOLE_H_ 1 #include +#include #include #include @@ -125,18 +126,43 @@ static inline int con_debug_leave(void) /* * The interface for a console, or any other device that wants to capture * console messages (printer driver?) - * - * If a console driver is marked CON_BOOT then it will be auto-unregistered - * when the first real console is registered. This is for early-printk drivers. */ -#define CON_PRINTBUFFER (1) -#define CON_CONSDEV (2) /* Preferred console, /dev/console */ -#define CON_ENABLED (4) -#define CON_BOOT (8) -#define CON_ANYTIME (16) /* Safe to call when cpu is offline */ -#define CON_BRL (32) /* Used for a braille device */ -#define CON_EXTENDED (64) /* Use the extended output format a la /dev/kmsg */ +/** + * cons_flags - General console flags + * @CON_PRINTBUFFER: Used by newly registered consoles to avoid duplicate + * output of messages that were already shown by boot + * consoles or read by userspace via syslog() syscall. + * @CON_CONSDEV: Indicates that the console driver is backing + * /dev/console. + * @CON_ENABLED: Indicates if a console is allowed to print records. If + * false, the console also will not advance to later + * records. + * @CON_BOOT: Marks the console driver as early console driver which + * is used during boot before the real driver becomes + * available. It will be automatically unregistered + * when the real console driver is registered unless + * "keep_bootcon" parameter is used. + * @CON_ANYTIME: A misnomed historical flag which tells the core code + * that the legacy @console::write callback can be invoked + * on a CPU which is marked OFFLINE. That is misleading as + * it suggests that there is no contextual limit for + * invoking the callback. The original motivation was + * readiness of the per-CPU areas. + * @CON_BRL: Indicates a braille device which is exempt from + * receiving the printk spam for obvious reasons. + * @CON_EXTENDED: The console supports the extended output format of + * /dev/kmesg which requires a larger output buffer. + */ +enum cons_flags { + CON_PRINTBUFFER = BIT(0), + CON_CONSDEV = BIT(1), + CON_ENABLED = BIT(2), + CON_BOOT = BIT(3), + CON_ANYTIME = BIT(4), + CON_BRL = BIT(5), + CON_EXTENDED = BIT(6), +}; struct console { char name[16];