Skip to content

Commit c2bc05d

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 5af4761 commit c2bc05d

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

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
@@ -131,17 +131,16 @@ intel_wakeref_get_if_active(struct intel_wakeref *wf)
131131
return atomic_inc_not_zero(&wf->count);
132132
}
133133

134-
enum {
135-
INTEL_WAKEREF_PUT_ASYNC_BIT = 0,
136-
__INTEL_WAKEREF_PUT_LAST_BIT__
137-
};
138-
139134
static inline void
140135
intel_wakeref_might_get(struct intel_wakeref *wf)
141136
{
142137
might_lock(&wf->mutex);
143138
}
144139

140+
/* flags for __intel_wakeref_put() and __intel_wakeref_put_last */
141+
#define INTEL_WAKEREF_PUT_ASYNC BIT(0)
142+
#define INTEL_WAKEREF_PUT_DELAY_MASK GENMASK(BITS_PER_LONG - 1, 1)
143+
145144
/**
146145
* __intel_wakeref_put: Release the wakeref
147146
* @wf: the wakeref
@@ -157,9 +156,6 @@ intel_wakeref_might_get(struct intel_wakeref *wf)
157156
*/
158157
static inline void
159158
__intel_wakeref_put(struct intel_wakeref *wf, unsigned long flags)
160-
#define INTEL_WAKEREF_PUT_ASYNC BIT(INTEL_WAKEREF_PUT_ASYNC_BIT)
161-
#define INTEL_WAKEREF_PUT_DELAY \
162-
GENMASK(BITS_PER_LONG - 1, __INTEL_WAKEREF_PUT_LAST_BIT__)
163159
{
164160
INTEL_WAKEREF_BUG_ON(atomic_read(&wf->count) <= 0);
165161
if (unlikely(!atomic_add_unless(&wf->count, -1, 1)))
@@ -184,7 +180,7 @@ intel_wakeref_put_delay(struct intel_wakeref *wf, unsigned long delay)
184180
{
185181
__intel_wakeref_put(wf,
186182
INTEL_WAKEREF_PUT_ASYNC |
187-
FIELD_PREP(INTEL_WAKEREF_PUT_DELAY, delay));
183+
FIELD_PREP(INTEL_WAKEREF_PUT_DELAY_MASK, delay));
188184
}
189185

190186
static inline void

0 commit comments

Comments
 (0)