On Wed, Apr 24, 2024 at 05:16:57AM +0300, Dmitry Baryshkov wrote: > If a probe function returns -EPROBE_DEFER after creating another device > there is a change of ending up in a probe deferral loop, (see commit > fbc35b45f9f6 ("Add documentation on meaning of -EPROBE_DEFER"). In case > of the qcom-pmic-typec driver the tcpm_register_port() function looks up > external resources (USB role switch and inherently via called > typec_register_port() USB-C muxes, switches and retimers). > > In order to prevent such probe-defer loops caused by qcom-pmic-typec > driver, use the API added by Johan Hovold and move HPD bridge > registration to the end of the probe function. > > The devm_drm_dp_hpd_bridge_add() is called at the end of the probe > function after all TCPM start functions. This is done as a way to > overcome a different problem, the DRM subsystem can not properly cope > with the DRM bridges being destroyed once the bridge is attached. Having > this function call at the end of the probe function prevents possible > DRM bridge device creation followed by destruction in case one of the > TCPM start functions returns an error. As I mentioned again off-list yesterday, I would have preferred to see an explanation why registering the bridge after starting the port and phy is ok as it's not obvious to someone not familiar with the driver. But given that bridge registration only registers an aux device which may not have been probed by the time the function returns I guess that implies that the old driver did not actually rely on it being registered before starting either. So I'm fine with this as-is. > Reported-by: Caleb Connolly <caleb.connolly@xxxxxxxxxx> > Acked-by: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx> > --- > Dependency: https://lore.kernel.org/lkml/20240418145730.4605-2-johan+linaro@xxxxxxxxxx/ > --- > Changes in v4: > - Rebased on top of Johan's patches > - Link to v3: https://lore.kernel.org/r/20240416-qc-pmic-typec-hpd-split-v3-1-fd071e3191a1@xxxxxxxxxx Reviewed-by: Johan Hovold <johan+linaro@xxxxxxxxxx> Johan