2022-06-25 01:05:34

by Stephen Boyd

[permalink] [raw]
Subject: [PATCH] drm/msm/dp: Remove encoder pointer from struct msm_dp

We don't need to stash the encoder here. Instead we can simply pass it
around as an argument.

Cc: Kuogee Hsieh <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
---
drivers/gpu/drm/msm/dp/dp_display.c | 4 +---
drivers/gpu/drm/msm/dp/dp_display.h | 1 -
drivers/gpu/drm/msm/dp/dp_drm.c | 8 ++++----
drivers/gpu/drm/msm/dp/dp_drm.h | 2 +-
4 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index da5c03a8cc4c..798fd5398b48 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -1621,8 +1621,6 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev,
return ret;
}

- dp_display->encoder = encoder;
-
ret = dp_display_get_next_bridge(dp_display);
if (ret)
return ret;
@@ -1638,7 +1636,7 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev,

priv->bridges[priv->num_bridges++] = dp_display->bridge;

- dp_display->connector = dp_drm_connector_init(dp_display);
+ dp_display->connector = dp_drm_connector_init(dp_display, encoder);
if (IS_ERR(dp_display->connector)) {
ret = PTR_ERR(dp_display->connector);
DRM_DEV_ERROR(dev->dev,
diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h
index 4f9fe4d7610b..dcedf021f7fe 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.h
+++ b/drivers/gpu/drm/msm/dp/dp_display.h
@@ -15,7 +15,6 @@ struct msm_dp {
struct device *codec_dev;
struct drm_bridge *bridge;
struct drm_connector *connector;
- struct drm_encoder *encoder;
struct drm_bridge *next_bridge;
bool is_connected;
bool audio_enabled;
diff --git a/drivers/gpu/drm/msm/dp/dp_drm.c b/drivers/gpu/drm/msm/dp/dp_drm.c
index 62d58b9c4647..6df25f7662e7 100644
--- a/drivers/gpu/drm/msm/dp/dp_drm.c
+++ b/drivers/gpu/drm/msm/dp/dp_drm.c
@@ -116,7 +116,7 @@ struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device *
}

if (dp_display->next_bridge) {
- rc = drm_bridge_attach(dp_display->encoder,
+ rc = drm_bridge_attach(encoder,
dp_display->next_bridge, bridge,
DRM_BRIDGE_ATTACH_NO_CONNECTOR);
if (rc < 0) {
@@ -130,15 +130,15 @@ struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device *
}

/* connector initialization */
-struct drm_connector *dp_drm_connector_init(struct msm_dp *dp_display)
+struct drm_connector *dp_drm_connector_init(struct msm_dp *dp_display, struct drm_encoder *encoder)
{
struct drm_connector *connector = NULL;

- connector = drm_bridge_connector_init(dp_display->drm_dev, dp_display->encoder);
+ connector = drm_bridge_connector_init(dp_display->drm_dev, encoder);
if (IS_ERR(connector))
return connector;

- drm_connector_attach_encoder(connector, dp_display->encoder);
+ drm_connector_attach_encoder(connector, encoder);

return connector;
}
diff --git a/drivers/gpu/drm/msm/dp/dp_drm.h b/drivers/gpu/drm/msm/dp/dp_drm.h
index f4b1ed1e24f7..82035dbb0578 100644
--- a/drivers/gpu/drm/msm/dp/dp_drm.h
+++ b/drivers/gpu/drm/msm/dp/dp_drm.h
@@ -19,7 +19,7 @@ struct msm_dp_bridge {

#define to_dp_bridge(x) container_of((x), struct msm_dp_bridge, bridge)

-struct drm_connector *dp_drm_connector_init(struct msm_dp *dp_display);
+struct drm_connector *dp_drm_connector_init(struct msm_dp *dp_display, struct drm_encoder *encoder);
struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device *dev,
struct drm_encoder *encoder);


base-commit: 24df12013853ac59c52cc726e9cbe51e38d09eda
--
https://chromeos.dev


2022-06-25 02:13:23

by Abhinav Kumar

[permalink] [raw]
Subject: Re: [PATCH] drm/msm/dp: Remove encoder pointer from struct msm_dp



On 6/24/2022 5:28 PM, Stephen Boyd wrote:
> We don't need to stash the encoder here. Instead we can simply pass it
> around as an argument.
>
> Cc: Kuogee Hsieh <[email protected]>
> Signed-off-by: Stephen Boyd <[email protected]>
Reviewed-by: Abhinav Kumar <[email protected]>
> ---
> drivers/gpu/drm/msm/dp/dp_display.c | 4 +---
> drivers/gpu/drm/msm/dp/dp_display.h | 1 -
> drivers/gpu/drm/msm/dp/dp_drm.c | 8 ++++----
> drivers/gpu/drm/msm/dp/dp_drm.h | 2 +-
> 4 files changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> index da5c03a8cc4c..798fd5398b48 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -1621,8 +1621,6 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev,
> return ret;
> }
>
> - dp_display->encoder = encoder;
> -
> ret = dp_display_get_next_bridge(dp_display);
> if (ret)
> return ret;
> @@ -1638,7 +1636,7 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev,
>
> priv->bridges[priv->num_bridges++] = dp_display->bridge;
>
> - dp_display->connector = dp_drm_connector_init(dp_display);
> + dp_display->connector = dp_drm_connector_init(dp_display, encoder);
> if (IS_ERR(dp_display->connector)) {
> ret = PTR_ERR(dp_display->connector);
> DRM_DEV_ERROR(dev->dev,
> diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h
> index 4f9fe4d7610b..dcedf021f7fe 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.h
> +++ b/drivers/gpu/drm/msm/dp/dp_display.h
> @@ -15,7 +15,6 @@ struct msm_dp {
> struct device *codec_dev;
> struct drm_bridge *bridge;
> struct drm_connector *connector;
> - struct drm_encoder *encoder;
> struct drm_bridge *next_bridge;
> bool is_connected;
> bool audio_enabled;
> diff --git a/drivers/gpu/drm/msm/dp/dp_drm.c b/drivers/gpu/drm/msm/dp/dp_drm.c
> index 62d58b9c4647..6df25f7662e7 100644
> --- a/drivers/gpu/drm/msm/dp/dp_drm.c
> +++ b/drivers/gpu/drm/msm/dp/dp_drm.c
> @@ -116,7 +116,7 @@ struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device *
> }
>
> if (dp_display->next_bridge) {
> - rc = drm_bridge_attach(dp_display->encoder,
> + rc = drm_bridge_attach(encoder,
> dp_display->next_bridge, bridge,
> DRM_BRIDGE_ATTACH_NO_CONNECTOR);
> if (rc < 0) {
> @@ -130,15 +130,15 @@ struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device *
> }
>
> /* connector initialization */
> -struct drm_connector *dp_drm_connector_init(struct msm_dp *dp_display)
> +struct drm_connector *dp_drm_connector_init(struct msm_dp *dp_display, struct drm_encoder *encoder)
> {
> struct drm_connector *connector = NULL;
>
> - connector = drm_bridge_connector_init(dp_display->drm_dev, dp_display->encoder);
> + connector = drm_bridge_connector_init(dp_display->drm_dev, encoder);
> if (IS_ERR(connector))
> return connector;
>
> - drm_connector_attach_encoder(connector, dp_display->encoder);
> + drm_connector_attach_encoder(connector, encoder);
>
> return connector;
> }
> diff --git a/drivers/gpu/drm/msm/dp/dp_drm.h b/drivers/gpu/drm/msm/dp/dp_drm.h
> index f4b1ed1e24f7..82035dbb0578 100644
> --- a/drivers/gpu/drm/msm/dp/dp_drm.h
> +++ b/drivers/gpu/drm/msm/dp/dp_drm.h
> @@ -19,7 +19,7 @@ struct msm_dp_bridge {
>
> #define to_dp_bridge(x) container_of((x), struct msm_dp_bridge, bridge)
>
> -struct drm_connector *dp_drm_connector_init(struct msm_dp *dp_display);
> +struct drm_connector *dp_drm_connector_init(struct msm_dp *dp_display, struct drm_encoder *encoder);
> struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device *dev,
> struct drm_encoder *encoder);
>
>
> base-commit: 24df12013853ac59c52cc726e9cbe51e38d09eda