Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp567357rdf; Tue, 21 Nov 2023 09:54:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IFSav40DZtIaSCja3DhWZgUWRLOLVJMzv70bKB3kr/ZWP2PeHkOGPN8rGUgfn4Um9aY2g58 X-Received: by 2002:a17:90b:408e:b0:281:2634:f81e with SMTP id jb14-20020a17090b408e00b002812634f81emr9731055pjb.37.1700589270699; Tue, 21 Nov 2023 09:54:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700589270; cv=none; d=google.com; s=arc-20160816; b=zErS2/jJhjiGmquYSbInFF1FnnmbF5mBwxDvlx4h7w+qCBxcRfEl1eL8ccXnXcjMOg +6ReLGS4rJhJCO6t6s0XUebPHy77cdEiPQhoTLcEcbKlcuuIf8oVLiEi2AmQyEO9Dmbk GM1FkEXeVNnDlcmal3ktlrIP3e7HN4GRcMLmQV6wmo96F5lJKDtCmARo6+bkf3Sh7uD2 LCbWWMixMcMwrcZJOTsgLiDBeIx9CDh6b2EI4H/x4/jBhXiidogjVPYBi3Cfru8HrkOW kcmZp51Tq5u9hVIshoXOaiDvxaGYLAOgjMLvL/QEHRUl2zRV47VC1gyWPzR79Jz6mq2V PeKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=uhayZdXPkfgm164T66/Y4ph9T0D8lDl1WwK6RSjJng0=; fh=z7dP0sUsXLtnomzA6+FUC3zkdfBao0VqwDEfI89QmpM=; b=OvQqdOYj0fX1K0m/bsJt1IhG28Lf2E42jil7pmBHaFtQvtLiyOm0ey6JC3pph/AdnT dzGdIppQjtNaW42HabcM7gUV2Jbg8sRU3tSnKQBa/9nIDuoCPJOT1sPO1j1JiD1OEVCC G6fDIi4LHJJBy8tMBWG6k9BhzpMwLWeNpSHwOBH7KiEeIkDpokGZQL1e57OS9FyjbShW HA5Y12v7Hm0jNh7lQHHogMPkRV8vaM5U2rkTfixWs4XIN44cO0ZIvQF28XOdba46qAQM N254GJ6cIKej2+B2VtPQBkj3chF0auTDgUMAQWrStunU4/kTFLM7OrWHAxGnd1py+BVU d48A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="NN+/OPC7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id om17-20020a17090b3a9100b0027d032092d7si13716702pjb.184.2023.11.21.09.54.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 09:54:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="NN+/OPC7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 354C08030BB3; Tue, 21 Nov 2023 09:53:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233937AbjKURx1 (ORCPT + 99 others); Tue, 21 Nov 2023 12:53:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231338AbjKURx0 (ORCPT ); Tue, 21 Nov 2023 12:53:26 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA53418E; Tue, 21 Nov 2023 09:53:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700589202; x=1732125202; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=wbvLSSVCATMX1TnkhVx4rea6C+nVCD+ipXsQ0+QGSkU=; b=NN+/OPC7wBIFzVoxQcgyhjMomsTjnOzR112V6lw2bvqytupC0W7DLe9y rZg5IgIzgCVhkXQN1hftvhUxnlr9XLSEiKjbe+ib9IZj5aoaQ56klRvKs DVr1FEAQAZuwoqo3lnS5rwDwW0ATwyGaXeRIOxLMio6K1AI/wg4574yol G2BzoRY9Pi8HS680b35hoFWGGpmZRwRftfQd8lrrqnktsZo/L2f3gyEeY AX1nAtZnBURnzzhXRPxCZFDlN+Qw25GClm/NWbzyxSAfZZujq2U6dqNX7 QGB0vTlo6CxQzxnYzcuyKkkE8+63jWadW+FlUHqYv/52nOGarfO9UXiK9 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10901"; a="395816145" X-IronPort-AV: E=Sophos;i="6.04,216,1695711600"; d="scan'208";a="395816145" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2023 09:53:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10901"; a="743124922" X-IronPort-AV: E=Sophos;i="6.04,216,1695711600"; d="scan'208";a="743124922" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga006.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2023 09:53:18 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1r5Uvz-0000000FsgA-03lj; Tue, 21 Nov 2023 19:53:15 +0200 Date: Tue, 21 Nov 2023 19:53:14 +0200 From: Andy Shevchenko To: Tony Lindgren Cc: Greg Kroah-Hartman , Jiri Slaby , Petr Mladek , Steven Rostedt , John Ogness , Sergey Senozhatsky , "David S . Miller" , Dhruva Gole , Ilpo =?iso-8859-1?Q?J=E4rvinen?= , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: Re: [PATCH v3 1/3] printk: Save console options for add_preferred_console_match() Message-ID: References: <20231121113203.61341-1-tony@atomide.com> <20231121113203.61341-2-tony@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231121113203.61341-2-tony@atomide.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 21 Nov 2023 09:53:33 -0800 (PST) On Tue, Nov 21, 2023 at 01:31:55PM +0200, Tony Lindgren wrote: > Driver subsystems may need to translate the preferred console name to the > character device name used. We already do some of this in console_setup() > with a few hardcoded names, but that does not scale well. > > The console options are parsed early in console_setup(), and the consoles > are added with __add_preferred_console(). At this point we don't know much > about the character device names and device drivers getting probed. > > To allow drivers subsystems to set up a preferred console, let's save the > kernel command line console options. To add a preferred console, let's add > a new function add_preferred_console_match(). > > This allows the serial core layer to support console=DEVNAME:0.0 style > hardware based addressing in addition to the current console=ttyS0 style > naming. And we can start moving console_setup() character device parsing > to the driver subsystem specific code. > > We use a separate array from the console_cmdline array as the character > device name and index may be unknown at the console_setup() time. And we do > not want to call __add_preferred_console() until the character device name > and index are known. > > Adding the console name in addition to the character device name, and a > flag for an added console, could be added to the struct console_cmdline. > And the console_cmdline array handling modified accordingly. But that > complicates things compared saving the console options, and then adding > the consoles when the subsystems handling the consoles are ready. ... > +#include > +#include I think instead of kernel.h you may want to see these: linux/init.h linux/string.h asm/errno.h > +#include "console_cmdline.h" ... > +/** > + * console_opt_save - Saves kernel command line console option for driver use > + * @str: Kernel command line console name and option > + * > + * Saves a kernel command line console option for driver subsystems to use for > + * adding a preferred console during init. Called from console_setup() only. scripts/kernel-doc -v -none -Wall ... most likely will complain (no Return section). > + */ > +int __init console_opt_save(char *str) str is not const? Hmm... -- With Best Regards, Andy Shevchenko