Re: [PATCH V7 2/9] usb: make usb port a real device

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

 



Sarah Sharp <sarah.a.sharp@xxxxxxxxxxxxxxx> writes:
> On Sun, Jul 08, 2012 at 09:28:35AM -0700, Greg KH wrote:
>> On Sat, Jul 07, 2012 at 08:05:47PM -0400, Sarah Sharp wrote:
>> > On Fri, Jul 06, 2012 at 11:12:32AM -0700, Greg KH wrote:
>> > > On Fri, Jul 06, 2012 at 02:13:53PM +0800, Lan Tianyu wrote:
>> > > Don't split strings across a line, it makes it impossible to search
>> > > for.
>> > 
>> > Do you prefer 80 char lines or split strings?  checkpatch.pl throws an
>> > error either way, so pick your poison.
>> 
>> checkpatch should not throw an error if you have a string which forces
>> the line to be longer than 80 characters.  If it does, it is wrong and
>> should be fixed.
>
> It does. 

Well, that depends...  There's a strange exception for _some_ functions
and macros.  This code (which of course is pointless and wrong in many ways):

    #define mydbg pr_info
    #define my_dbg pr_info
    pr_info("testing a very long text string for checkpatch.  Will this cause any warnings?\n");
    mydbg("testing a very long text string for checkpatch.  Will this cause any warnings?\n");
    my_dbg("testing a very long text string for checkpatch.  Will this cause any warnings?\n");

produce this unexpected(?) checkpatch result:

   bjorn@nemi:/usr/local/src/git/linux$ scripts/checkpatch.pl -f /tmp/tmp.c 
   WARNING: line over 80 characters
   #4: FILE: tmp/tmp.c:4:
   +mydbg("testing a very long text string for checkpatch.  Will this cause any warnings?\n");

   total: 0 errors, 1 warnings, 5 lines checked

   /tmp/tmp.c has style problems, please review.

   If any of these errors are false positives, please report
   them to the maintainer, see CHECKPATCH in MAINTAINERS.


You have to stare at this regex for a while to understand why:

our $logFunctions = qr{(?x:
        printk(?:_ratelimited|_once|)|
        [a-z0-9]+_(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)|
        WARN(?:_RATELIMIT|_ONCE|)|
        panic|
        MODULE_[A-Z_]+
)};



So just choose your debugging function and macro names carefully, and
you'll avoid that warning :-) 

Note that the dev_err discussed here does match the exception, so
checkpatch should dtrt there.

> I've tried to send checkpatch fixes in the past (including
> making any warning not make the script return an error so you can have
> it in your pre-commit hook) and gotten no response.  At this point I'm
> not really sure who to send patches to.

No suggestions there.


Bjørn
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux