drm/tegra: Properly reference count the DDC I2C adapter
authorThierry Reding <treding@nvidia.com>
Wed, 8 Apr 2020 18:01:00 +0000 (20:01 +0200)
committerThierry Reding <treding@nvidia.com>
Thu, 17 Sep 2020 10:27:11 +0000 (12:27 +0200)
commit2340dc15f05f595688ae10f6512cef5ad51476d3
tree930412665bbf5d865ac20ef79ac3c9b91249f1af
parent9123e3a74ec7b934a4a099e98af6a61c2f80bbf5
drm/tegra: Properly reference count the DDC I2C adapter

Use the of_get_i2c_adapter_by_node(), which is similar to the existing
call to of_find_i2c_adapter_by_node() except that it also takes a
reference to the owner module of the I2C adapter. In order to properly
balance this out, call i2c_put_adapter() to release the reference to the
I2C adapter and its owner module.

For the special case where the DDC comes from the DPAUX, care must be
taken to perform the same steps (i.e. get_device() and module_get()) so
that the reference counts are all balanced.

Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/tegra/output.c
drivers/gpu/drm/tegra/sor.c