Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/i915/wakeref: clean up INTEL_WAKEREF_PUT_* flag macros

Commit 469c1c9eb6c9 ("kernel-doc: Issue warnings that were silently
discarded") started emitting warnings for cases that were previously
silently discarded. One such case is in intel_wakeref.h:

Warning: drivers/gpu/drm/i915/intel_wakeref.h:156 expecting prototype
for __intel_wakeref_put(). Prototype was for INTEL_WAKEREF_PUT_ASYNC()
instead

Arguably kernel-doc should be able to handle this, as it's valid C, but
having the flags defined between the function declarator and the body is
just asking for trouble. Move the INTEL_WAKEREF_PUT_* macros away from
there, making kernel-doc's life easier.

While at it, reduce the unnecessary abstraction levels by removing the
enum, and append _MASK to INTEL_WAKEREF_PUT_DELAY for clarity.

Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://patch.msgid.link/20251215120908.3515578-1-jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>

+6 -10
+1 -1
drivers/gpu/drm/i915/intel_wakeref.c
··· 80 80 /* Assume we are not in process context and so cannot sleep. */ 81 81 if (flags & INTEL_WAKEREF_PUT_ASYNC || !mutex_trylock(&wf->mutex)) { 82 82 mod_delayed_work(wf->i915->unordered_wq, &wf->work, 83 - FIELD_GET(INTEL_WAKEREF_PUT_DELAY, flags)); 83 + FIELD_GET(INTEL_WAKEREF_PUT_DELAY_MASK, flags)); 84 84 return; 85 85 } 86 86
+5 -9
drivers/gpu/drm/i915/intel_wakeref.h
··· 128 128 return atomic_inc_not_zero(&wf->count); 129 129 } 130 130 131 - enum { 132 - INTEL_WAKEREF_PUT_ASYNC_BIT = 0, 133 - __INTEL_WAKEREF_PUT_LAST_BIT__ 134 - }; 135 - 136 131 static inline void 137 132 intel_wakeref_might_get(struct intel_wakeref *wf) 138 133 { 139 134 might_lock(&wf->mutex); 140 135 } 136 + 137 + /* flags for __intel_wakeref_put() and __intel_wakeref_put_last */ 138 + #define INTEL_WAKEREF_PUT_ASYNC BIT(0) 139 + #define INTEL_WAKEREF_PUT_DELAY_MASK GENMASK(BITS_PER_LONG - 1, 1) 141 140 142 141 /** 143 142 * __intel_wakeref_put: Release the wakeref ··· 153 154 */ 154 155 static inline void 155 156 __intel_wakeref_put(struct intel_wakeref *wf, unsigned long flags) 156 - #define INTEL_WAKEREF_PUT_ASYNC BIT(INTEL_WAKEREF_PUT_ASYNC_BIT) 157 - #define INTEL_WAKEREF_PUT_DELAY \ 158 - GENMASK(BITS_PER_LONG - 1, __INTEL_WAKEREF_PUT_LAST_BIT__) 159 157 { 160 158 INTEL_WAKEREF_BUG_ON(atomic_read(&wf->count) <= 0); 161 159 if (unlikely(!atomic_add_unless(&wf->count, -1, 1))) ··· 177 181 { 178 182 __intel_wakeref_put(wf, 179 183 INTEL_WAKEREF_PUT_ASYNC | 180 - FIELD_PREP(INTEL_WAKEREF_PUT_DELAY, delay)); 184 + FIELD_PREP(INTEL_WAKEREF_PUT_DELAY_MASK, delay)); 181 185 } 182 186 183 187 static inline void