public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: "José Expósito" <jose.exposito89@gmail.com>, javierm@redhat.com
Cc: davidgow@google.com, airlied@linux.ie, dlatypov@google.com,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	tzimmermann@suse.de, "José Expósito" <jose.exposito89@gmail.com>,
	kunit-dev@googlegroups.com
Subject: Re: [PATCH v2 1/3] drm/rect: Add DRM_RECT_INIT() macro
Date: Mon, 13 Jun 2022 10:53:57 +0300	[thread overview]
Message-ID: <87pmjdyp62.fsf@intel.com> (raw)
In-Reply-To: <20220612161248.271590-2-jose.exposito89@gmail.com>

On Sun, 12 Jun 2022, José Expósito <jose.exposito89@gmail.com> wrote:
> Add a helper macro to initialize a rectangle from x, y, width and
> height information.
>
> Signed-off-by: José Expósito <jose.exposito89@gmail.com>
> ---
>  include/drm/drm_rect.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
> index 6f6e19bd4dac..945696323c69 100644
> --- a/include/drm/drm_rect.h
> +++ b/include/drm/drm_rect.h
> @@ -47,6 +47,18 @@ 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) { (x), (y), (x) + (w), (y) + (h) }

Please use designated initializers.

It might help type safety if it also contained a (struct drm_rect) cast.

BR,
Jani.


> +
>  /**
>   * DRM_RECT_FMT - printf string for &struct drm_rect
>   */

-- 
Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2022-06-13  7:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-12 16:12 [PATCH v2 0/3] KUnit tests for drm_format_helper José Expósito
2022-06-12 16:12 ` [PATCH v2 1/3] drm/rect: Add DRM_RECT_INIT() macro José Expósito
2022-06-13  7:53   ` Jani Nikula [this message]
2022-06-13 17:19     ` José Expósito
2022-06-12 16:12 ` [PATCH v2 2/3] drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_rgb332() José Expósito
2022-06-12 16:12 ` [PATCH v2 3/3] drm/doc: Add KUnit documentation José Expósito

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pmjdyp62.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=davidgow@google.com \
    --cc=dlatypov@google.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=jose.exposito89@gmail.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox