From 0473d5270608bbe6b46489bc5e0b80ca609b5c24 Mon Sep 17 00:00:00 2001 From: jsg Date: Tue, 1 Mar 2022 08:07:38 +0000 Subject: [PATCH] change some defines to static inline functions --- sys/dev/pci/drm/amd/amdgpu/amdgpu.h | 2 -- sys/dev/pci/drm/i915/i915_perf.c | 2 -- sys/dev/pci/drm/i915/i915_perf_types.h | 2 -- sys/dev/pci/drm/include/linux/ratelimit.h | 21 +++++++++++++++++---- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu.h b/sys/dev/pci/drm/amd/amdgpu/amdgpu.h index b30bfd04a79..9920036a7d6 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu.h +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu.h @@ -1111,9 +1111,7 @@ struct amdgpu_device { char serial[20]; atomic_t throttling_logging_enabled; -#ifdef notyet struct ratelimit_state throttling_logging_rs; -#endif uint32_t ras_hw_enabled; uint32_t ras_enabled; diff --git a/sys/dev/pci/drm/i915/i915_perf.c b/sys/dev/pci/drm/i915/i915_perf.c index 772dd5e5e35..101151a8afb 100644 --- a/sys/dev/pci/drm/i915/i915_perf.c +++ b/sys/dev/pci/drm/i915/i915_perf.c @@ -4507,7 +4507,6 @@ void i915_perf_init(struct drm_i915_private *i915) * * Using the same limiting factors as printk_ratelimit() */ -#ifdef notyet ratelimit_state_init(&perf->spurious_report_rs, 5 * HZ, 10); /* Since we use a DRM_NOTE for spurious reports it would be * inconsistent to let __ratelimit() automatically print a @@ -4515,7 +4514,6 @@ void i915_perf_init(struct drm_i915_private *i915) */ ratelimit_set_flags(&perf->spurious_report_rs, RATELIMIT_MSG_ON_RELEASE); -#endif ratelimit_state_init(&perf->tail_pointer_race, 5 * HZ, 10); diff --git a/sys/dev/pci/drm/i915/i915_perf_types.h b/sys/dev/pci/drm/i915/i915_perf_types.h index f3ca2303396..92d1a1ded8d 100644 --- a/sys/dev/pci/drm/i915/i915_perf_types.h +++ b/sys/dev/pci/drm/i915/i915_perf_types.h @@ -422,9 +422,7 @@ struct i915_perf { * For rate limiting any notifications of spurious * invalid OA reports */ -#ifdef notyet struct ratelimit_state spurious_report_rs; -#endif /** * For rate limiting any notifications of tail pointer diff --git a/sys/dev/pci/drm/include/linux/ratelimit.h b/sys/dev/pci/drm/include/linux/ratelimit.h index a3991a06e6f..b20215dda14 100644 --- a/sys/dev/pci/drm/include/linux/ratelimit.h +++ b/sys/dev/pci/drm/include/linux/ratelimit.h @@ -7,11 +7,24 @@ struct ratelimit_state { }; #define DEFINE_RATELIMIT_STATE(name, interval, burst) \ - int name __used = 1; + struct ratelimit_state name -#define __ratelimit(x) (1) +#define RATELIMIT_MSG_ON_RELEASE (1 << 0) -#define ratelimit_state_init(x, y, z) -#define ratelimit_set_flags(x, y) +static inline int +__ratelimit(struct ratelimit_state *rs) +{ + return 1; +} + +static inline void +ratelimit_state_init(struct ratelimit_state *rs, int interval, int burst) +{ +} + +static inline void +ratelimit_set_flags(struct ratelimit_state *rs, unsigned long flags) +{ +} #endif -- 2.20.1