drm/bridge: ti-sn65dsi86: Associate DSI device lifetime with auxiliary device
authorStephen Boyd <swboyd@chromium.org>
Mon, 2 Oct 2023 23:54:06 +0000 (16:54 -0700)
committerDouglas Anderson <dianders@chromium.org>
Thu, 12 Oct 2023 16:24:09 +0000 (09:24 -0700)
commit7b821db95140e2c118567aee22a78bf85f3617e0
tree0b1471fc1e47712e43bc1460f7c63090fca4e2d0
parentc1165df2be2fffe3adeeaa68f4ee4325108c5e4e
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: c3b75d4734cb ("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
drivers/gpu/drm/bridge/ti-sn65dsi86.c