Skip to content

Commit 5dd828d

Browse files
jnikulaopsiff
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> (cherry picked from commit 18845fb30921dc2bacbbb2ad6113d5fd4d0ceb17) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent a32bb84 commit 5dd828d

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
@@ -119,17 +119,16 @@ intel_wakeref_get_if_active(struct intel_wakeref *wf)
119119
return atomic_inc_not_zero(&wf->count);
120120
}
121121

122-
enum {
123-
INTEL_WAKEREF_PUT_ASYNC_BIT = 0,
124-
__INTEL_WAKEREF_PUT_LAST_BIT__
125-
};
126-
127122
static inline void
128123
intel_wakeref_might_get(struct intel_wakeref *wf)
129124
{
130125
might_lock(&wf->mutex);
131126
}
132127

128+
/* flags for __intel_wakeref_put() and __intel_wakeref_put_last */
129+
#define INTEL_WAKEREF_PUT_ASYNC BIT(0)
130+
#define INTEL_WAKEREF_PUT_DELAY_MASK GENMASK(BITS_PER_LONG - 1, 1)
131+
133132
/**
134133
* __intel_wakeref_put: Release the wakeref
135134
* @wf: the wakeref
@@ -145,9 +144,6 @@ intel_wakeref_might_get(struct intel_wakeref *wf)
145144
*/
146145
static inline void
147146
__intel_wakeref_put(struct intel_wakeref *wf, unsigned long flags)
148-
#define INTEL_WAKEREF_PUT_ASYNC BIT(INTEL_WAKEREF_PUT_ASYNC_BIT)
149-
#define INTEL_WAKEREF_PUT_DELAY \
150-
GENMASK(BITS_PER_LONG - 1, __INTEL_WAKEREF_PUT_LAST_BIT__)
151147
{
152148
INTEL_WAKEREF_BUG_ON(atomic_read(&wf->count) <= 0);
153149
if (unlikely(!atomic_add_unless(&wf->count, -1, 1)))
@@ -172,7 +168,7 @@ intel_wakeref_put_delay(struct intel_wakeref *wf, unsigned long delay)
172168
{
173169
__intel_wakeref_put(wf,
174170
INTEL_WAKEREF_PUT_ASYNC |
175-
FIELD_PREP(INTEL_WAKEREF_PUT_DELAY, delay));
171+
FIELD_PREP(INTEL_WAKEREF_PUT_DELAY_MASK, delay));
176172
}
177173

178174
static inline void

0 commit comments

Comments
 (0)