[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220512140512.10718-1-miles.chen@mediatek.com>
Date: Thu, 12 May 2022 22:05:12 +0800
From: Miles Chen <miles.chen@...iatek.com>
To: <wenst@...omium.org>
CC: <angelogioacchino.delregno@...labora.com>,
<chun-jie.chen@...iatek.com>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-clk@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-mediatek@...ts.infradead.org>, <matthias.bgg@...il.com>,
<miles.chen@...iatek.com>, <mturquette@...libre.com>,
<rex-bc.chen@...iatek.com>, <sboyd@...nel.org>
Subject: Re: [PATCH v2 03/11] clk: mediatek: Convert mtk_{alloc,free}_clk_data to struct clk_hw
>-struct clk_onecell_data *mtk_alloc_clk_data(unsigned int clk_num)
>+struct clk_hw_onecell_data *mtk_alloc_clk_data(unsigned int clk_num)
> {
> int i;
> struct clk_onecell_data *clk_data;
This struct clk_onecell_data also be struct clk_hw_onecell_data?
>
>- clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL);
>+ clk_data = kzalloc(struct_size(clk_data, hws, clk_num), GFP_KERNEL);
> if (!clk_data)
> return NULL;
>
>- clk_data->clks = kcalloc(clk_num, sizeof(*clk_data->clks), GFP_KERNEL);
>- if (!clk_data->clks)
>- goto err_out;
>-
>- clk_data->clk_num = clk_num;
>+ clk_data->num = clk_num;
>
> for (i = 0; i < clk_num; i++)
>- clk_data->clks[i] = ERR_PTR(-ENOENT);
>+ clk_data->hws[i] = ERR_PTR(-ENOENT);
>
> return clk_data;
>-err_out:
>- kfree(clk_data);
>-
>- return NULL;
> }
> EXPORT_SYMBOL_GPL(mtk_alloc_clk_data);
>
>-void mtk_free_clk_data(struct clk_onecell_data *clk_data)
>+void mtk_free_clk_data(struct clk_hw_onecell_data *clk_data)
> {
>- if (!clk_data)
>- return;
>-
>- kfree(clk_data->clks);
> kfree(clk_data);
> }
>+EXPORT_SYMBOL_GPL(mtk_free_clk_data);
Powered by blists - more mailing lists