public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Andi Shyti <andi.shyti@intel.com>
To: Simon Ser <simon.ser@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 1/2] igt_eld: add igt_is_igt
Date: Thu, 12 Sep 2019 18:01:51 +0300	[thread overview]
Message-ID: <20190912150151.GA3832@intel.intel> (raw)
In-Reply-To: <20190912102815.32663-1-simon.ser@intel.com>

Hi Simon,

> +/** eld_is_igt: check whether the ELD blob comes from an IGT EDID */
> +bool eld_is_igt(const char *eld, size_t eld_size)
> +{
> +	char name[17];
> +	int name_size;
> +
> +	igt_assert_f(eld_size >= 20 && eld_size <= 256,
> +		     "Invalid ELD size: %zu\n", eld_size);
> +
> +	name_size = eld[4] & 0x1F;
> +	igt_assert_f(name_size <= 16 && 20 + name_size <= eld_size,
> +		     "Invalid monitor name size in ELD: %d\n", name_size);
> +	if (name_size == 0) {
> +		igt_debug("ELD doesn't contain a monitor name\n");
> +		return false;
> +	}
> +
> +	memcpy(name, &eld[20], name_size);

17/20/256/4/0x1f/16/20/20 too many constants and no comments.
Overdefining constants is not nice, but then you need to explain
them.

Andi
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-09-12 15:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-12 10:28 [igt-dev] [PATCH i-g-t 1/2] igt_eld: add igt_is_igt Simon Ser
2019-09-12 10:28 ` [igt-dev] [PATCH i-g-t 2/2] lib/igt_alsa: check ELD comes from IGT Simon Ser
2019-09-12 10:53 ` [igt-dev] [PATCH i-g-t 1/2] igt_eld: add igt_is_igt Chris Wilson
2019-09-12 11:41 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] " Patchwork
2019-09-12 15:01 ` Andi Shyti [this message]
2019-09-12 15:44 ` [igt-dev] [PATCH i-g-t v2] " Simon Ser
2019-09-13 11:08   ` Ser, Simon
2019-09-12 16:37 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2] igt_eld: add igt_is_igt (rev2) Patchwork
2019-09-12 20:11 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/2] igt_eld: add igt_is_igt Patchwork
2019-09-13  5:39 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,v2] igt_eld: add igt_is_igt (rev2) Patchwork

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=20190912150151.GA3832@intel.intel \
    --to=andi.shyti@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=simon.ser@intel.com \
    /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