Quoting Dmitry Baryshkov (2023-04-10 15:38:36) > The commit 010c8bbad2cb ("drm: msm: adreno: Disable preemption on Adreno > 510") tried to check GPU's revn before revn being set. Add WARN_ON_ONCE > to prevent such bugs from happening again. A separate helper is > necessary so that the warning is displayed really just once instead of > being displayed for each of comparisons. > > Suggested-by: Stephen Boyd <swboyd@xxxxxxxxxxxx> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx> > --- > drivers/gpu/drm/msm/adreno/adreno_gpu.h | 63 ++++++++++++++++--------- > 1 file changed, 40 insertions(+), 23 deletions(-) > > diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.h b/drivers/gpu/drm/msm/adreno/adreno_gpu.h > index f62612a5c70f..47e21d44ac24 100644 > --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.h > +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.h > @@ -145,40 +145,51 @@ struct adreno_platform_config { > > bool adreno_cmp_rev(struct adreno_rev rev1, struct adreno_rev rev2); > > +static inline bool adreno_cmp_revn(struct adreno_gpu *gpu, uint32_t revn) 'cmp' in the name makes me think it's comparing. Maybe 'is' is better because we're testing for equality. adreno_is_revn() Also 'const struct adreno_gpu *' because it isn't changing? > +{ > + WARN_ON_ONCE(!gpu->revn); > + > + return gpu->revn == revn; > +} > + > static inline bool adreno_is_a2xx(struct adreno_gpu *gpu) And then these can all be const in a followup patch probably.