dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 01/12] drm/edid: use struct edid * in drm_do_get_edid()
Date: Thu, 31 Mar 2022 00:01:56 +0300	[thread overview]
Message-ID: <874k3fb1dn.fsf@intel.com> (raw)
In-Reply-To: <87r16jbhdq.fsf@intel.com>

On Wed, 30 Mar 2022, Jani Nikula <jani.nikula@intel.com> wrote:
> On Wed, 30 Mar 2022, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
>> This one points to extension blocks too so using 
>> struct edid doesn't seem entirely appropriate.
>
> So I've gone back and forth with this. I think I want to get rid of u8*
> no matter what, because it always requires casting. I've used void* here
> and there to allow mixed use, internally in drm_edid.c while
> transitioning, and in public interfaces due to usage all over the place.
>
> OTOH I don't much like arithmetics on void*. It's a gcc extension.
>
> struct edid * is useful for e.g. ->checksum and arithmetics. In many
> places I've named it struct edid *block to distinguish. We could have a
> struct edid_block too, which could have ->tag and ->checksum members,
> for example, but then it would require casting or a function for "safe"
> typecasting.
>
> I've also gone back and forth with the helpers for getting a pointer to
> a block. For usage like this, kind of need both const and non-const
> versions. And, with the plans I have for future, I'm not sure I want to
> promote any EDID parsing outside of drm_edid.c, so maybe they should be
> static.
>
> Undecided. C is a bit clunky here.

Hmm. I wonder how a flexible array member would pan out.

struct edid_extension {
	u8 tag;
        u8 revision;
        u8 data[EDID_LENGTH - 3];
        u8 checksum;
} __packed;

struct edid {
	/* existing stuff*/
        struct edid_extension extensions[];
} __packed;


BR,
Jani.

-- 
Jani Nikula, Intel Open Source Graphics Center

  parent reply	other threads:[~2022-03-30 21:02 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-29 18:42 [PATCH 00/12] drm/edid: cleanup and refactoring around validity checks Jani Nikula
2022-03-29 18:42 ` [PATCH 01/12] drm/edid: use struct edid * in drm_do_get_edid() Jani Nikula
2022-03-30 13:05   ` Ville Syrjälä
2022-03-30 15:16     ` Jani Nikula
2022-03-30 15:39       ` Ville Syrjälä
2022-03-30 16:28         ` Jani Nikula
2022-03-30 16:50           ` Ville Syrjälä
2022-03-30 17:09             ` [Intel-gfx] " Jani Nikula
2022-03-30 21:01       ` Jani Nikula [this message]
2022-03-31 18:46     ` Jani Nikula
2022-03-29 18:42 ` [PATCH 02/12] drm/edid: clean up EDID block checksum functions Jani Nikula
2022-03-29 18:42 ` [PATCH 03/12] drm/edid: add edid_block_tag() helper to get the EDID extension tag Jani Nikula
2022-03-29 18:42 ` [PATCH 04/12] drm/edid: make drm_edid_header_is_valid() accept void pointer Jani Nikula
2022-03-29 18:42 ` [PATCH 05/12] drm/edid: clean up edid_is_zero() Jani Nikula
2022-03-29 18:42 ` [PATCH 06/12] drm/edid: split out edid_header_fix() Jani Nikula
2022-03-29 18:42 ` [PATCH 07/12] drm/edid: split drm_edid_block_valid() to check and act parts Jani Nikula
2022-03-31 14:54   ` Ville Syrjälä
2022-03-31 15:54     ` Jani Nikula
2022-03-31 16:49     ` Jani Nikula
2022-03-31 16:58       ` Ville Syrjälä
2022-03-29 18:42 ` [PATCH 08/12] drm/edid: use a better variable name for EDID block read retries Jani Nikula
2022-03-31 14:55   ` Ville Syrjälä
2022-03-29 18:42 ` [PATCH 09/12] drm/edid: simplify block check when filtering invalid blocks Jani Nikula
2022-03-29 18:42 ` [PATCH 10/12] drm/edid: split out invalid block filtering to a separate function Jani Nikula
2022-03-29 18:42 ` [PATCH 11/12] drm/edid: track invalid blocks in drm_do_get_edid() Jani Nikula
2022-03-29 18:42 ` [PATCH 12/12] drm/edid: reduce magic when updating the EDID block checksum Jani Nikula
2022-03-31 14:59   ` Ville Syrjälä
2022-03-31 17:07 ` [PATCH 00/12] drm/edid: cleanup and refactoring around validity checks Ville Syrjälä

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=874k3fb1dn.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.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;
as well as URLs for NNTP newsgroup(s).