[PATCH 2/4] video: edid: make edid_check_header externally visible

Ahmad Fatoum ahmad at a3f.at
Fri Jan 1 17:52:26 EST 2021


For non-i2c EDID use, drivers will want to verify the EDID header. We
already have a function for this, but internal linkage. Change this and
while at it change the type to a more appropriate type.

Signed-off-by: Ahmad Fatoum <ahmad at a3f.at>
---
 drivers/video/edid.c |  8 ++++----
 drivers/video/edid.h | 10 ++++++++++
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/video/edid.c b/drivers/video/edid.c
index 41d40d0297b6..1baff7317b7c 100644
--- a/drivers/video/edid.c
+++ b/drivers/video/edid.c
@@ -223,19 +223,19 @@ static int edid_checksum(unsigned char *edid)
 	return err;
 }
 
-static int edid_check_header(unsigned char *edid)
+bool edid_check_header(unsigned char *edid)
 {
-	int i, err = 1, fix = check_edid(edid);
+	int i, fix = check_edid(edid);
 
 	if (fix)
 		fix_edid(edid, fix);
 
 	for (i = 0; i < 8; i++) {
 		if (edid[i] != edid_v1_header[i])
-			err = 0;
+			return false;
 	}
 
-	return err;
+	return true;
 }
 
 /*
diff --git a/drivers/video/edid.h b/drivers/video/edid.h
index 006d9f283450..60c5b6422ea5 100644
--- a/drivers/video/edid.h
+++ b/drivers/video/edid.h
@@ -135,4 +135,14 @@
 #define DPMS_SUSPEND		(1 << 6)
 #define DPMS_STANDBY		(1 << 7)
 
+/**
+ * edid_check_header - sanity check the header of the base EDID block
+ * @raw_edid: pointer to raw base EDID block
+ *
+ * Sanity check the header of the base EDID block.
+ *
+ * Return: true if the header is perfect, false if any byte is wrong.
+ */
+bool edid_check_header(unsigned char *edid);
+
 #endif /* __EDID_H__ */
-- 
2.29.2




More information about the barebox mailing list