diff options
author | Dave Airlie <airlied@redhat.com> | 2014-12-11 03:12:57 +0300 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2014-12-11 03:12:57 +0300 |
commit | da9df2f41057d71102668f5ac6b3fc998118a59b (patch) | |
tree | 8061b865d05043cf25263040ef86d4f54549ce25 /drivers/gpu/drm/drm_edid.c | |
parent | d1b8792b636f83804add26ec1ac90a686be19e49 (diff) | |
parent | a18c0af171bfb875012da26f23df051004726973 (diff) | |
download | linux-da9df2f41057d71102668f5ac6b3fc998118a59b.tar.xz |
Merge tag 'topic/core-stuff-2014-12-10' of git://anongit.freedesktop.org/drm-intel into drm-next
Merge drm core fixes from Daniel.
* tag 'topic/core-stuff-2014-12-10' of git://anongit.freedesktop.org/drm-intel:
drm: Zero out DRM object memory upon cleanup
drm: fix a typo in a comment
drm: fix a word repetition in a comment
drm: Fix memory leak at error path of drm_read()
drm/Documentation: Fix rowspan value in drm-kms-properties
drm/edid: Restore kerneldoc consistency
drm/edid: new drm_edid_block_checksum helper function V3
drm/edid: shorten log output in case of all zeroes edid block
drm/edid: move drm_edid_is_zero to top, make edid argument const
Diffstat (limited to 'drivers/gpu/drm/drm_edid.c')
-rw-r--r-- | drivers/gpu/drm/drm_edid.c | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 72fd8820e186..53bc7a628909 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1017,6 +1017,25 @@ MODULE_PARM_DESC(edid_fixup, static void drm_get_displayid(struct drm_connector *connector, struct edid *edid); + +static int drm_edid_block_checksum(const u8 *raw_edid) +{ + int i; + u8 csum = 0; + for (i = 0; i < EDID_LENGTH; i++) + csum += raw_edid[i]; + + return csum; +} + +static bool drm_edid_is_zero(const u8 *in_edid, int length) +{ + if (memchr_inv(in_edid, 0, length)) + return false; + + return true; +} + /** * drm_edid_block_valid - Sanity check the EDID block (base or extension) * @raw_edid: pointer to raw EDID block @@ -1030,8 +1049,7 @@ static void drm_get_displayid(struct drm_connector *connector, */ bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid) { - int i; - u8 csum = 0; + u8 csum; struct edid *edid = (struct edid *)raw_edid; if (WARN_ON(!raw_edid)) @@ -1051,8 +1069,7 @@ bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid) } } - for (i = 0; i < EDID_LENGTH; i++) - csum += raw_edid[i]; + csum = drm_edid_block_checksum(raw_edid); if (csum) { if (print_bad_edid) { DRM_ERROR("EDID checksum is invalid, remainder is %d\n", csum); @@ -1083,9 +1100,13 @@ bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid) bad: if (print_bad_edid) { - printk(KERN_ERR "Raw EDID:\n"); - print_hex_dump(KERN_ERR, " \t", DUMP_PREFIX_NONE, 16, 1, + if (drm_edid_is_zero(raw_edid, EDID_LENGTH)) { + printk(KERN_ERR "EDID block is all zeroes\n"); + } else { + printk(KERN_ERR "Raw EDID:\n"); + print_hex_dump(KERN_ERR, " \t", DUMP_PREFIX_NONE, 16, 1, raw_edid, EDID_LENGTH, false); + } } return false; } @@ -1118,7 +1139,7 @@ EXPORT_SYMBOL(drm_edid_is_valid); #define DDC_SEGMENT_ADDR 0x30 /** * drm_do_probe_ddc_edid() - get EDID information via I2C - * @adapter: I2C device adaptor + * @data: I2C device adapter * @buf: EDID data buffer to be filled * @block: 128 byte EDID block to start fetching from * @len: EDID data buffer length to fetch @@ -1179,14 +1200,6 @@ drm_do_probe_ddc_edid(void *data, u8 *buf, unsigned int block, size_t len) return ret == xfers ? 0 : -1; } -static bool drm_edid_is_zero(u8 *in_edid, int length) -{ - if (memchr_inv(in_edid, 0, length)) - return false; - - return true; -} - /** * drm_do_get_edid - get EDID data using a custom EDID block read function * @connector: connector we're probing |