Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp3604659rwn; Sat, 10 Sep 2022 16:01:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR4jUiImO3es9zDesNDYFvscDDO5Fw9aiz9f/PXWGSDl9FRUezXPbnuzXWiMZoFF6CwvBs+I X-Received: by 2002:aa7:c415:0:b0:44d:f432:3e84 with SMTP id j21-20020aa7c415000000b0044df4323e84mr17147991edq.56.1662850880911; Sat, 10 Sep 2022 16:01:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662850880; cv=none; d=google.com; s=arc-20160816; b=mYRhzjzdYy1Nnn8qu5l+Rt29+lSIRjy2WvqhjTMmrbwtbycFtzOG9OsJoq3QLJdOoq F9DkbCIFjfo84hl6qMmBR4tGeomrr5/AE8uFy3oivSE5GqkGCm8j4V8/wyWf7nCLfA/O LV2uM6wVWCR3mCf+DqfZXG3kk566j4oq4J2Jcykin8JpTnpkR4U+t9/0NuF7+YHrTmPJ Q7mkIAsLxuanGQw0NCdx9P0ppzogVOgcklVvNor9kx89ryvS7dhC92Jx7c8Z3a4c02N0 SY97b0vLL5IVyLXcRYV2GgLDvwCl7Fr5UxdO2aQ0ziI6S7ZYtI2g9089E1cVsEnt+58W QfWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=OGECJYeezcNM6bctMFLtG7sTwDOnNte8eZxyEhnl5nM=; b=FTunRe6uX1MMjv/Y65TdR2Q13KjNuoFDuIkpsc0UwUsQqa+q7gVEcKoPFS64C7a1/w J0YsGRkzz+G6ZGDFwez77sswwue8mKrOXxSbvKrBmphFBxVg+NQG6J4WsLXGlFROPaoq pCPHO5GD7KLixQfKTKMCqn77bqRnLQjNFBQz/DN+kQ6vByfuaU/mgqNa7924adQTo5o4 o95k78A9ACs7k1fKvSs7NJT/4FXMp3d0osDcNqHCb/XPKwsRMaxePK7oLiJdNHgpKf26 uOXNnSiYiCz8TPJ1J6esXhRXopMgmB4o3+V30+35aVDekrAf9hTm0TrbNF5VxGY0amns zPcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=IuZNLSLW; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=PKAdd0In; 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 js9-20020a17090797c900b0077cc598a100si170197ejc.2.2022.09.10.16.00.56; Sat, 10 Sep 2022 16:01:20 -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=IuZNLSLW; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=PKAdd0In; 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 S230450AbiIJW25 (ORCPT + 99 others); Sat, 10 Sep 2022 18:28:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230215AbiIJW2E (ORCPT ); Sat, 10 Sep 2022 18:28:04 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F1BA43E43 for ; Sat, 10 Sep 2022 15:27:56 -0700 (PDT) Message-ID: <20220910222301.198303830@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1662848874; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=OGECJYeezcNM6bctMFLtG7sTwDOnNte8eZxyEhnl5nM=; b=IuZNLSLWrfeHviHjBCswWUiLPjJFadWgbgopNg+pFLiSOex8+bMxyrgNnktQ7UJE5v1hcp TOrC3ymS+Q0JSjqxcm0YLsXRNeWd1gAtLs5VYgL9Lfr7Yb7dSsB9wcSLco5Q9Wq7P2FZjg UaHIB2NS3xgrDaC6GKKBOhcOEbUcd1NxStfD+vxTQWxa3G680gY4e6pMjboeFMAhm5fbYf mIZcGZyxrCk2jn82OvS1jgM2Du+GkcOpSSno3SSiIkAmZd+XlgiW3Ih7kgzUGro28FcCyN kRGoImK+ZOP4sD/GVt+WAqlbCIa+Qe/08QXTOd+BVqxGZ5YB/i8kFyX1pe+0Bw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1662848874; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=OGECJYeezcNM6bctMFLtG7sTwDOnNte8eZxyEhnl5nM=; b=PKAdd0InIgltg78+kqH3kBPOYXjLT9jGUBShTCd3FLo95raEjRV00tE5D+dK7A2xBZMql5 Ux091lYUiBpbyuDQ== From: Thomas Gleixner To: LKML Cc: John Ogness , Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Linus Torvalds , Peter Zijlstra , "Paul E. McKenney" , Daniel Vetter , Greg Kroah-Hartman , Helge Deller , Jason Wessel , Daniel Thompson Subject: [patch RFC 14/29] printk: Document struct console References: <20220910221947.171557773@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Sun, 11 Sep 2022 00:27:53 +0200 (CEST) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Add docbook comments to struct console. Signed-off-by: Thomas Gleixner --- include/linux/console.h | 94 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 67 insertions(+), 27 deletions(-) --- 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,76 @@ 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: Print the complete dmesg backlog on register/enable + * @CON_CONSDEV: Questionable historical leftover to denote which console + * driver is the preferred console which is defining what + * backs up /dev/console + * @CON_ENABLED: General enable state subject to note #1 + * @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 last ringbuffer record printed + * @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