The idea behind the devm_ managed functions is to tie the lifetime of a resource with the lifetime of a device. Doing so makes code shorter and simpler, and makes resource leaks almost impossible.
The managed version of an API method normally differs from the unmanaged version by the addition of a device pointer indicating ownership (and by the devm_prefix). I've not come across devm_gpiod_get before, and I'm currently confused about how the single device pointer parameter serves both the previous purpose in gpiod_get of indicating the GPIO producer, and also the consumer for resource management.
The managed version of an API method normally differs from the unmanaged version by the addition of a device pointer indicating ownership (and by the devm_prefix). I've not come across devm_gpiod_get before, and I'm currently confused about how the single device pointer parameter serves both the previous purpose in gpiod_get of indicating the GPIO producer, and also the consumer for resource management.
Statistics: Posted by PhilE — Thu May 01, 2025 6:04 am