change some defines to static inline functions
authorjsg <jsg@openbsd.org>
Tue, 1 Mar 2022 08:07:38 +0000 (08:07 +0000)
committerjsg <jsg@openbsd.org>
Tue, 1 Mar 2022 08:07:38 +0000 (08:07 +0000)
sys/dev/pci/drm/amd/amdgpu/amdgpu.h
sys/dev/pci/drm/i915/i915_perf.c
sys/dev/pci/drm/i915/i915_perf_types.h
sys/dev/pci/drm/include/linux/ratelimit.h

index b30bfd0..9920036 100644 (file)
@@ -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;
 
index 772dd5e..101151a 100644 (file)
@@ -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);
index f3ca230..92d1a1d 100644 (file)
@@ -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
index a3991a0..b20215d 100644 (file)
@@ -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