]> www.infradead.org Git - users/jedix/linux-maple.git/commit
pwm: cros-ec: Put per-channel data into driver data
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 5 Jul 2023 08:06:49 +0000 (10:06 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Fri, 13 Oct 2023 08:07:17 +0000 (10:07 +0200)
commit82adc1b2688b02a6b556720d9954a16a4129567f
treec4489625dc7a247cea3e962c1a5dd9c8e20f94bb
parent2d6812b41e0d832919d72c72ebddf361df53ba1b
pwm: cros-ec: Put per-channel data into driver data

Instead of an allocation of a single u16 per channel, allocate them all in
a single chunk which greatly reduces memory fragmentation and also the
overhead to track the allocated memory. Also put the channel data in
driver data where it's cheaper to determine the address (no function call
involved, just a trivial pointer addition).

This also allows to get rid of the request and free callbacks.

The only cost is that the channel data is allocated early, and even for
unused channels.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20230705080650.2353391-8-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>
drivers/pwm/pwm-cros-ec.c