diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2023-07-05 10:06:48 +0200 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2023-10-13 10:07:17 +0200 |
commit | 2d6812b41e0d832919d72c72ebddf361df53ba1b (patch) | |
tree | c2c380570aa85fc07a5f876aad9ee836b4e65f54 /drivers/nvmem/rave-sp-eeprom.c | |
parent | ec63391a0d402cafa5f4dfd11e05cd325ae7e2f5 (diff) | |
download | lwn-2d6812b41e0d832919d72c72ebddf361df53ba1b.tar.gz lwn-2d6812b41e0d832919d72c72ebddf361df53ba1b.zip |
pwm: sti: Reduce number of allocations and drop usage of chip_data
Instead of using one allocation per capture channel, use a single one. Also
store it in driver data instead of chip data.
This has several advantages:
- driver data isn't cleared when pwm_put() is called
- Reduces memory fragmentation
Also register the pwm chip only after the per capture channel data is
initialized as the capture callback relies on this initialization and it
might be called even before pwmchip_add() returns.
It would be still better to have struct sti_pwm_compat_data and the
per-channel data struct sti_cpt_ddata in a single memory chunk, but that's
not easily possible because the number of capture channels isn't known yet
when the driver data struct is allocated.
Fixes: e926b12c611c ("pwm: Clear chip_data in pwm_put()")
Reported-by: George Stark <gnstark@sberdevices.ru>
Fixes: c97267ae831d ("pwm: sti: Add PWM capture callback")
Link: https://lore.kernel.org/r/20230705080650.2353391-7-u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'drivers/nvmem/rave-sp-eeprom.c')
0 files changed, 0 insertions, 0 deletions