Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5995199rwl; Mon, 9 Jan 2023 02:47:55 -0800 (PST) X-Google-Smtp-Source: AMrXdXty2A1453SIjvm7HzF8ZeCn2OlYqfQ4gvliqcY7ixH0u53OWMn8n4Oh4pWk8v0BYlmA6sUs X-Received: by 2002:a05:6a20:46a2:b0:b5:ecd8:415c with SMTP id el34-20020a056a2046a200b000b5ecd8415cmr945064pzb.49.1673261275556; Mon, 09 Jan 2023 02:47:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673261275; cv=none; d=google.com; s=arc-20160816; b=E+S0An94XwOkFyfFstLQyfmw14cjHsIbhUVBIpxmQJbiFCDynxjjgWSnmC0func5z3 r1ih+vRYIoiB+zvUae2DmSz2N+vIoeYMHUkXnl5SzkBZSrXbvvph21akvlC5+COzQHXD 9bt21jAP1HqxfxZdJf0+HaXX1XcO3N7nDnonAxcKs2V3QEzwtakZvMeV71Hc6N3qTJ9K C7PVC73pLqPJa8iBQLHckeXDWYJNmPVG6iPIJ6mLV5vTRQWyd2yiJ7cyo2CdMg5tq/Ba UER9YJN0/y2VlzK/LXWUlRA8kfe2EoiB4Cbh4Mk5u4eFVems8OaXTJdpwBRAq92/+PRR YEfg== 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=KrLQ368VVOykFXWvUfMzdj8pn+rqlT0twxD/XUV4zYZ7Wqo6rEpk3sgEzFgRaW/L8T VP7H0imSSGIGYQ2XgYV6kn5MsgPlZpKYaTl7URGYRfCQJ1WJONFdn/zSW9rAvEJZJr8q OsNUgRGwmyBDwRdruouaHi9bUGmDQjcyPfV60ihRwJ/CYSXjSxYmfhEK97id5NveHoYH LVD1CXmJmhQXKPjGIiVsC2Q0AmlRGwurpcedgSz0P9TjS8mNLI18lWknjHRJV06csOmT P5DrIH0PwT/CqjRW4YOGN/RC+gsy7DdJ11bMYGscFoAOgRO20f7jDBy8mLosIeNQMSfP skAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=nk9xoyaK; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q11-20020a65494b000000b004705b0ca9f1si9051096pgs.545.2023.01.09.02.47.48; Mon, 09 Jan 2023 02:47:55 -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=nk9xoyaK; 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 S234182AbjAIKJR (ORCPT + 54 others); Mon, 9 Jan 2023 05:09:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236851AbjAIKIr (ORCPT ); Mon, 9 Jan 2023 05:08:47 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65A38EE29 for ; Mon, 9 Jan 2023 02:08:46 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1673258925; 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=nk9xoyaKfHsP6LTQQVu+XG/CdducdR0r431heSBnhyIjJ9fMkZy9Qu8hytCRS5+JkkAwwm 1/pgMyVjDASfi1Ffscempghhi0+4iIlt942q2Ciaxu55L7LfBY7VUgwgnyeXP/8BzAK9LG wjaEV6zuiCuIwD71wAd1KBSNcrgVP40vXRCjksZ3cKAYVKjwNtVZrNXylP8l9qtetjEe14 ljkZ4gHS3f3n/2rA5Zq4QrNr3HYHE7oINFg5DlnvAgZEFVGA5Kj15wyz+e95bqS8OoW0Cv IKDAP5RfLDX0UpuEagGIVL9DZhbqoF3AXxieMVPAkieU26GIgFBu95UyKt+/lg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1673258925; 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=uVEKsQaLbANPNkuvRmKPiltiGgodI/HUGUzLg17l8c1kxkoNEhqWHr6m3N1eKsTqL9vJDb 7KMyftFzRJpgNoCQ== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: [PATCH printk v5 2/8] console: Use BIT() macros for @flags values Date: Mon, 9 Jan 2023 11:13:54 +0106 Message-Id: <20230109100800.1085541-3-john.ogness@linutronix.de> In-Reply-To: <20230109100800.1085541-1-john.ogness@linutronix.de> References: <20230109100800.1085541-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: X-Mailing-List: linux-kernel@vger.kernel.org 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]; -- 2.30.2