core: switch to reference counting for gpio chip objects
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Thu, 21 Jan 2021 10:34:57 +0000 (11:34 +0100)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Thu, 18 Mar 2021 08:34:15 +0000 (09:34 +0100)
commit56cf1ad3ec0797be63e3c1fdc2933a237ba138c1
treebbafed46c0259ca50a23b6d01263eaeb93dcf69f
parent0949b0cd958a53ac1801b61a1befdc437790deaa
core: switch to reference counting for gpio chip objects

The preferred approach in low-level system libraries is to make all
exposed data structures opaque and use reference counting for their
memory management. This changes the chip objects to only close their
underlying character device and release all resources once the reference
count goes down to 0. We remove the gpiod_chip_close() function and
replace it with gpiod_chip_ref() and gpiod_chip_unref().

Other objects in the API will either be removed or are not opaque yet
and will be reworked later.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
bindings/cxx/chip.cpp
bindings/python/gpiodmodule.c
include/gpiod.h
lib/core.c
tests/gpiod-test.h
tools/gpiodetect.c
tools/gpiofind.c
tools/gpioget.c
tools/gpioinfo.c
tools/gpiomon.c
tools/gpioset.c