All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <jdelvare@suse.de>
To: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/edid: Have cea_db_offsets() zero start/end when the data block collection isn't found
Date: Tue, 10 Sep 2019 11:46:20 +0200	[thread overview]
Message-ID: <20190910114620.78a774a1@endymion> (raw)
In-Reply-To: <20190902131546.4691-2-ville.syrjala@linux.intel.com>

Hi Ville,

On Mon,  2 Sep 2019 16:15:46 +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Let's make cea_db_offsets() a bit more convenient to use by
> setting the start/end offsets to zero whenever the data block
> collection isn't present. This makes it safe for the caller
> to blindly iterate the data blocks even if there are none.
> 
> Cc: Jean Delvare <jdelvare@suse.de>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_edid.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 7b3072fc550b..e5905dc764c1 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -3690,6 +3690,9 @@ cea_revision(const u8 *cea)
>  static int
>  cea_db_offsets(const u8 *cea, int *start, int *end)
>  {
> +	*start = 0;
> +	*end = 0;
> +
>  	if (cea_revision(cea) < 3)
>  		return -ENOTSUPP;
>  
> @@ -4116,10 +4119,7 @@ static void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
>  	if (cea_revision(cea) >= 3) {
>  		int i, start, end;
>  
> -		if (cea_db_offsets(cea, &start, &end)) {
> -			start = 0;
> -			end = 0;
> -		}
> +		cea_db_offsets(cea, &start, &end);
>  
>  		for_each_cea_db(cea, i, start, end) {
>  			db = &cea[i];

Not sure if that's really needed. As it stands there's only one
function which wants to continue after cea_db_offsets() fails, all
others just bail out at that point. Now that cea_db_offsets() checks
for revision >= 3, the construct above could simply become:

	int i, start, end;

	if (cea_db_offsets(cea, &start, &end) == 0) {
		for_each_cea_db(cea, i, start, end) {
			db = &cea[i];

which is IMHO more elegant and does not require zeroing start and end
in cea_db_offsets().

-- 
Jean Delvare
SUSE L3 Support
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-09-10  9:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-02 13:15 [PATCH 1/2] drm/edid: Don't look for CEA data blocks in CEA ext block rev < 3 Ville Syrjala
2019-09-02 13:15 ` [PATCH 2/2] drm/edid: Have cea_db_offsets() zero start/end when the data block collection isn't found Ville Syrjala
2019-09-10  9:46   ` Jean Delvare [this message]
2019-09-10  9:48     ` Ville Syrjälä
2019-09-10 10:08       ` Jean Delvare
2019-09-02 14:42 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/edid: Don't look for CEA data blocks in CEA ext block rev < 3 Patchwork
2019-09-02 16:02 ` ✓ Fi.CI.IGT: " Patchwork
2019-09-10  9:40 ` [PATCH 1/2] " Jean Delvare

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=20190910114620.78a774a1@endymion \
    --to=jdelvare@suse.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.