Re: [PATCH] usb: make printk messges more searchable

From: Wu Fengguang
Date: Wed Dec 10 2008 - 08:08:56 EST


On Wed, Dec 10, 2008 at 11:59:00AM +0200, Laurent Pinchart wrote:
> On Wednesday 10 December 2008, Oliver Neukum wrote:
> > Am Mittwoch, 10. Dezember 2008 10:42:17 schrieb Laurent Pinchart:
> > > Hi Wu,
> > >
> > > On Wednesday 10 December 2008, Wu Fengguang wrote:
> > > > Make USB printk messages long and straightforward. One of these
> > > > decorated USB error messages cost me some smart efforts to locate.
> > >
> > > That would make the code break the 80 columns limit.
> > >
> > > From "Documentation/CodingStyle":
> > >
> > > "The limit on the length of lines is 80 columns and this is a strongly
> > > preferred limit."
> >
> > Too rigid an application is bad. The kernel must be greppable.
>
> I've also been bitten by split strings when grepping kernel source code. A
> cgrep that would unsplit strings before searching them would be nice :-)

Such printk will sure bite more people. And it's amazing that the CodingStyle
document uses printk as an 80-column example:

80 The limit on the length of lines is 80 columns and this is a strongly
81 preferred limit.
82
83 Statements longer than 80 columns will be broken into sensible chunks.
84 Descendants are always substantially shorter than the parent and are placed
85 substantially to the right. The same applies to function headers with a long
86 argument list. Long strings are as well broken into shorter strings. The
87 only exception to this is where exceeding 80 columns significantly increases
88 readability and does not hide information.
89
90 void fun(int a, int b, int c)
91 {
92 if (condition)
93 printk(KERN_WARNING "Warning this is a long printk with "
94 "3 parameters a: %u b: %u "
95 "c: %u \n", a, b, c);
96 else
97 next_statement;
98 }

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/