[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1jttn3w0ja.fsf@starbuckisacylon.baylibre.com>
Date: Wed, 24 Jan 2024 10:16:17 +0100
From: Jerome Brunet <jbrunet@...libre.com>
To: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
Cc: Jerome Brunet <jbrunet@...libre.com>, Thierry Reding
<thierry.reding@...il.com>, Neil Armstrong <neil.armstrong@...aro.org>,
Rob Herring <robh+dt@...nel.org>, Krzysztof Kozlowski
<krzysztof.kozlowski+dt@...aro.org>, Conor Dooley <conor+dt@...nel.org>,
Kevin Hilman <khilman@...libre.com>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-amlogic@...ts.infradead.org,
linux-pwm@...r.kernel.org, JunYi Zhao <junyi.zhao@...ogic.com>
Subject: Re: [PATCH v4 5/6] pwm: meson: don't carry internal clock elements
around
On Wed 24 Jan 2024 at 10:02, Uwe Kleine-König <u.kleine-koenig@...gutronix.de> wrote:
> [[PGP Signed Part:Undecided]]
> On Fri, Dec 22, 2023 at 12:16:53PM +0100, Jerome Brunet wrote:
>> Pointers to the internal clock elements of the PWM are useless
>> after probe. There is no need to carry this around in the device
>> data. Just let devres deal with it.
>>
>> Signed-off-by: Jerome Brunet <jbrunet@...libre.com>
>> ---
>> drivers/pwm/pwm-meson.c | 67 ++++++++++++++++++++++++-----------------
>> 1 file changed, 39 insertions(+), 28 deletions(-)
>>
>> diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
>> index 15c44185d784..fb113bc8da29 100644
>> --- a/drivers/pwm/pwm-meson.c
>> +++ b/drivers/pwm/pwm-meson.c
>> @@ -90,9 +90,6 @@ struct meson_pwm_channel {
>> unsigned int hi;
>> unsigned int lo;
>>
>> - struct clk_mux mux;
>> - struct clk_divider div;
>> - struct clk_gate gate;
>> struct clk *clk;
>> };
>>
>> @@ -442,6 +439,13 @@ static int meson_pwm_init_channels(struct device *dev)
>> struct meson_pwm_channel *channel = &meson->channels[i];
>> struct clk_parent_data div_parent = {}, gate_parent = {};
>> struct clk_init_data init = {};
>> + struct clk_divider *div;
>> + struct clk_gate *gate;
>> + struct clk_mux *mux;
>> +
>> + mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL);
>> + if (!mux)
>> + return -ENOMEM;
>
> I don't like this change. While it doesn't increase the memory used, it
> fragments the used memory and increases the overhead of memory
> management and the number of devm allocations.
>
> Are these members of meson_pwm_channel in the way for anything later?
Not really. It is just not useful on the SoCs which do use it and not
used at all starting from s4/a1.
What about a dedicated struct for the 3 clock elements and a single
devm_kzalloc() instead of 3 ?
>
> Best regards
> Uwe
--
Jerome
Powered by blists - more mailing lists