Skip to content
/ linux Public

Commit ea39bac

Browse files
jnikulaSasha Levin
authored andcommitted
drm/i915/wakeref: clean up INTEL_WAKEREF_PUT_* flag macros
[ Upstream commit 524696a ] Commit 469c1c9 ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent b0bc1aa commit ea39bac

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

drivers/gpu/drm/i915/intel_wakeref.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void __intel_wakeref_put_last(struct intel_wakeref *wf, unsigned long flags)
7878
/* Assume we are not in process context and so cannot sleep. */
7979
if (flags & INTEL_WAKEREF_PUT_ASYNC || !mutex_trylock(&wf->mutex)) {
8080
mod_delayed_work(wf->i915->unordered_wq, &wf->work,
81-
FIELD_GET(INTEL_WAKEREF_PUT_DELAY, flags));
81+
FIELD_GET(INTEL_WAKEREF_PUT_DELAY_MASK, flags));
8282
return;
8383
}
8484

drivers/gpu/drm/i915/intel_wakeref.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,17 +128,16 @@ intel_wakeref_get_if_active(struct intel_wakeref *wf)
128128
return atomic_inc_not_zero(&wf->count);
129129
}
130130

131-
enum {
132-
INTEL_WAKEREF_PUT_ASYNC_BIT = 0,
133-
__INTEL_WAKEREF_PUT_LAST_BIT__
134-
};
135-
136131
static inline void
137132
intel_wakeref_might_get(struct intel_wakeref *wf)
138133
{
139134
might_lock(&wf->mutex);
140135
}
141136

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)
140+
142141
/**
143142
* __intel_wakeref_put: Release the wakeref
144143
* @wf: the wakeref
@@ -154,9 +153,6 @@ intel_wakeref_might_get(struct intel_wakeref *wf)
154153
*/
155154
static inline void
156155
__intel_wakeref_put(struct intel_wakeref *wf, unsigned long flags)
157-
#define INTEL_WAKEREF_PUT_ASYNC BIT(INTEL_WAKEREF_PUT_ASYNC_BIT)
158-
#define INTEL_WAKEREF_PUT_DELAY \
159-
GENMASK(BITS_PER_LONG - 1, __INTEL_WAKEREF_PUT_LAST_BIT__)
160156
{
161157
INTEL_WAKEREF_BUG_ON(atomic_read(&wf->count) <= 0);
162158
if (unlikely(!atomic_add_unless(&wf->count, -1, 1)))
@@ -181,7 +177,7 @@ intel_wakeref_put_delay(struct intel_wakeref *wf, unsigned long delay)
181177
{
182178
__intel_wakeref_put(wf,
183179
INTEL_WAKEREF_PUT_ASYNC |
184-
FIELD_PREP(INTEL_WAKEREF_PUT_DELAY, delay));
180+
FIELD_PREP(INTEL_WAKEREF_PUT_DELAY_MASK, delay));
185181
}
186182

187183
static inline void

0 commit comments

Comments
 (0)