Re: [merged mm-nonmm-stable] checkpatch-add-warning-for-pr_-and-dev_-macros-without-a-trailing-newline.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2025-03-17 at 20:50 +0100, Miguel Ojeda wrote:
> On Mon, Mar 17, 2025 at 6:52 AM Joe Perches <joe@xxxxxxxxxxx> wrote:
> > 
> > Not sure it's a 'real' need/issue as any new KERN_<LEVEL> that's
> > not KERN_CONT will already add a new line.
> 
> But it is still intended that one uses an explicit newline, no?

That's my preference, yes.

> I am
> not sure I follow your other comment, so I may be missing something
> though.

My understanding is that
	printk(KERN_INFO "foo");	// or pr_info("foo");
//with some long time before
	printk(KERN_INFO "bar");	// or pr_info("bar");

will defer emitting "foo" and will append a newline to "foo"
when emitted only after the printk for "bar" is performed.

So it's generally useful to always use a newline for
complete messages as those are never deferred until
another printk is done.

> Regarding complexity, agreed, it is fairly involved -- I think the
> continuation case could be ignored, since it is rare and it is just a
> warning anyway.

My belief as well.

There are a number of macros and functions that are printk equivalents
that append newlines automatically and as well some pr_fmt uses
that include newlines too so it's almost impossible to get checkpatch
to work correctly anyway.

Things like:

fs/bcachefs/bcachefs.h:#define pr_fmt(fmt) "bcachefs: %s() " fmt "\n", __func__





[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux