]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/edid: make drm_edid_header_is_valid() accept void pointer
authorJani Nikula <jani.nikula@intel.com>
Thu, 31 Mar 2022 18:45:01 +0000 (21:45 +0300)
committerJani Nikula <jani.nikula@intel.com>
Fri, 1 Apr 2022 14:44:40 +0000 (17:44 +0300)
It will be useful to accept a struct edid *, but for compatibility with
existing usage accept void *.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/33fbe1615a3bd82112eaf4077bbb521793cbb91a.1648752228.git.jani.nikula@intel.com
drivers/gpu/drm/drm_edid.c
include/drm/drm_edid.h

index e50b1917df71356b41c48a4745cb2302d9f63c8e..28d47ba7b513a34789cc10cfb48b92e66f9d5f8d 100644 (file)
@@ -1580,13 +1580,15 @@ static const u8 edid_header[] = {
  *
  * Return: 8 if the header is perfect, down to 0 if it's totally wrong.
  */
-int drm_edid_header_is_valid(const u8 *raw_edid)
+int drm_edid_header_is_valid(const void *_edid)
 {
+       const struct edid *edid = _edid;
        int i, score = 0;
 
-       for (i = 0; i < sizeof(edid_header); i++)
-               if (raw_edid[i] == edid_header[i])
+       for (i = 0; i < sizeof(edid_header); i++) {
+               if (edid->header[i] == edid_header[i])
                        score++;
+       }
 
        return score;
 }
index 48b1bf9c315aead8c6ae78ff2685408082f098f6..b7e170584000bc115e1eb138b28a5f37245d9360 100644 (file)
@@ -578,7 +578,7 @@ int drm_add_modes_noedid(struct drm_connector *connector,
 void drm_set_preferred_mode(struct drm_connector *connector,
                            int hpref, int vpref);
 
-int drm_edid_header_is_valid(const u8 *raw_edid);
+int drm_edid_header_is_valid(const void *edid);
 bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid,
                          bool *edid_corrupt);
 bool drm_edid_is_valid(struct edid *edid);