Re: [PATCH 9/9] drm: rcar-du: Drop local encoder variable

2020-12-14 Thread Kieran Bingham
Hi Laurent,

On 04/12/2020 22:01, Laurent Pinchart wrote:
> The local encoder variable is an alias for >base, and is only use
> twice. It doesn't help much, drop it, along with the
> rcar_encoder_to_drm_encoder() macro that is then unused.

It does seem overkill to have a macro for only a single (variable
instantiation) usage, so this makes sense.

And now there's 4 lines less code ... That's always a win :-D

Reviewed-by: Kieran Bingham 


> Signed-off-by: Laurent Pinchart 
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 6 ++
>  drivers/gpu/drm/rcar-du/rcar_du_encoder.h | 2 --
>  2 files changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
> index 49c0b27e2f5a..9a565bd3380d 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
> @@ -61,7 +61,6 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
>struct device_node *enc_node)
>  {
>   struct rcar_du_encoder *renc;
> - struct drm_encoder *encoder;
>   struct drm_bridge *bridge;
>   int ret;
>  
> @@ -108,12 +107,11 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
>  
>   rcdu->encoders[output] = renc;
>   renc->output = output;
> - encoder = rcar_encoder_to_drm_encoder(renc);
>  
>   dev_dbg(rcdu->dev, "initializing encoder %pOF for output %u\n",
>   enc_node, output);
>  
> - ret = drm_encoder_init(>ddev, encoder, _du_encoder_funcs,
> + ret = drm_encoder_init(>ddev, >base, _du_encoder_funcs,
>  DRM_MODE_ENCODER_NONE, NULL);
>   if (ret < 0)
>   goto error;
> @@ -127,7 +125,7 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
>* Attach the bridge to the encoder. The bridge will create the
>* connector.
>*/
> - return drm_bridge_attach(encoder, bridge, NULL, 0);
> + return drm_bridge_attach(>base, bridge, NULL, 0);
>  
>  error:
>   kfree(renc);
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.h 
> b/drivers/gpu/drm/rcar-du/rcar_du_encoder.h
> index df9be4524301..73560563fb31 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.h
> @@ -22,8 +22,6 @@ struct rcar_du_encoder {
>  #define to_rcar_encoder(e) \
>   container_of(e, struct rcar_du_encoder, base)
>  
> -#define rcar_encoder_to_drm_encoder(e)   (&(e)->base)
> -
>  int rcar_du_encoder_init(struct rcar_du_device *rcdu,
>enum rcar_du_output output,
>struct device_node *enc_node);
> 

-- 
Regards
--
Kieran
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 9/9] drm: rcar-du: Drop local encoder variable

2020-12-14 Thread Jacopo Mondi
Hi Laurent,
On Sat, Dec 05, 2020 at 12:01:39AM +0200, Laurent Pinchart wrote:

> The local encoder variable is an alias for >base, and is only use
> twice. It doesn't help much, drop it, along with the
> rcar_encoder_to_drm_encoder() macro that is then unused.
>
> Signed-off-by: Laurent Pinchart 

Reviewed-by: Jacopo Mondi 

Thanks
   j

> ---
>  drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 6 ++
>  drivers/gpu/drm/rcar-du/rcar_du_encoder.h | 2 --
>  2 files changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
> index 49c0b27e2f5a..9a565bd3380d 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
> @@ -61,7 +61,6 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
>struct device_node *enc_node)
>  {
>   struct rcar_du_encoder *renc;
> - struct drm_encoder *encoder;
>   struct drm_bridge *bridge;
>   int ret;
>
> @@ -108,12 +107,11 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
>
>   rcdu->encoders[output] = renc;
>   renc->output = output;
> - encoder = rcar_encoder_to_drm_encoder(renc);
>
>   dev_dbg(rcdu->dev, "initializing encoder %pOF for output %u\n",
>   enc_node, output);
>
> - ret = drm_encoder_init(>ddev, encoder, _du_encoder_funcs,
> + ret = drm_encoder_init(>ddev, >base, _du_encoder_funcs,
>  DRM_MODE_ENCODER_NONE, NULL);
>   if (ret < 0)
>   goto error;
> @@ -127,7 +125,7 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
>* Attach the bridge to the encoder. The bridge will create the
>* connector.
>*/
> - return drm_bridge_attach(encoder, bridge, NULL, 0);
> + return drm_bridge_attach(>base, bridge, NULL, 0);
>
>  error:
>   kfree(renc);
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.h 
> b/drivers/gpu/drm/rcar-du/rcar_du_encoder.h
> index df9be4524301..73560563fb31 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.h
> @@ -22,8 +22,6 @@ struct rcar_du_encoder {
>  #define to_rcar_encoder(e) \
>   container_of(e, struct rcar_du_encoder, base)
>
> -#define rcar_encoder_to_drm_encoder(e)   (&(e)->base)
> -
>  int rcar_du_encoder_init(struct rcar_du_device *rcdu,
>enum rcar_du_output output,
>struct device_node *enc_node);
> --
> Regards,
>
> Laurent Pinchart
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 9/9] drm: rcar-du: Drop local encoder variable

2020-12-04 Thread Laurent Pinchart
The local encoder variable is an alias for >base, and is only use
twice. It doesn't help much, drop it, along with the
rcar_encoder_to_drm_encoder() macro that is then unused.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 6 ++
 drivers/gpu/drm/rcar-du/rcar_du_encoder.h | 2 --
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c 
b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
index 49c0b27e2f5a..9a565bd3380d 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
@@ -61,7 +61,6 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
 struct device_node *enc_node)
 {
struct rcar_du_encoder *renc;
-   struct drm_encoder *encoder;
struct drm_bridge *bridge;
int ret;
 
@@ -108,12 +107,11 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
 
rcdu->encoders[output] = renc;
renc->output = output;
-   encoder = rcar_encoder_to_drm_encoder(renc);
 
dev_dbg(rcdu->dev, "initializing encoder %pOF for output %u\n",
enc_node, output);
 
-   ret = drm_encoder_init(>ddev, encoder, _du_encoder_funcs,
+   ret = drm_encoder_init(>ddev, >base, _du_encoder_funcs,
   DRM_MODE_ENCODER_NONE, NULL);
if (ret < 0)
goto error;
@@ -127,7 +125,7 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
 * Attach the bridge to the encoder. The bridge will create the
 * connector.
 */
-   return drm_bridge_attach(encoder, bridge, NULL, 0);
+   return drm_bridge_attach(>base, bridge, NULL, 0);
 
 error:
kfree(renc);
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.h 
b/drivers/gpu/drm/rcar-du/rcar_du_encoder.h
index df9be4524301..73560563fb31 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.h
@@ -22,8 +22,6 @@ struct rcar_du_encoder {
 #define to_rcar_encoder(e) \
container_of(e, struct rcar_du_encoder, base)
 
-#define rcar_encoder_to_drm_encoder(e) (&(e)->base)
-
 int rcar_du_encoder_init(struct rcar_du_device *rcdu,
 enum rcar_du_output output,
 struct device_node *enc_node);
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel