lkml.org 
[lkml]   [2016]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RESEND PATCH v2 06/16] clk: move core->parents allocation to clk_register()
    On 12/28, Masahiro Yamada wrote:
    > @@ -2343,26 +2331,15 @@ static int __clk_core_init(struct clk_core *core)
    > __func__, core->name);
    >
    > /*
    > - * Allocate an array of struct clk *'s to avoid unnecessary string
    > - * look-ups of clk's possible parents. This can fail for clocks passed
    > - * in to clk_init during early boot; thus any access to core->parents[]
    > - * must always check for a NULL pointer and try to populate it if
    > - * necessary.
    > + * clk_core_lookup returns NULL for parents that have not been
    > + * clk_init'd; thus any access to clk->parents[] must check
    > + * for a NULL pointer. We can always perform lazy lookups for
    > + * missing parents later on.
    > */
    > - if (core->num_parents > 1) {
    > - core->parents = kcalloc(core->num_parents,
    > - sizeof(*core->parents), GFP_KERNEL);
    > - /*
    > - * clk_core_lookup returns NULL for parents that have not been
    > - * clk_init'd; thus any access to clk->parents[] must check
    > - * for a NULL pointer. We can always perform lazy lookups for
    > - * missing parents later on.
    > - */
    > - if (core->parents)
    > - for (i = 0; i < core->num_parents; i++)
    > - core->parents[i] =
    > - clk_core_lookup(core->parent_names[i]);
    > - }
    > + if (core->parents)

    Do we even need this check? From what I can tell it's always true
    now even when core->num_parents == 0. Plus we can always do the
    for loop and terminate early when core->num_parents == 0.

    > + for (i = 0; i < core->num_parents; i++)
    > + core->parents[i] =
    > + clk_core_lookup(core->parent_names[i]);
    >
    > core->parent = __clk_init_parent(core);
    > nfo.html

    --
    Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
    a Linux Foundation Collaborative Project

    \
     
     \ /
      Last update: 2016-02-02 01:41    [W:2.415 / U:0.732 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site