diff mbox series

[2/4] drm/sun4i: rgb: Store the bridge pointer

Message ID 2f16d70fb09613b3a030fd6a016343047d519d43.1551191081.git-series.maxime.ripard@bootlin.com (mailing list archive)
State New, archived
Headers show
Series [1/4] drm/sun4i: Move the panel pointer from the TCON to the encoders | expand

Commit Message

Maxime Ripard Feb. 26, 2019, 2:25 p.m. UTC
We'll need the bridge pointer, if any, in the mode_valid callback in
addition to the init function. Store the pointer to the bridge in the
rgb private structure.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
 drivers/gpu/drm/sun4i/sun4i_rgb.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Paul Kocialkowski March 7, 2019, 1:29 p.m. UTC | #1
Hi,

On Tue, 2019-02-26 at 15:25 +0100, Maxime Ripard wrote:
> We'll need the bridge pointer, if any, in the mode_valid callback in
> addition to the init function. Store the pointer to the bridge in the
> rgb private structure.
> 
> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>

Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>

Cheers,

Paul

> ---
>  drivers/gpu/drm/sun4i/sun4i_rgb.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c
> index d181ee399b03..8a43ed46af82 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
> @@ -28,6 +28,7 @@ struct sun4i_rgb {
>  
>  	struct sun4i_tcon	*tcon;
>  	struct drm_panel	*panel;
> +	struct drm_bridge	*bridge;
>  };
>  
>  static inline struct sun4i_rgb *
> @@ -169,7 +170,6 @@ static struct drm_encoder_funcs sun4i_rgb_enc_funcs = {
>  int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon)
>  {
>  	struct drm_encoder *encoder;
> -	struct drm_bridge *bridge;
>  	struct sun4i_rgb *rgb;
>  	int ret;
>  
> @@ -180,7 +180,7 @@ int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon)
>  	encoder = &rgb->encoder;
>  
>  	ret = drm_of_find_panel_or_bridge(tcon->dev->of_node, 1, 0,
> -					  &rgb->panel, &bridge);
> +					  &rgb->panel, &rgb->bridge);
>  	if (ret) {
>  		dev_info(drm->dev, "No panel or bridge found... RGB output disabled\n");
>  		return 0;
> @@ -222,8 +222,8 @@ int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon)
>  		}
>  	}
>  
> -	if (bridge) {
> -		ret = drm_bridge_attach(encoder, bridge, NULL);
> +	if (rgb->bridge) {
> +		ret = drm_bridge_attach(encoder, rgb->bridge, NULL);
>  		if (ret) {
>  			dev_err(drm->dev, "Couldn't attach our bridge\n");
>  			goto err_cleanup_connector;
diff mbox series

Patch

diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c
index d181ee399b03..8a43ed46af82 100644
--- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
+++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
@@ -28,6 +28,7 @@  struct sun4i_rgb {
 
 	struct sun4i_tcon	*tcon;
 	struct drm_panel	*panel;
+	struct drm_bridge	*bridge;
 };
 
 static inline struct sun4i_rgb *
@@ -169,7 +170,6 @@  static struct drm_encoder_funcs sun4i_rgb_enc_funcs = {
 int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon)
 {
 	struct drm_encoder *encoder;
-	struct drm_bridge *bridge;
 	struct sun4i_rgb *rgb;
 	int ret;
 
@@ -180,7 +180,7 @@  int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon)
 	encoder = &rgb->encoder;
 
 	ret = drm_of_find_panel_or_bridge(tcon->dev->of_node, 1, 0,
-					  &rgb->panel, &bridge);
+					  &rgb->panel, &rgb->bridge);
 	if (ret) {
 		dev_info(drm->dev, "No panel or bridge found... RGB output disabled\n");
 		return 0;
@@ -222,8 +222,8 @@  int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon)
 		}
 	}
 
-	if (bridge) {
-		ret = drm_bridge_attach(encoder, bridge, NULL);
+	if (rgb->bridge) {
+		ret = drm_bridge_attach(encoder, rgb->bridge, NULL);
 		if (ret) {
 			dev_err(drm->dev, "Couldn't attach our bridge\n");
 			goto err_cleanup_connector;