Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1681506rwb; Fri, 23 Sep 2022 17:08:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM74xnr5OBeW9dXiPYIr07DygCVuaTgajNB9DLKTe37zaa6qc+e8Kw8TGmy9jgzyxCBTOVAs X-Received: by 2002:a17:907:a04e:b0:770:79f4:f520 with SMTP id gz14-20020a170907a04e00b0077079f4f520mr8945068ejc.730.1663978127186; Fri, 23 Sep 2022 17:08:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663978127; cv=none; d=google.com; s=arc-20160816; b=L0+Y7e9cnIf+NCWbP1uAgcRIy3hPbm2a0k88EPt/9JOkP59PQMdYXHlu0vjCXmeBzI xxWtWZ8xE0ErweCWkkYN692EWVc6ffMTxoVML1qHIqxkEfpjusGY+dAT6BLLA7msxT2R Rqq0IFSZ5DfNR9XcjZUUEkw/4tUDrxqnf9V0PRgeVGFgBApnP02reMoRAEBTOnd01L08 zqCKIkk6OdEY1ZxXR5IFAhOzz9aFjYsKnm8+Pf/gXt0aFonF3zGO8wa2jKZ1nVUmCQLT Wdt7xQFGnqsfDWkfdhEMVS9uNB5YCQmoVQ7rIfzebmJXzOLHkt8OZvcf/TJsK+4amZnn 45Aw== 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=wNgrSZ2OGE1ZcTDR6ScZab8YT3+EG0Nnd7/A9t2uS7k=; b=EqIpA98Nv/88HNx0FybFrl0bPlu3usTxrsaQ2ztTVwiN2TeYHU/R+eDN41+2nKlfQk 6O/xyVNRbIlUqhoLqOU8rNIX5uS2BxsMJAibNLK8V2xXiTza29VpHbtjv5Jha47LCsKx 53KzaCLTTSlW1YPYdmbMJVX7Ny+LF/SmqCoFVfbPoXsNtUOrWniMAF9H+zJEG8NTCrDg SvIcwpuL+Ginmk2cwImfXxG7ZQI+B7iF0px3tC4X5pArFitrAtPWn+iHxrbjknXGva5k 2d0/FptUoBVj/P0+ccEJqMXI01NWifVGyEAxBs0JvzJz7/vtLmWgeQjGiWo0KzWkX0U3 O9kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=XKNIg73w; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=6hiCZndz; 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 hr24-20020a1709073f9800b0073dd6d901dbsi8712006ejc.72.2022.09.23.17.08.20; Fri, 23 Sep 2022 17:08:47 -0700 (PDT) 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=XKNIg73w; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=6hiCZndz; 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 S233133AbiIXAGK (ORCPT + 99 others); Fri, 23 Sep 2022 20:06:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232959AbiIXAFM (ORCPT ); Fri, 23 Sep 2022 20:05:12 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C297D33CA for ; Fri, 23 Sep 2022 17:05:06 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1663977904; 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=wNgrSZ2OGE1ZcTDR6ScZab8YT3+EG0Nnd7/A9t2uS7k=; b=XKNIg73wEnHG16+eSKTWfVTJUDOSUZQD9/ZQ1qxyh5+kmutvwlSuAM+g4UmR/Kh4/h3Lwy gB8N0T+ADUxZfG0r0wgO9T7Banvn+zOL5qTP1uju825a4ZUhEgGizR2t7FEMQDCbtBeB2S pie+UB/SuRjH3o/g7NoOv/LYWjkcMgVOk6q1JFyxfv6KiajRjR5Pwc030CrZQKlMBfKULC Bftp6qKO6KMFMLvtr43s5etqK8aVen8+c7YJBp3TGvSrNxD7gjI0Iad6mLL9jOoC4Uoh3F X41AEll5jRiKyGP8bhhtpgRcQN4tgW0Qatdwn8IcXSJ1FBXGQfqYO4ICEyOmGw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1663977904; 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=wNgrSZ2OGE1ZcTDR6ScZab8YT3+EG0Nnd7/A9t2uS7k=; b=6hiCZndz3RSsX6T+VCzGWe1MeMk4920P8DOw2MA+k5VJgmXxoJJFxzWWqJsOXdcK448BAn YODkZ67swoUsRkAw== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: [PATCH printk 14/18] printk: Document struct console Date: Sat, 24 Sep 2022 02:10:50 +0206 Message-Id: <20220924000454.3319186-15-john.ogness@linutronix.de> In-Reply-To: <20220924000454.3319186-1-john.ogness@linutronix.de> References: <20220924000454.3319186-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 Add docbook comments to struct console. Signed-off-by: Thomas Gleixner Signed-off-by: John Ogness --- include/linux/console.h | 95 +++++++++++++++++++++++++++++------------ 1 file changed, 68 insertions(+), 27 deletions(-) diff --git a/include/linux/console.h b/include/linux/console.h index 3bb5bc62e154..8ec24fe097d3 100644 --- a/include/linux/console.h +++ b/include/linux/console.h @@ -15,6 +15,7 @@ #define _LINUX_CONSOLE_H_ 1 #include +#include #include #include @@ -139,37 +140,77 @@ 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: On register, start from the oldest dmesg record + * @CON_CONSDEV: Questionable historical leftover to denote which console + * driver is the preferred console which is defining what + * backs up /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 unless the early console + * command line parameter for this console has the 'keep' option set. + * @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's misleading as it suggests that there + * is no contextual limit for invoking the callback. + * @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 record 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 - The console descriptor structure + * @name: The name of the console driver + * @write: Write callback to output messages (Optional) + * @read: Read callback for console input (Optional) + * @device: The underlying TTY device driver (Optional) + * @unblank: Callback to unblank the console (Optional) + * @setup: Callback for initializing the console (Optional) + * @exit: Callback for teardown of the console (Optional) + * @match: Callback for matching a console (Optional) + * @flags: Console flags. See enum cons_flags + * @index: Console index, e.g. port number + * @cflag: TTY control mode flags + * @ispeed: TTY input speed + * @ospeed: TTY output speed + * @seq: Sequence number of the next ringbuffer record to print + * @dropped: Number of dropped ringbuffer records + * @data: Driver private data + * @node: hlist node for the console list + */ struct console { - char name[16]; - void (*write)(struct console *, const char *, unsigned); - int (*read)(struct console *, char *, unsigned); - struct tty_driver *(*device)(struct console *, int *); - void (*unblank)(void); - int (*setup)(struct console *, char *); - int (*exit)(struct console *); - int (*match)(struct console *, char *name, int idx, char *options); - short flags; - short index; - int cflag; - uint ispeed; - uint ospeed; - u64 seq; - unsigned long dropped; - void *data; - struct hlist_node node; + char name[16]; + void (*write)(struct console *, const char *, unsigned); + int (*read)(struct console *, char *, unsigned); + struct tty_driver *(*device)(struct console *, int *); + void (*unblank)(void); + int (*setup)(struct console *, char *); + int (*exit)(struct console *); + int (*match)(struct console *, char *name, int idx, char *options); + short flags; + short index; + int cflag; + uint ispeed; + uint ospeed; + u64 seq; + unsigned long dropped; + void *data; + struct hlist_node node; }; #ifdef CONFIG_LOCKDEP -- 2.30.2