Re: [PATCH v2] clk: ti: dra7-atl: don't allocate `parent_names' variable

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

 



Hi Stephen,

On Fri, Oct 28, 2022 at 2:27 AM Stephen Boyd <sboyd@xxxxxxxxxx> wrote:
>
> Quoting Dario Binacchi (2022-10-18 09:03:52)
> > diff --git a/drivers/clk/ti/clk-dra7-atl.c b/drivers/clk/ti/clk-dra7-atl.c
> > index ff4d6a951681..78482d1a4a33 100644
> > --- a/drivers/clk/ti/clk-dra7-atl.c
> > +++ b/drivers/clk/ti/clk-dra7-atl.c
> > @@ -188,24 +188,17 @@ static void __init of_dra7_atl_clock_setup(struct device_node *node)
> >                 goto cleanup;
> >         }
> >
> > -       parent_names = kzalloc(sizeof(char *), GFP_KERNEL);
> > -
> > -       if (!parent_names)
> > -               goto cleanup;
> > -
> >         parent_names[0] = of_clk_get_parent_name(node, 0);
>
> Can you use struct clk_parent_data instead and assign index to 0? Then
> we don't even need to use of_clk_get_parent_name() here.

I tried to test your suggestions on another platform (I don't have the
hw to test the driver change) but if I
don't add pdata.name = of_clk_get_parent_name () the board boot up fails.

As far I can see from the clk_core_populate_parent_map()

....
/* Copy everything over because it might be __initdata */
for (i = 0, parent = parents; i < num_parents; i++, parent++) {
    parent->index = -1;
    if (parent_names) {
        /* throw a WARN if any entries are NULL */
       WARN(!parent_names[i],
            "%s: invalid NULL in %s's .parent_names\n",
            __func__, core->name);
        ret = clk_cpy_name(&parent->name, parent_names[i],
                                        true);
    } else if (parent_data) {
        parent->hw = parent_data[i].hw;
        parent->index = parent_data[i].index;
        ret = clk_cpy_name(&parent->fw_name,
                                         parent_data[i].fw_name, false);
        if (!ret)
            ret = clk_cpy_name(&parent->name,
                                            parent_data[i].name,
                                            false);
...


The function clk_cpy_name() is called with the parameter "mus_exist"
to true in the path "parent_names" and false
in the path "parent_data". Therefore, in the path "parent_data" it is
allowed that parent-> name is not set.
In doing so, therefore, the change would not even be backward compatible.

So, IMHO, there are 2 possible options:
 1 okay to use parent_data, but we keep using of_clk_get_parent_name
() to set parent_data::name.
 2 okay to use the version v2 of the patch.

What do you think?

Thanks and regards,
Dario

-- 

Dario Binacchi

Embedded Linux Developer

dario.binacchi@xxxxxxxxxxxxxxxxxxxx

__________________________________


Amarula Solutions SRL

Via Le Canevare 30, 31100 Treviso, Veneto, IT

T. +39 042 243 5310
info@xxxxxxxxxxxxxxxxxxxx

www.amarulasolutions.com



[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux