lkml.org 
[lkml]   [2009]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] check spinlock_t/rwlock_t argument type on non-SMP builds
    Ingo Molnar wrote:
    > * David Kilroy <kilroyd@googlemail.com> wrote:
    >
    >> When writing code for UP without CONFIG_DEBUG_SPINLOCK it's easy
    >> to get the first argument to the spinlock/rwlock functions wrong.
    >> This is because the parameter is not actually used in this
    >> configuration.
    >>
    >> Typically you will only find out it's wrong
    >> * by rebuilding with CONFIG_SMP or CONFIG_DEBUG_SPINLOCK
    >> * after you've submitted your beautiful patch series.
    >>
    >> The first means a long wait, and the latter is a bit late.
    >>
    >> Add typechecking on the first argument of these macro functions.
    >> Note that since the typecheck now references the variable, the
    >> explicit read is redundant and can be removed.
    >>
    >> This change causes compiler warnings in net/ipv4/route.c, as this
    >> passes NULL as the first argument in the UP configuration. Simply
    >> cast this.
    >
    > Wondering - can the wrappers be moved from CPP land to C land by
    > turning them into inlines? (i havent checked all usages so there
    > might be some surprises, but by and large it ought to be possible.)

    I thought about doing it that way. I decided not to because I suspected
    it would be harder to verify that the behaviour is unchanged.

    Also the _lock_irqsave functions output to the flags parameter (which
    isn't a pointer) so that has to remain a macro.

    If you'd really rather an inline version, I can spend some time looking
    into it.


    Dave.


    \
     
     \ /
      Last update: 2009-07-03 21:05    [W:3.398 / U:0.112 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site