diff mbox series

drm/udl: Convert to drm_crtc_helper_atomic_check()

Message ID 336040bba05b019d629551b350b15bad2df2ba96.1687425928.git.geert+renesas@glider.be (mailing list archive)
State New, archived
Headers show
Series drm/udl: Convert to drm_crtc_helper_atomic_check() | expand

Commit Message

Geert Uytterhoeven June 22, 2023, 9:27 a.m. UTC
Use the drm_crtc_helper_atomic_check() helper instead of open-coding the
same operation.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Compile-tested only.
---
 drivers/gpu/drm/udl/udl_modeset.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

Comments

Thomas Zimmermann June 26, 2023, 8:06 a.m. UTC | #1
Am 22.06.23 um 11:27 schrieb Geert Uytterhoeven:
> Use the drm_crtc_helper_atomic_check() helper instead of open-coding the
> same operation.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
> Compile-tested only.
> ---
>   drivers/gpu/drm/udl/udl_modeset.c | 13 ++-----------
>   1 file changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/udl/udl_modeset.c b/drivers/gpu/drm/udl/udl_modeset.c
> index aa02fd2789c3f885..40876bcdd79a47ac 100644
> --- a/drivers/gpu/drm/udl/udl_modeset.c
> +++ b/drivers/gpu/drm/udl/udl_modeset.c
> @@ -12,6 +12,7 @@
>   
>   #include <drm/drm_atomic.h>
>   #include <drm/drm_atomic_helper.h>
> +#include <drm/drm_crtc_helper.h>
>   #include <drm/drm_damage_helper.h>
>   #include <drm/drm_drv.h>
>   #include <drm/drm_edid.h>
> @@ -310,16 +311,6 @@ static const struct drm_plane_funcs udl_primary_plane_funcs = {
>    * CRTC
>    */
>   
> -static int udl_crtc_helper_atomic_check(struct drm_crtc *crtc, struct drm_atomic_state *state)
> -{
> -	struct drm_crtc_state *new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
> -
> -	if (!new_crtc_state->enable)
> -		return 0;
> -
> -	return drm_atomic_helper_check_crtc_primary_plane(new_crtc_state);
> -}
> -
>   static void udl_crtc_helper_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_state *state)
>   {
>   	struct drm_device *dev = crtc->dev;
> @@ -381,7 +372,7 @@ static void udl_crtc_helper_atomic_disable(struct drm_crtc *crtc, struct drm_ato
>   }
>   
>   static const struct drm_crtc_helper_funcs udl_crtc_helper_funcs = {
> -	.atomic_check = udl_crtc_helper_atomic_check,
> +	.atomic_check = drm_crtc_helper_atomic_check,
>   	.atomic_enable = udl_crtc_helper_atomic_enable,
>   	.atomic_disable = udl_crtc_helper_atomic_disable,
>   };
Sui Jingfeng June 28, 2023, 1:30 a.m. UTC | #2
Hi,

Yeah, the net result is same.


On 2023/6/22 17:27, Geert Uytterhoeven wrote:
> Use the drm_crtc_helper_atomic_check() helper instead of open-coding the
> same operation.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn>

> ---
> Compile-tested only.
> ---
>   drivers/gpu/drm/udl/udl_modeset.c | 13 ++-----------
>   1 file changed, 2 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/udl/udl_modeset.c b/drivers/gpu/drm/udl/udl_modeset.c
> index aa02fd2789c3f885..40876bcdd79a47ac 100644
> --- a/drivers/gpu/drm/udl/udl_modeset.c
> +++ b/drivers/gpu/drm/udl/udl_modeset.c
> @@ -12,6 +12,7 @@
>   
>   #include <drm/drm_atomic.h>
>   #include <drm/drm_atomic_helper.h>
> +#include <drm/drm_crtc_helper.h>
>   #include <drm/drm_damage_helper.h>
>   #include <drm/drm_drv.h>
>   #include <drm/drm_edid.h>
> @@ -310,16 +311,6 @@ static const struct drm_plane_funcs udl_primary_plane_funcs = {
>    * CRTC
>    */
>   
> -static int udl_crtc_helper_atomic_check(struct drm_crtc *crtc, struct drm_atomic_state *state)
> -{
> -	struct drm_crtc_state *new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
> -
> -	if (!new_crtc_state->enable)
> -		return 0;
> -
> -	return drm_atomic_helper_check_crtc_primary_plane(new_crtc_state);
> -}
> -
>   static void udl_crtc_helper_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_state *state)
>   {
>   	struct drm_device *dev = crtc->dev;
> @@ -381,7 +372,7 @@ static void udl_crtc_helper_atomic_disable(struct drm_crtc *crtc, struct drm_ato
>   }
>   
>   static const struct drm_crtc_helper_funcs udl_crtc_helper_funcs = {
> -	.atomic_check = udl_crtc_helper_atomic_check,
> +	.atomic_check = drm_crtc_helper_atomic_check,
>   	.atomic_enable = udl_crtc_helper_atomic_enable,
>   	.atomic_disable = udl_crtc_helper_atomic_disable,
>   };
diff mbox series

Patch

diff --git a/drivers/gpu/drm/udl/udl_modeset.c b/drivers/gpu/drm/udl/udl_modeset.c
index aa02fd2789c3f885..40876bcdd79a47ac 100644
--- a/drivers/gpu/drm/udl/udl_modeset.c
+++ b/drivers/gpu/drm/udl/udl_modeset.c
@@ -12,6 +12,7 @@ 
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
+#include <drm/drm_crtc_helper.h>
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_edid.h>
@@ -310,16 +311,6 @@  static const struct drm_plane_funcs udl_primary_plane_funcs = {
  * CRTC
  */
 
-static int udl_crtc_helper_atomic_check(struct drm_crtc *crtc, struct drm_atomic_state *state)
-{
-	struct drm_crtc_state *new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
-
-	if (!new_crtc_state->enable)
-		return 0;
-
-	return drm_atomic_helper_check_crtc_primary_plane(new_crtc_state);
-}
-
 static void udl_crtc_helper_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_state *state)
 {
 	struct drm_device *dev = crtc->dev;
@@ -381,7 +372,7 @@  static void udl_crtc_helper_atomic_disable(struct drm_crtc *crtc, struct drm_ato
 }
 
 static const struct drm_crtc_helper_funcs udl_crtc_helper_funcs = {
-	.atomic_check = udl_crtc_helper_atomic_check,
+	.atomic_check = drm_crtc_helper_atomic_check,
 	.atomic_enable = udl_crtc_helper_atomic_enable,
 	.atomic_disable = udl_crtc_helper_atomic_disable,
 };