lkml.org 
[lkml]   [2010]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC local_t removal V1 1/4] Add add_local() and add_local_return()
    On Tue, 5 Jan 2010, Mike Frysinger wrote:

    > On Tue, Jan 5, 2010 at 17:04, Christoph Lameter wrote:
    > > --- /dev/null   1970-01-01 00:00:00.000000000 +0000
    > > +++ linux-2.6/include/asm-generic/add-local.h   2010-01-05 15:36:02.000000000 -0600
    > > @@ -0,0 +1,13 @@
    > > +#ifndef __ASM_GENERIC_ADD_LOCAL_H
    > > +#define __ASM_GENERIC_ADD_LOCAL_H
    >
    > needs comment header (blurb/copyright/license)

    A simple small include file? Really?

    > > +#define add_return_local(ptr, v)                                       \
    > > +       ((__typeof__(*(ptr)))__add_return_local_generic((ptr),          \
    > > +                       (unsigned long)(v), sizeof(*(ptr))))
    > > +
    > > +#define add_local(ptr, v) (void)__add_return_local_generic((ptr),      \
    > > +                       (unsigned long)(v), sizeof(*(ptr)))
    >
    > the only difference here is the cast ... perhaps define an
    > _add_local() macro to avoid the duplication

    Right. This is a shortcut to define the add_local() operation without too
    much effort. We should be using add / inc /dec there at some point.

    > > --- /dev/null   1970-01-01 00:00:00.000000000 +0000
    > > +++ linux-2.6/arch/alpha/include/asm/add-local.h        2010-01-05 15:36:02.000000000 -0600
    > > @@ -0,0 +1,2 @@
    > > +#include <asm-generic/add-local.h>
    > > +
    >
    > these arch stubs all have an extra new line

    Thats bad?

    > > +/*
    > > + * Generic version of __add_return_local (disables interrupts). Takes an
    > > + * unsigned long parameter, supporting various types of architectures.
    > > + */
    > > +static inline unsigned long __add_return_local_generic(volatile void *ptr,
    > > +               unsigned long value, int size)
    >
    > size_t for size ?

    No. It can be anything.

    > > +extern unsigned long wrong_size_add_local(volatile void *ptr);
    > > ...
    > > +       /*
    > > +        * Sanity checking, compile-time.
    > > +        */
    > > +       if (size == 8 && sizeof(unsigned long) != 8)
    > > +               wrong_size_add_local(ptr);
    > > ...
    > > +       default:
    > > +               wrong_size_add_local(ptr);
    > > +       }
    >
    > should be BUILD_BUG_ON() ?

    Does not work there.
    \
     
     \ /
      Last update: 2010-01-05 23:33    [W:0.039 / U:29.548 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site