OSDN Git Service

drm/edid: Fix EDID quirk compile error on older compilers
authorDouglas Anderson <dianders@chromium.org>
Fri, 24 Sep 2021 14:53:21 +0000 (07:53 -0700)
committerDouglas Anderson <dianders@chromium.org>
Fri, 24 Sep 2021 21:56:36 +0000 (14:56 -0700)
commit7d1be0a09fa62139f1a29ccbe6d46aa04616539b
tree38f388418fdeececdafd8a2e6b855ae03a4bdb27
parentebe180d376a5f7b2e534b69d237aa6fab43008ee
drm/edid: Fix EDID quirk compile error on older compilers

Apparently some compilers [1] cannot handle doing math on dereferenced
string constants at compile time. This has led to reports [2] of
compile errors like:

  In file included from drivers/gpu/drm/drm_edid.c:42:0:
  ./include/drm/drm_edid.h:525:2: error: initializer element is not constant
    ((((u32)((vend)[0]) - '@') & 0x1f) << 26 | \

Go back to the syntax I used in v4 of the patch series [3] that added
this code instead of what landed (v5). This syntax is slightly uglier
but should be much more compatible with varied compilers.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69960#c18
[2] https://lore.kernel.org/r/874kaabdt5.fsf@intel.com/
[3] https://lore.kernel.org/r/20210909135838.v4.4.I6103ce2b16e5e5a842b14c7022a034712b434609@changeid/

Fixes: d9f91a10c3e8 ("drm/edid: Allow querying/working with the panel ID from the EDID")
Reported-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Reported-by: Srikanth Myakam <smyakam@microsoft.com>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210924075317.1.I1e58d74d501613f1fe7585958f451160d11b8a98@changeid
drivers/gpu/drm/drm_edid.c
drivers/gpu/drm/panel/panel-edp.c
include/drm/drm_edid.h