[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABVgOSmPfxdcxuU6xtuT2sN75ivs+Atgmt=2PNcdWqnMcrnbEQ@mail.gmail.com>
Date: Tue, 21 Jun 2022 17:38:28 +0800
From: David Gow <davidgow@...gle.com>
To: José Expósito <jose.exposito89@...il.com>
Cc: Javier Martinez Canillas <javierm@...hat.com>,
Daniel Latypov <dlatypov@...gle.com>,
Thomas Zimmermann <tzimmermann@...e.de>,
maarten.lankhorst@...ux.intel.com,
Maxime Ripard <mripard@...nel.org>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Maíra Canal <maira.canal@....br>,
Isabella Basso <isabbasso@...eup.net>, magalilemes00@...il.com,
tales.aparecida@...il.com, dri-devel@...ts.freedesktop.org,
KUnit Development <kunit-dev@...glegroups.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Jani Nikula <jani.nikula@...el.com>
Subject: Re: [PATCH v4 1/3] drm/rect: Add DRM_RECT_INIT() macro
On Tue, Jun 21, 2022 at 12:06 AM José Expósito
<jose.exposito89@...il.com> wrote:
>
> Add a helper macro to initialize a rectangle from x, y, width and
> height information.
>
> Reviewed-by: Jani Nikula <jani.nikula@...el.com>
> Acked-by: Thomas Zimmermann <tzimmermann@...e.de>
> Signed-off-by: José Expósito <jose.exposito89@...il.com>
> ---
This looks good to me, though I have one minor concern about the macro
name. (But if it's okay with the DRM folks, which it seems to be, I
won't object.)
Either way,
Reviewed-by: David Gow <davidgow@...gle.com>
> include/drm/drm_rect.h | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
> index 6f6e19bd4dac..e8d94fca2703 100644
> --- a/include/drm/drm_rect.h
> +++ b/include/drm/drm_rect.h
> @@ -47,6 +47,22 @@ struct drm_rect {
> int x1, y1, x2, y2;
> };
>
> +/**
> + * DRM_RECT_INIT - initialize a rectangle from x/y/w/h
> + * @x: x coordinate
> + * @y: y coordinate
> + * @w: width
> + * @h: height
> + *
> + * RETURNS:
> + * A new rectangle of the specified size.
> + */
> +#define DRM_RECT_INIT(x, y, w, h) ((struct drm_rect){ \
> + .x1 = (x), \
> + .y1 = (y), \
> + .x2 = (x) + (w), \
> + .y2 = (y) + (h) })
> +
My only slight concern here is that it might be a little bit confusing
that a macro called DRM_RECT_INIT() accepts x/y/w/h, whereas the
actual struct drm_rect is x1/y1/x2/y2. If the macro were called
something like DRM_RECT_INIT_FROM_XYWH() or similar.
> /**
> * DRM_RECT_FMT - printf string for &struct drm_rect
> */
> --
> 2.25.1
>
Download attachment "smime.p7s" of type "application/pkcs7-signature" (4003 bytes)
Powered by blists - more mailing lists