Skip to content

Commit 39c17ae

Browse files
committed
drm/tegra: Don't register DP AUX channels before connectors
As pointed out by the documentation for drm_dp_aux_register(), drm_dp_aux_init() should be used in situations where the AUX channel for a display driver can potentially be registered before it's respective DRM driver. This is the case with Tegra, since the DP aux channel exists as a platform device instead of being a grandchild of the DRM device. Since we're about to add a backpointer to a DP AUX channel's respective DRM device, let's fix this so that we don't potentially allow userspace to use the AUX channel before we've associated it with it's DRM connector. Signed-off-by: Lyude Paul <[email protected]> Acked-by: Thierry Reding <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 45d9699 commit 39c17ae

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/gpu/drm/tegra/dpaux.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -534,9 +534,7 @@ static int tegra_dpaux_probe(struct platform_device *pdev)
534534
dpaux->aux.transfer = tegra_dpaux_transfer;
535535
dpaux->aux.dev = &pdev->dev;
536536

537-
err = drm_dp_aux_register(&dpaux->aux);
538-
if (err < 0)
539-
return err;
537+
drm_dp_aux_init(&dpaux->aux);
540538

541539
/*
542540
* Assume that by default the DPAUX/I2C pads will be used for HDMI,
@@ -589,8 +587,6 @@ static int tegra_dpaux_remove(struct platform_device *pdev)
589587
pm_runtime_put_sync(&pdev->dev);
590588
pm_runtime_disable(&pdev->dev);
591589

592-
drm_dp_aux_unregister(&dpaux->aux);
593-
594590
mutex_lock(&dpaux_lock);
595591
list_del(&dpaux->list);
596592
mutex_unlock(&dpaux_lock);
@@ -723,6 +719,10 @@ int drm_dp_aux_attach(struct drm_dp_aux *aux, struct tegra_output *output)
723719
unsigned long timeout;
724720
int err;
725721

722+
err = drm_dp_aux_register(aux);
723+
if (err < 0)
724+
return err;
725+
726726
output->connector.polled = DRM_CONNECTOR_POLL_HPD;
727727
dpaux->output = output;
728728

@@ -760,6 +760,7 @@ int drm_dp_aux_detach(struct drm_dp_aux *aux)
760760
unsigned long timeout;
761761
int err;
762762

763+
drm_dp_aux_unregister(aux);
763764
disable_irq(dpaux->irq);
764765

765766
if (dpaux->output->panel) {

0 commit comments

Comments
 (0)