Skip to content

Commit 7b821db

Browse files
bebarinodianders
authored andcommitted
drm/bridge: ti-sn65dsi86: Associate DSI device lifetime with auxiliary device
The kernel produces a warning splat and the DSI device fails to register in this driver if the i2c driver probes, populates child auxiliary devices, and then somewhere in ti_sn_bridge_probe() a function call returns -EPROBE_DEFER. When the auxiliary driver probe defers, the dsi device created by devm_mipi_dsi_device_register_full() is left registered because the devm managed device used to manage the lifetime of the DSI device is the parent i2c device, not the auxiliary device that is being probed. Associate the DSI device created and managed by this driver to the lifetime of the auxiliary device, not the i2c device, so that the DSI device is removed when the auxiliary driver unbinds. Similarly change the device pointer used for dev_err_probe() so the deferred probe errors are associated with the auxiliary device instead of the parent i2c device so we can narrow down future problems faster. Cc: Douglas Anderson <dianders@chromium.org> Cc: Maxime Ripard <maxime@cerno.tech> Fixes: c3b75d4 ("drm/bridge: sn65dsi86: Register and attach our DSI device at probe") Signed-off-by: Stephen Boyd <swboyd@chromium.org> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Douglas Anderson <dianders@chromium.org> Link: https://patchwork.freedesktop.org/patch/msgid/20231002235407.769399-1-swboyd@chromium.org
1 parent c1165df commit 7b821db

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/gpu/drm/bridge/ti-sn65dsi86.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ static struct ti_sn65dsi86 *bridge_to_ti_sn65dsi86(struct drm_bridge *bridge)
692692
return container_of(bridge, struct ti_sn65dsi86, bridge);
693693
}
694694

695-
static int ti_sn_attach_host(struct ti_sn65dsi86 *pdata)
695+
static int ti_sn_attach_host(struct auxiliary_device *adev, struct ti_sn65dsi86 *pdata)
696696
{
697697
int val;
698698
struct mipi_dsi_host *host;
@@ -707,7 +707,7 @@ static int ti_sn_attach_host(struct ti_sn65dsi86 *pdata)
707707
if (!host)
708708
return -EPROBE_DEFER;
709709

710-
dsi = devm_mipi_dsi_device_register_full(dev, host, &info);
710+
dsi = devm_mipi_dsi_device_register_full(&adev->dev, host, &info);
711711
if (IS_ERR(dsi))
712712
return PTR_ERR(dsi);
713713

@@ -725,7 +725,7 @@ static int ti_sn_attach_host(struct ti_sn65dsi86 *pdata)
725725

726726
pdata->dsi = dsi;
727727

728-
return devm_mipi_dsi_attach(dev, dsi);
728+
return devm_mipi_dsi_attach(&adev->dev, dsi);
729729
}
730730

731731
static int ti_sn_bridge_attach(struct drm_bridge *bridge,
@@ -1298,9 +1298,9 @@ static int ti_sn_bridge_probe(struct auxiliary_device *adev,
12981298
struct device_node *np = pdata->dev->of_node;
12991299
int ret;
13001300

1301-
pdata->next_bridge = devm_drm_of_get_bridge(pdata->dev, np, 1, 0);
1301+
pdata->next_bridge = devm_drm_of_get_bridge(&adev->dev, np, 1, 0);
13021302
if (IS_ERR(pdata->next_bridge))
1303-
return dev_err_probe(pdata->dev, PTR_ERR(pdata->next_bridge),
1303+
return dev_err_probe(&adev->dev, PTR_ERR(pdata->next_bridge),
13041304
"failed to create panel bridge\n");
13051305

13061306
ti_sn_bridge_parse_lanes(pdata, np);
@@ -1319,9 +1319,9 @@ static int ti_sn_bridge_probe(struct auxiliary_device *adev,
13191319

13201320
drm_bridge_add(&pdata->bridge);
13211321

1322-
ret = ti_sn_attach_host(pdata);
1322+
ret = ti_sn_attach_host(adev, pdata);
13231323
if (ret) {
1324-
dev_err_probe(pdata->dev, ret, "failed to attach dsi host\n");
1324+
dev_err_probe(&adev->dev, ret, "failed to attach dsi host\n");
13251325
goto err_remove_bridge;
13261326
}
13271327

0 commit comments

Comments
 (0)