mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-25 00:23:20 -04:00
drm/bridge: adv7511: switch to of_drm_get_bridge_by_endpoint()
This driver calls drm_of_find_panel_or_bridge() with a NULL pointer in the @panel parameter, thus using a reduced feature set of that function. Replace this call with the simpler of_drm_get_bridge_by_endpoint(). Since of_drm_get_bridge_by_endpoint() increases the refcount of the returned bridge, ensure it is put on removal. To achieve this, instead of adding an explicit drm_bridge_put(), migrate to the bridge::next_bridge pointer which is automatically put when the bridge is eventually freed. Tested-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Link: https://patch.msgid.link/20260511-drm-bridge-alloc-getput-panel_or_bridge-v6-8-f61c9e498b3f@bootlin.com Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
This commit is contained in:
@@ -354,7 +354,6 @@ struct adv7511 {
|
||||
enum drm_connector_status status;
|
||||
bool powered;
|
||||
|
||||
struct drm_bridge *next_bridge;
|
||||
struct drm_display_mode curr_mode;
|
||||
|
||||
unsigned int f_tmds;
|
||||
|
||||
@@ -849,8 +849,8 @@ static int adv7511_bridge_attach(struct drm_bridge *bridge,
|
||||
struct adv7511 *adv = bridge_to_adv7511(bridge);
|
||||
int ret = 0;
|
||||
|
||||
if (adv->next_bridge) {
|
||||
ret = drm_bridge_attach(encoder, adv->next_bridge, bridge,
|
||||
if (adv->bridge.next_bridge) {
|
||||
ret = drm_bridge_attach(encoder, adv->bridge.next_bridge, bridge,
|
||||
flags | DRM_BRIDGE_ATTACH_NO_CONNECTOR);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -1249,10 +1249,13 @@ static int adv7511_probe(struct i2c_client *i2c)
|
||||
|
||||
memset(&link_config, 0, sizeof(link_config));
|
||||
|
||||
ret = drm_of_find_panel_or_bridge(dev->of_node, 1, -1, NULL,
|
||||
&adv7511->next_bridge);
|
||||
if (ret && ret != -ENODEV)
|
||||
return ret;
|
||||
adv7511->bridge.next_bridge = of_drm_get_bridge_by_endpoint(dev->of_node, 1, -1);
|
||||
if (IS_ERR(adv7511->bridge.next_bridge)) {
|
||||
if (PTR_ERR(adv7511->bridge.next_bridge) == -ENODEV)
|
||||
adv7511->bridge.next_bridge = NULL;
|
||||
else
|
||||
return PTR_ERR(adv7511->bridge.next_bridge);
|
||||
}
|
||||
|
||||
if (adv7511->info->link_config)
|
||||
ret = adv7511_parse_dt(dev->of_node, &link_config);
|
||||
|
||||
Reference in New Issue
Block a user