From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 642B3C433E9 for ; Wed, 3 Feb 2021 15:24:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 207B064F8C for ; Wed, 3 Feb 2021 15:24:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234078AbhBCPY2 (ORCPT ); Wed, 3 Feb 2021 10:24:28 -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