[PATCH v2 10/68] drm/bridge: panel: Introduce drmm_of_get_bridge

Sam Ravnborg sam at ravnborg.org
Fri Jun 24 19:31:20 UTC 2022


On Wed, Jun 22, 2022 at 04:31:11PM +0200, Maxime Ripard wrote:
> Unlike what can be found for other DRM entities, we don't have a
> DRM-managed function equivalent to devm_drm_of_get_bridge().
> 
> Let's create it.
> 
> Signed-off-by: Maxime Ripard <maxime at cerno.tech>
> ---
>  drivers/gpu/drm/bridge/panel.c | 35 ++++++++++++++++++++++++++++++++++
>  include/drm/drm_bridge.h       |  2 ++
>  2 files changed, 37 insertions(+)
> 
> diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c
> index 07d720aa38c6..0bf824ca1f25 100644
> --- a/drivers/gpu/drm/bridge/panel.c
> +++ b/drivers/gpu/drm/bridge/panel.c
> @@ -425,4 +425,39 @@ struct drm_bridge *devm_drm_of_get_bridge(struct device *dev,
>  	return bridge;
>  }
>  EXPORT_SYMBOL(devm_drm_of_get_bridge);
> +
> +/**
> + * drmm_of_get_bridge - Return next bridge in the chain
> + * @dev: device to tie the bridge lifetime to
> + * @np: device tree node containing encoder output ports
> + * @port: port in the device tree node
> + * @endpoint: endpoint in the device tree node
> + *
> + * Given a DT node's port and endpoint number, finds the connected node
> + * and returns the associated bridge if any, or creates and returns a
> + * drm panel bridge instance if a panel is connected.
> + *
> + * Returns a pointer to the bridge if successful, or an error pointer
> + * otherwise.
Maybe extend this text to:

	Returns a drmm managed pointer to the bridge if successful, or an error
	pointer otherwise.

To tell the reader that there is no need for any cleanup.

With this or something similar added:
Acked-by: Sam Ravnborg <sam at ravnborg.org>

	Sam


More information about the dri-devel mailing list