lkml.org 
[lkml]   [2010]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC PATCH -v3 1/2] lmb: seperate region array from lmb_region struct

    * Yinghai Lu <yinghai@kernel.org> wrote:

    > void __init lmb_init(void)
    > {
    > + lmb.memory.region = lmb_memory_region;
    > + lmb.memory.region_array_size = ARRAY_SIZE(lmb_memory_region);
    > + lmb.reserved.region = lmb_reserved_region;
    > + lmb.reserved.region_array_size = ARRAY_SIZE(lmb_reserved_region);
    > +

    That's rather unreadable and has random whitespace noise.

    Should be something like:

    lmb.memory.region = lmb_memory_region;
    lmb.memory.region_array_size = ARRAY_SIZE(lmb_memory_region);
    lmb.reserved.region = lmb_reserved_region;
    lmb.reserved.region_array_size = ARRAY_SIZE(lmb_reserved_region);

    also, i'd suggest to shorten region_array_size to region_size (we know it's an
    array), so it would become:

    lmb.memory.region = lmb_memory_region;
    lmb.memory.region_size = ARRAY_SIZE(lmb_memory_region);

    lmb.reserved.region = lmb_reserved_region;
    lmb.reserved.region_size = ARRAY_SIZE(lmb_reserved_region);

    > - if (rgn->cnt >= MAX_LMB_REGIONS)
    > + if (rgn->cnt >= (rgn->region_array_size - 1))
    > return -1;

    'x >= y-1' is equivalent to 'x > y', so that should be:

    if (rgn->cnt > rgn->region_size)

    Ingo


    \
     
     \ /
      Last update: 2010-03-23 11:45    [W:0.045 / U:58.748 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site