From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Wed, 19 Aug 2020 23:48:48 +0300 From: Mike Rapoport Subject: Re: [PATCH v3 09/17] memblock: make memblock_debug and related functionality private Message-ID: <20200819204848.GX752365@kernel.org> References: <20200818151634.14343-1-rppt@kernel.org> <20200818151634.14343-10-rppt@kernel.org> <20200819122405.88e9719e86ac7c3c44b4db32@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200819122405.88e9719e86ac7c3c44b4db32@linux-foundation.org> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Andrew Morton Cc: Andy Lutomirski , Baoquan He , Benjamin Herrenschmidt , Borislav Petkov , Catalin Marinas , Christoph Hellwig , Daniel Axtens , Dave Hansen , Emil Renner Berthing , Ingo Molnar , Hari Bathini , Marek Szyprowski , Max Filippov , Michael Ellerman , Michal Simek , Mike Rapoport , Palmer Dabbelt , Paul Mackerras , Paul Walmsley , Peter Zijlstra , Russell King , Stafford Horne , Thomas Gleixner , Will Deacon , Yoshinori Sato , clang-built-linux@googlegroups.com, iommu@lists.linux-foundation.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-xtensa@linux-xtensa.org, linuxppc-dev@lists.ozlabs.org, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, uclinux-h8-devel@lists.sourceforge.jp, x86@kernel.org On Wed, Aug 19, 2020 at 12:24:05PM -0700, Andrew Morton wrote: > On Tue, 18 Aug 2020 18:16:26 +0300 Mike Rapoport wrote: > > > From: Mike Rapoport > > > > The only user of memblock_dbg() outside memblock was s390 setup code and it > > is converted to use pr_debug() instead. > > This allows to stop exposing memblock_debug and memblock_dbg() to the rest > > of the kernel. > > > > --- a/mm/memblock.c > > +++ b/mm/memblock.c > > @@ -137,7 +137,10 @@ struct memblock_type physmem = { > > i < memblock_type->cnt; \ > > i++, rgn = &memblock_type->regions[i]) > > > > -int memblock_debug __initdata_memblock; > > +#define memblock_dbg(fmt, ...) \ > > + if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) > > + > > checkpatch doesn't like this much. > > ERROR: Macros starting with if should be enclosed by a do - while loop to avoid possible if/else logic defects > #101: FILE: mm/memblock.c:140: > +#define memblock_dbg(fmt, ...) \ > + if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) > > WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ... > #102: FILE: mm/memblock.c:141: > + if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) > > ERROR: trailing statements should be on next line > #102: FILE: mm/memblock.c:141: > + if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) > > > The first one is significant: > > if (foo) > memblock_dbg(...); > else > save_the_world(); > > could end up inadvertently destroying the planet. Well, it didn't till now ;-) > This? > > --- a/mm/memblock.c~memblock-make-memblock_debug-and-related-functionality-private-fix > +++ a/mm/memblock.c > @@ -137,8 +137,11 @@ struct memblock_type physmem = { > i < memblock_type->cnt; \ > i++, rgn = &memblock_type->regions[i]) > > -#define memblock_dbg(fmt, ...) \ > - if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) > +#define memblock_dbg(fmt, ...) \ > + do { \ > + if (memblock_debug) \ > + pr_info(fmt, ##__VA_ARGS__); \ > + } while (0) Sure, thanks! > static int memblock_debug __initdata_memblock; > static bool system_has_some_mirror __initdata_memblock = false; > _ > -- Sincerely yours, Mike.