From: Ahmad Fatoum <ahmad@a3f.at>
To: barebox@lists.infradead.org
Subject: [PATCH 2/4] video: edid: make edid_check_header externally visible
Date: Fri, 1 Jan 2021 23:52:26 +0100 [thread overview]
Message-ID: <20210101225228.2166084-2-ahmad@a3f.at> (raw)
In-Reply-To: <20210101225228.2166084-1-ahmad@a3f.at>
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@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
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2021-01-01 22:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-01 22:52 [PATCH 1/4] video: edid: make accessible without i2c Ahmad Fatoum
2021-01-01 22:52 ` Ahmad Fatoum [this message]
2021-01-01 22:52 ` [PATCH 3/4] video: implement bochs dispi / QEMU VGA driver for PCI and ISA Ahmad Fatoum
2021-01-02 11:10 ` [PATCH] fixup! " Ahmad Fatoum
2021-01-05 12:19 ` [PATCH 3/4] " Sascha Hauer
2021-01-01 22:52 ` [PATCH 4/4] MIPS: qemu-malta_defconfig: enable VGA output Ahmad Fatoum
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=20210101225228.2166084-2-ahmad@a3f.at \
--to=ahmad@a3f.at \
--cc=barebox@lists.infradead.org \
/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