drm/tegra: Get ref for DP AUX channel, not its ddc adapter
authorLyude Paul <lyude@redhat.com>
Fri, 14 May 2021 22:13:05 +0000 (18:13 -0400)
committerThierry Reding <treding@nvidia.com>
Thu, 27 May 2021 18:11:07 +0000 (20:11 +0200)
While we're taking a reference of the DDC adapter for a DP AUX channel in
tegra_sor_probe() because we're going to be using that adapter with the
SOR, now that we've moved where AUX registration happens the actual device
structure for the DDC adapter isn't initialized yet. Which means that we
can't really take a reference from it to try to keep it around anymore.

This should be fine though, because we can just take a reference of its
parent instead.

v2:
* Avoid calling i2c_put_adapter() in tegra_output_remove() for eDP/DP cases

Signed-off-by: Lyude Paul <lyude@redhat.com>
Fixes: 39c17ae60ea9 ("drm/tegra: Don't register DP AUX channels before connectors")
Cc: Lyude Paul <lyude@redhat.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Jonathan Hunter <jonathanh@nvidia.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-tegra@vger.kernel.org
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/tegra/output.c
drivers/gpu/drm/tegra/sor.c

index 47d26b5d99456bdd0a3d1facc99f2d90949075a8..2dacce1ab6ee8266aee695cd7a6c36e4f5b853b3 100644 (file)
@@ -180,10 +180,13 @@ int tegra_output_probe(struct tegra_output *output)
 
 void tegra_output_remove(struct tegra_output *output)
 {
+       int connector_type = output->connector.connector_type;
+
        if (output->hpd_gpio)
                free_irq(output->hpd_irq, output);
 
-       if (output->ddc)
+       if (connector_type != DRM_MODE_CONNECTOR_eDP &&
+           connector_type != DRM_MODE_CONNECTOR_DisplayPort && output->ddc)
                i2c_put_adapter(output->ddc);
 }
 
index 32c83f2e386ca2c1334e245031c32ed5143b9863..8f99de08b2bee64b933cff9933017e0593cc4a89 100644 (file)
@@ -3745,11 +3745,11 @@ static int tegra_sor_probe(struct platform_device *pdev)
                if (!sor->aux)
                        return -EPROBE_DEFER;
 
-               if (get_device(&sor->aux->ddc.dev)) {
-                       if (try_module_get(sor->aux->ddc.owner))
+               if (get_device(sor->aux->dev)) {
+                       if (try_module_get(sor->aux->dev->driver->owner))
                                sor->output.ddc = &sor->aux->ddc;
                        else
-                               put_device(&sor->aux->ddc.dev);
+                               put_device(sor->aux->dev);
                }
        }