drm/bridge: imx: Remove redundant checks on existence of bridge->encoder
Subsystems (5)
PATCH 1/1 drm/bridge: imx: Remove redundant checks on existence of bridge->encoder
The check on the existence of bridge->encoder on the implementation layer of drm bridge driver is not necessary, as it has already been done in the drm_bridge_attach() function. It is guaranteed that the .encoder member of the drm_bridge instance is not NULL when various imx_xxx_bridge_attach() function gets called.
Remove the redundant checking codes "if (!bridge->encoder) { ... }".
--- drivers/gpu/drm/bridge/imx/imx-ldb-helper.c | 5 ----- drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c | 5 ----- drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c | 5 ----- drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c | 5 ----- 4 files changed, 20 deletions(-)
drivers/gpu/drm/bridge/imx/imx-ldb-helper.c +0 -5
@@ -116,11 +116,6 @@ int ldb_bridge_attach_helper(struct drm_bridge *bridge,return -EINVAL ; } -if (!bridge->encoder) { -DRM_DEV_ERROR (ldb->dev,"missing encoder\n" ); -return -ENODEV ; - } -return drm_bridge_attach (bridge->encoder, ldb_ch->next_bridge, bridge,DRM_BRIDGE_ATTACH_NO_CONNECTOR );
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c +0 -5
@@ -119,11 +119,6 @@ static int imx8qxp_pc_bridge_attach(struct drm_bridge *bridge,return -EINVAL ; } -if (!bridge->encoder) { -DRM_DEV_ERROR (pc->dev,"missing encoder\n" ); -return -ENODEV ; - } -return drm_bridge_attach (bridge->encoder, ch->next_bridge, bridge,DRM_BRIDGE_ATTACH_NO_CONNECTOR );
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c +0 -5
@@ -138,11 +138,6 @@ static int imx8qxp_pixel_link_bridge_attach(struct drm_bridge *bridge,return -EINVAL ; } -if (!bridge->encoder) { -DRM_DEV_ERROR (pl->dev,"missing encoder\n" ); -return -ENODEV ; - } -return drm_bridge_attach (bridge->encoder, pl->next_bridge, bridge,DRM_BRIDGE_ATTACH_NO_CONNECTOR );
drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c +0 -5
@@ -58,11 +58,6 @@ static int imx8qxp_pxl2dpi_bridge_attach(struct drm_bridge *bridge,return -EINVAL ; } -if (!bridge->encoder) { -DRM_DEV_ERROR (p2d->dev,"missing encoder\n" ); -return -ENODEV ; - } -return drm_bridge_attach (bridge->encoder, p2d->next_bridge, bridge,DRM_BRIDGE_ATTACH_NO_CONNECTOR );
Signature · 1 line
2.43.0
Hi Sui,
Thank you for the patch.
Quoted 9 lines · Sui Jingfeng
The check on the existence of
bridge->encoderon the implementation layer of drm bridge driver is not necessary, as it has already been done in thedrm_bridge_attach()function. It is guaranteed that the .encoder member of thedrm_bridgeinstance is not NULL when variousimx_xxx_bridge_attach()function gets called.Remove the redundant checking codes "if (!bridge->encoder) { ... }".
Signed-off-by Sui Jingfeng <[email protected]>
Quoted 71 lines
--- drivers/gpu/drm/bridge/imx/imx-ldb-helper.c | 5 ----- drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c | 5 ----- drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c | 5 ----- drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c | 5 ----- 4 files changed, 20 deletions(-)drivers/gpu/drm/bridge/imx/imx-ldb-helper.c +0
-5@@ -116,11 +116,6 @@ int ldb_bridge_attach_helper(struct drm_bridge *bridge,return -EINVAL ; } -if (!bridge->encoder) { -DRM_DEV_ERROR (ldb->dev,"missing encoder\n" ); -return -ENODEV ; - } -return drm_bridge_attach (bridge->encoder, ldb_ch->next_bridge, bridge,DRM_BRIDGE_ATTACH_NO_CONNECTOR );drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c +0
-5@@ -119,11 +119,6 @@ static int imx8qxp_pc_bridge_attach(struct drm_bridge *bridge,return -EINVAL ; } -if (!bridge->encoder) { -DRM_DEV_ERROR (pc->dev,"missing encoder\n" ); -return -ENODEV ; - } -return drm_bridge_attach (bridge->encoder, ch->next_bridge, bridge,DRM_BRIDGE_ATTACH_NO_CONNECTOR );drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c +0
-5@@ -138,11 +138,6 @@ static int imx8qxp_pixel_link_bridge_attach(struct drm_bridge *bridge,return -EINVAL ; } -if (!bridge->encoder) { -DRM_DEV_ERROR (pl->dev,"missing encoder\n" ); -return -ENODEV ; - } -return drm_bridge_attach (bridge->encoder, pl->next_bridge, bridge,DRM_BRIDGE_ATTACH_NO_CONNECTOR );drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c +0
-5@@ -58,11 +58,6 @@ static int imx8qxp_pxl2dpi_bridge_attach(struct drm_bridge *bridge,return -EINVAL ; } -if (!bridge->encoder) { -DRM_DEV_ERROR (p2d->dev,"missing encoder\n" ); -return -ENODEV ; - } -return drm_bridge_attach (bridge->encoder, p2d->next_bridge, bridge,DRM_BRIDGE_ATTACH_NO_CONNECTOR );
Signature · 3 lines
Regards, Laurent Pinchart
Liu Ying
maintainerQuoted 5 lines · Sui Jingfeng
The check on the existence of
bridge->encoderon the implementation layer of drm bridge driver is not necessary, as it has already been done in thedrm_bridge_attach()function. It is guaranteed that the .encoder member of thedrm_bridgeinstance is not NULL when variousimx_xxx_bridge_attach()function gets called.
Nit:ldb_bridge_attach_helper() doesn't follow the fashion of imx_xxx_bridge_attach(), not even the other bridge attach functions touched by this patch do. Maybe, reword as "when various i.MX specific bridge attach functions are called."
Regards,
Liu Ying
Quoted 75 lines
Remove the redundant checking codes "if (!bridge->encoder) { ... }".
Signed-off-by Sui Jingfeng <[email protected]>--- drivers/gpu/drm/bridge/imx/imx-ldb-helper.c | 5 ----- drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c | 5 ----- drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c | 5 ----- drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c | 5 ----- 4 files changed, 20 deletions(-)drivers/gpu/drm/bridge/imx/imx-ldb-helper.c +0
-5@@ -116,11 +116,6 @@ int ldb_bridge_attach_helper(struct drm_bridge *bridge,return -EINVAL ; } -if (!bridge->encoder) { -DRM_DEV_ERROR (ldb->dev,"missing encoder\n" ); -return -ENODEV ; - } -return drm_bridge_attach (bridge->encoder, ldb_ch->next_bridge, bridge,DRM_BRIDGE_ATTACH_NO_CONNECTOR );drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c +0
-5@@ -119,11 +119,6 @@ static int imx8qxp_pc_bridge_attach(struct drm_bridge *bridge,return -EINVAL ; } -if (!bridge->encoder) { -DRM_DEV_ERROR (pc->dev,"missing encoder\n" ); -return -ENODEV ; - } -return drm_bridge_attach (bridge->encoder, ch->next_bridge, bridge,DRM_BRIDGE_ATTACH_NO_CONNECTOR );drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c +0
-5@@ -138,11 +138,6 @@ static int imx8qxp_pixel_link_bridge_attach(struct drm_bridge *bridge,return -EINVAL ; } -if (!bridge->encoder) { -DRM_DEV_ERROR (pl->dev,"missing encoder\n" ); -return -ENODEV ; - } -return drm_bridge_attach (bridge->encoder, pl->next_bridge, bridge,DRM_BRIDGE_ATTACH_NO_CONNECTOR );drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c +0
-5@@ -58,11 +58,6 @@ static int imx8qxp_pxl2dpi_bridge_attach(struct drm_bridge *bridge,return -EINVAL ; } -if (!bridge->encoder) { -DRM_DEV_ERROR (p2d->dev,"missing encoder\n" ); -return -ENODEV ; - } -return drm_bridge_attach (bridge->encoder, p2d->next_bridge, bridge,DRM_BRIDGE_ATTACH_NO_CONNECTOR );
Hi,
Quoted 11 lines · Liu Ying
Quoted 5 lines · Sui Jingfeng
The check on the existence of
bridge->encoderon the implementation layer of drm bridge driver is not necessary, as it has already been done in thedrm_bridge_attach()function. It is guaranteed that the .encoder member of thedrm_bridgeinstance is not NULL when variousimx_xxx_bridge_attach()function gets called.Nit:
ldb_bridge_attach_helper()doesn't follow the fashion ofimx_xxx_bridge_attach(), not even the other bridge attach functions touched by this patch do.
Right, my bad.
But personally, I think rename it as ldb_bridge_attach() should enough to express the meaning. :-)
Maybe, reword as
Quoted 3 lines
"when various i.MX specific bridge attach functions are called."
OK, fine.
I will correct the commit message at the next version, so happy being reviewed. Thanks.
Quoted 3 lines
Regards,
Liu Ying