[PATCH v4 5/6] pwm: meson: don't carry internal clock elements around
Jerome Brunet
jbrunet at baylibre.com
Wed Jan 24 01:16:17 PST 2024
On Wed 24 Jan 2024 at 10:02, Uwe Kleine-König <u.kleine-koenig at pengutronix.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 at baylibre.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
More information about the linux-amlogic
mailing list