drm/i915: Mark check_shadow_context_ppgtt as maybe unused
authorNathan Chancellor <natechancellor@gmail.com>
Sat, 16 May 2020 02:35:45 +0000 (19:35 -0700)
committerZhenyu Wang <zhenyuw@linux.intel.com>
Tue, 19 May 2020 09:17:56 +0000 (17:17 +0800)
commit116788689bf8ca3c3337d8dd1a742c08342d2f62
tree42337b72f2ee9da66f2f43a1219835f1035bd766
parent3a36aa237e4ed04553c0998cf5f47eda3e206e4f
drm/i915: Mark check_shadow_context_ppgtt as maybe unused

When CONFIG_DRM_I915_DEBUG_GEM is not set, clang warns:

drivers/gpu/drm/i915/gvt/scheduler.c:884:1: warning: function
'check_shadow_context_ppgtt' is not needed and will not be emitted
[-Wunneeded-internal-declaration]
check_shadow_context_ppgtt(struct execlist_ring_context *c, struct
intel_vgpu_mm *m)
^
1 warning generated.

This warning is similar to -Wunused-function but rather than warning
that the function is completely unused, it warns that it is used in some
expression within the file but that expression will be evaluated to a
constant or be optimized away in the final assembly, essentially making
it appeared used but really isn't. Usually, this happens when a function
or variable is only used in sizeof, where it will appear to be used but
will be evaluated at compile time and not be required to be emitted.

In this case, the function is only used in GEM_BUG_ON, which is defined
as BUILD_BUG_ON_INVALID, which intentionally follows this pattern. To
fix this warning, add __maybe_unused to make it clear that this is
intentional depending on the configuration.

Fixes: bec3df930fbd ("drm/i915/gvt: Support PPGTT table load command")
Link: https://github.com/ClangBuiltLinux/linux/issues/1027
Acked-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200516023545.3332334-1-natechancellor@gmail.com
drivers/gpu/drm/i915/gvt/scheduler.c