Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp369153pxb; Wed, 3 Feb 2021 07:26:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJwGjEsydoLRyYcOte8kLwEkCPVPNPeFTThWg5KGLQnLpWJccKZNTnI8WfrjLM+vdYPzV0iG X-Received: by 2002:a05:6402:13c8:: with SMTP id a8mr3414548edx.191.1612365963539; Wed, 03 Feb 2021 07:26:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612365963; cv=none; d=google.com; s=arc-20160816; b=uAjJsUwsHATFuPEb8ljiXK3Dkdfu87I1o0kBB9W6dgu5Qvavg3YrAhZJB4rDZytgY7 8uzRMczuC5l3RohzauVzrdE1IWjplQLblVv3LaCOk+RTjb58r01IcBnwwTxcw9CPWoad nxEDAf++LgGDvu5Flzdm1cDpt1667ov0EFJAe0t3x28CHGTz5swSp+ME53JtJk8WVg8q 7xEyPxgwj3oJ/1eh3q+g71Jtprux9tninwdRyOtNFbEaXCR+0gu4FuGXpZrihrfXjxUL /XQ37bX5YdsldbhTZ+6po2Ph1yTd80qJUdV3OAyo/zqxnonOtgjUKSwWdUXhh8mGg68i NM2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=v5tD1P3GbXfYcO2FuGCpuZb4rnW2teCslHj/hQe3lGs=; b=eSqTdxwuiN0fxUGfpzlwQltVXmZVcphRsKC0VU/4WFc9aGghN22nkDftfF7AECaJmp bW7VGcFFQxxl9DjC7amTZPXXZbiFLj258/i8mlFA84V+wnQpybL5qnzpZhlGgn/hUCi1 LpTyQndilnxaLsSxo677wkZjupxs4/SAZx30HlgUYl/DT8OIk+Rn1W1CjW8hWYbOsvP2 uzIRJi7TFwcyFSlzwH+PgkuOhtFMD6dNnU/7CngGIWKYK1BZOwuzilf3lYAYoB+td/mB SghrNGSQ7D5uvJgU4s0lSFR6PLADZ1tg2JTkhwAkGrF8tdBHZWOP4MrPmGaDjTxZ6BNN eGcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=rdZk0jcd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l3si1477703ejr.748.2021.02.03.07.25.37; Wed, 03 Feb 2021 07:26:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=rdZk0jcd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233265AbhBCPYS (ORCPT + 99 others); Wed, 3 Feb 2021 10:24:18 -0500 Received: from mx2.suse.de ([195.135.220.15]:45120 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234095AbhBCPXy (ORCPT ); Wed, 3 Feb 2021 10:23:54 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1612365787; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=v5tD1P3GbXfYcO2FuGCpuZb4rnW2teCslHj/hQe3lGs=; b=rdZk0jcdjjKRvFrQGiajPlzLmPJM6hW7+HYHGXxd21KVeaifUuqZKh5B8+YDOd5rG/VHNx K6UStUoIZI943Dj37YcjQ7hvx/HTjszR6fq+v4bPw/0EHsi1X24UEdACN4/U1LExMJFYc5 +dnswT0SuF/EyPD8eQRsmYS3+D5QUEI= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3DFA8AC55; Wed, 3 Feb 2021 15:23:07 +0000 (UTC) Date: Wed, 3 Feb 2021 16:23:06 +0100 From: Petr Mladek To: John Ogness Cc: Masahiro Yamada , linux-kernel@vger.kernel.org, Sergey Senozhatsky , Steven Rostedt , Andy Shevchenko , Ard Biesheuvel , Borislav Petkov , Darren Hart , Dimitri Sivanich , Greg Kroah-Hartman , "H. Peter Anvin" , Ingo Molnar , Jiri Slaby , Mike Travis , Peter Jones , Russ Anderson , Steve Wahl , Thomas Gleixner , dri-devel@lists.freedesktop.org, linux-efi@vger.kernel.org, linux-fbdev@vger.kernel.org, platform-driver-x86@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH 1/3] printk: use CONFIG_CONSOLE_LOGLEVEL_* directly Message-ID: References: <20210202070218.856847-1-masahiroy@kernel.org> <87eehy27b5.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87eehy27b5.fsf@jogness.linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 2021-02-02 09:44:22, John Ogness wrote: > On 2021-02-02, Masahiro Yamada wrote: > > CONSOLE_LOGLEVEL_DEFAULT is nothing more than a shorthand of > > CONFIG_CONSOLE_LOGLEVEL_DEFAULT. > > > > When you change CONFIG_CONSOLE_LOGLEVEL_DEFAULT from Kconfig, almost > > all objects are rebuilt because CONFIG_CONSOLE_LOGLEVEL_DEFAULT is > > used in , which is included from most of source files. > > > > In fact, there are only 4 users of CONSOLE_LOGLEVEL_DEFAULT: > > > > arch/x86/platform/uv/uv_nmi.c > > drivers/firmware/efi/libstub/efi-stub-helper.c > > drivers/tty/sysrq.c > > kernel/printk/printk.c > > > > So, when you change CONFIG_CONSOLE_LOGLEVEL_DEFAULT and rebuild the > > kernel, it is enough to recompile those 4 files. > > > > Remove the CONSOLE_LOGLEVEL_DEFAULT definition from , > > and use CONFIG_CONSOLE_LOGLEVEL_DEFAULT directly. > > With commit a8fe19ebfbfd ("kernel/printk: use symbolic defines for > console loglevels") it can be seen that various drivers used to > hard-code their own values. The introduction of the macros in an > intuitive location (include/linux/printk.h) made it easier for authors > to find/use the various available printk settings and thresholds. > > Technically there is no problem using Kconfig macros directly. But will > authors bother to hunt down available Kconfig settings? Or will they > only look in printk.h to see what is available? > > IMHO if code wants to use settings from a foreign subsystem, it should > be taking those from headers of that subsystem, rather than using some > Kconfig settings from that subsystem. Headers exist to make information > available to external code. Kconfig (particularly for a subsystem) exist > to configure that subsystem. I agree with this this view. What about using default_console_loglevel() in the external code? It reads the value from an array. This value is initialized to CONSOLE_LOGLEVEL_DEFAULT and never modified later. Best Regards, Petr