[i-g-t,7/7] kms_flip: Standardize return value for fb_is_bound
diff mbox series

Message ID f721ca0d8367607136e076b1870c4cbcbecb8848.1551712108.git.rodrigosiqueiramelo@gmail.com
State New
Headers show
Series
  • kms_flip: cleanups
Related show

Commit Message

Rodrigo Siqueira March 4, 2019, 3:32 p.m. UTC
The function fb_is_bound() mix integer value with booleans for handling
the return value. This commit standardizes the return value of
fb_is_bound() for using only booleans.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 tests/kms_flip.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Maarten Lankhorst March 6, 2019, 11:25 a.m. UTC | #1
Op 04-03-2019 om 16:32 schreef Rodrigo Siqueira:
> The function fb_is_bound() mix integer value with booleans for handling
> the return value. This commit standardizes the return value of
> fb_is_bound() for using only booleans.
>
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> ---
>  tests/kms_flip.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/tests/kms_flip.c b/tests/kms_flip.c
> index de3ab600..abfdd363 100755
> --- a/tests/kms_flip.c
> +++ b/tests/kms_flip.c
> @@ -947,8 +947,7 @@ static void paint_flip_mode(struct igt_fb *fb, bool odd_frame)
>  	igt_put_cairo_ctx(drm_fd, fb, cr);
>  }
>  
> -static int
> -fb_is_bound(struct test_output *o, int fb)
> +static bool fb_is_bound(struct test_output *o, int fb)
>  {
>  	int n;
>  
> @@ -958,7 +957,7 @@ fb_is_bound(struct test_output *o, int fb)
>  		};
>  
>  		if (drmIoctl(drm_fd, DRM_IOCTL_MODE_GETCRTC, &mode))
> -			return 0;
> +			return false;
>  
>  		if (!mode.mode_valid || mode.fb_id != fb)
>  			return false;
>
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

Nice cleanup. Hope we can eventually convert kms_flip to igt_display at some point for readability.

For all except patch 4:

Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

:)
Rodrigo Siqueira March 6, 2019, 9:40 p.m. UTC | #2
On 03/06, Maarten Lankhorst wrote:
> Op 04-03-2019 om 16:32 schreef Rodrigo Siqueira:
> > The function fb_is_bound() mix integer value with booleans for handling
> > the return value. This commit standardizes the return value of
> > fb_is_bound() for using only booleans.
> >
> > Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> > ---
> >  tests/kms_flip.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/tests/kms_flip.c b/tests/kms_flip.c
> > index de3ab600..abfdd363 100755
> > --- a/tests/kms_flip.c
> > +++ b/tests/kms_flip.c
> > @@ -947,8 +947,7 @@ static void paint_flip_mode(struct igt_fb *fb, bool odd_frame)
> >  	igt_put_cairo_ctx(drm_fd, fb, cr);
> >  }
> >  
> > -static int
> > -fb_is_bound(struct test_output *o, int fb)
> > +static bool fb_is_bound(struct test_output *o, int fb)
> >  {
> >  	int n;
> >  
> > @@ -958,7 +957,7 @@ fb_is_bound(struct test_output *o, int fb)
> >  		};
> >  
> >  		if (drmIoctl(drm_fd, DRM_IOCTL_MODE_GETCRTC, &mode))
> > -			return 0;
> > +			return false;
> >  
> >  		if (!mode.mode_valid || mode.fb_id != fb)
> >  			return false;
> >
> > _______________________________________________
> > igt-dev mailing list
> > igt-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/igt-dev
> 
> Nice cleanup. Hope we can eventually convert kms_flip to igt_display at some point for readability.

Hi Petri and Maarten,

First of all, thanks for your review and the clarification in the patch
4 (I really missed the ret = 0, thanks for highlight this case :)

Maarten, could you give some extra details about the idea of converting
kms_flip to igt_display? Could you point out some links or code
reference? I'm just curious to know a little more about this subject.

Best Regards
Rodrigo Siqueira

> For all except patch 4:
> 
> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> 
> :)
>

Patch
diff mbox series

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index de3ab600..abfdd363 100755
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -947,8 +947,7 @@  static void paint_flip_mode(struct igt_fb *fb, bool odd_frame)
 	igt_put_cairo_ctx(drm_fd, fb, cr);
 }
 
-static int
-fb_is_bound(struct test_output *o, int fb)
+static bool fb_is_bound(struct test_output *o, int fb)
 {
 	int n;
 
@@ -958,7 +957,7 @@  fb_is_bound(struct test_output *o, int fb)
 		};
 
 		if (drmIoctl(drm_fd, DRM_IOCTL_MODE_GETCRTC, &mode))
-			return 0;
+			return false;
 
 		if (!mode.mode_valid || mode.fb_id != fb)
 			return false;