diff mbox series

[03/19] common: edid: check for digital display earlier

Message ID 20210223204631.1609597-4-jernej.skrabec@siol.net
State New
Delegated to: Andre Przywara
Headers show
Series video: sunxi: Rework DE2 driver | expand

Commit Message

Jernej Škrabec Feb. 23, 2021, 8:46 p.m. UTC
When searching for detailed timing in EDID, check for digital display
earlier. There is no point parsing other parameters if this flag is not
present.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
---
 common/edid.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Andre Przywara March 4, 2021, 1:41 a.m. UTC | #1
On Tue, 23 Feb 2021 21:46:15 +0100
Jernej Skrabec <jernej.skrabec@siol.net> wrote:

Hi,

> When searching for detailed timing in EDID, check for digital display
> earlier. There is no point parsing other parameters if this flag is not
> present.

Indeed we would exit anyway, so we should avoid unneeded work.
 
> Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre

> ---
>  common/edid.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/common/edid.c b/common/edid.c
> index 553ab8fd01a1..1cb7177742e8 100644
> --- a/common/edid.c
> +++ b/common/edid.c
> @@ -185,6 +185,11 @@ int edid_get_timing_validate(u8 *buf, int buf_size,
>  		return -EINVAL;
>  	}
>  
> +	if (!EDID1_INFO_VIDEO_INPUT_DIGITAL(*edid)) {
> +		debug("%s: Not a digital display\n", __func__);
> +		return -ENOSYS;
> +	}
> +
>  	if (!EDID1_INFO_FEATURE_PREFERRED_TIMING_MODE(*edid)) {
>  		debug("%s: No preferred timing\n", __func__);
>  		return -ENOENT;
> @@ -211,10 +216,6 @@ int edid_get_timing_validate(u8 *buf, int buf_size,
>  	if (!timing_done)
>  		return -EINVAL;
>  
> -	if (!EDID1_INFO_VIDEO_INPUT_DIGITAL(*edid)) {
> -		debug("%s: Not a digital display\n", __func__);
> -		return -ENOSYS;
> -	}
>  	if (edid->version != 1 || edid->revision < 4) {
>  		debug("%s: EDID version %d.%d does not have required info\n",
>  		      __func__, edid->version, edid->revision);
diff mbox series

Patch

diff --git a/common/edid.c b/common/edid.c
index 553ab8fd01a1..1cb7177742e8 100644
--- a/common/edid.c
+++ b/common/edid.c
@@ -185,6 +185,11 @@  int edid_get_timing_validate(u8 *buf, int buf_size,
 		return -EINVAL;
 	}
 
+	if (!EDID1_INFO_VIDEO_INPUT_DIGITAL(*edid)) {
+		debug("%s: Not a digital display\n", __func__);
+		return -ENOSYS;
+	}
+
 	if (!EDID1_INFO_FEATURE_PREFERRED_TIMING_MODE(*edid)) {
 		debug("%s: No preferred timing\n", __func__);
 		return -ENOENT;
@@ -211,10 +216,6 @@  int edid_get_timing_validate(u8 *buf, int buf_size,
 	if (!timing_done)
 		return -EINVAL;
 
-	if (!EDID1_INFO_VIDEO_INPUT_DIGITAL(*edid)) {
-		debug("%s: Not a digital display\n", __func__);
-		return -ENOSYS;
-	}
 	if (edid->version != 1 || edid->revision < 4) {
 		debug("%s: EDID version %d.%d does not have required info\n",
 		      __func__, edid->version, edid->revision);