UPSTREAM: drm/edid: index CEA/HDMI mode tables using the VIC
authorJani Nikula <jani.nikula@intel.com>
Fri, 8 Jan 2016 11:21:51 +0000 (13:21 +0200)
committerZheng Yang <zhengyang@rock-chips.com>
Fri, 3 Mar 2017 03:40:07 +0000 (11:40 +0800)
commit4ccad8a3ec7dce7e95b5dc6f6bd121fc164d46f1
treec3ee644d8bf0dac5c89a2c4c2da6d693be62fe2c
parente00b29d81b9d06f0af1f9d8fa5776a5353f5dbf4
UPSTREAM: drm/edid: index CEA/HDMI mode tables using the VIC

Add a dummy entry to CEA/HDMI mode tables so they can be indexed
directly using the VIC, avoiding a +1/-1 dance here and there. This adds
clarity to the error checking for various functions that return the VIC
on success and zero on failure; we can now explicitly check for 0
instead of just subtracting one from an unsigned type.

Also add drm_valid_cea_vic() and drm_valid_hdmi_vic() helpers for
checking valid VICs.

v2: add drm_valid_cea_vic and drm_valid_hdmi_vic helpers (Ville)
    use { } instead of { 0 } for initializing the dummy modes

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452252111-6439-1-git-send-email-jani.nikula@intel.com
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Change-Id: Id47deb7a806b896c047317ca8924ef73abb01095
(cherry picked from commit d9278b4c2c31603474eec19d9ea1dea6b3a81087)
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
drivers/gpu/drm/drm_edid.c