From: Jani Nikula <jani.nikula@intel.com>
To: Randy Dunlap <rdunlap@infradead.org>, intel-gfx@lists.freedesktop.org
Cc: linux-doc@vger.kernel.org,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Jonathan Corbet <corbet@lwn.net>
Subject: Re: [PATCH] drm/i915/wakeref: clean up INTEL_WAKEREF_PUT_* flag macros
Date: Tue, 16 Dec 2025 15:48:15 +0200 [thread overview]
Message-ID: <707d40a5b84853a6403e537163c6cb97c3474792@intel.com> (raw)
In-Reply-To: <76482fc4-7989-41ad-a244-3de4bca44043@infradead.org>
On Mon, 15 Dec 2025, Randy Dunlap <rdunlap@infradead.org> wrote:
> On 12/15/25 4:09 AM, Jani Nikula wrote:
>> 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>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>
> Acked-by: Randy Dunlap <rdunlap@infradead.org>
> Tested-by: Randy Dunlap <rdunlap@infradead.org>
>
> Thanks.
Thanks, pushed to drm-intel-next.
BR,
Jani.
>
>>
>> ---
>>
>> Curiously, kernel-doc does not return non-zero exit status for these
>> warnings even with the -Werror parameter!
>> ---
>> drivers/gpu/drm/i915/intel_wakeref.c | 2 +-
>> drivers/gpu/drm/i915/intel_wakeref.h | 14 +++++---------
>> 2 files changed, 6 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_wakeref.c b/drivers/gpu/drm/i915/intel_wakeref.c
>> index b1883dccc22a..98e7cee4e1dc 100644
>> --- a/drivers/gpu/drm/i915/intel_wakeref.c
>> +++ b/drivers/gpu/drm/i915/intel_wakeref.c
>> @@ -80,7 +80,7 @@ void __intel_wakeref_put_last(struct intel_wakeref *wf, unsigned long flags)
>> /* Assume we are not in process context and so cannot sleep. */
>> if (flags & INTEL_WAKEREF_PUT_ASYNC || !mutex_trylock(&wf->mutex)) {
>> mod_delayed_work(wf->i915->unordered_wq, &wf->work,
>> - FIELD_GET(INTEL_WAKEREF_PUT_DELAY, flags));
>> + FIELD_GET(INTEL_WAKEREF_PUT_DELAY_MASK, flags));
>> return;
>> }
>>
>> diff --git a/drivers/gpu/drm/i915/intel_wakeref.h b/drivers/gpu/drm/i915/intel_wakeref.h
>> index a2894a56e18f..81308bac34ba 100644
>> --- a/drivers/gpu/drm/i915/intel_wakeref.h
>> +++ b/drivers/gpu/drm/i915/intel_wakeref.h
>> @@ -128,17 +128,16 @@ intel_wakeref_get_if_active(struct intel_wakeref *wf)
>> return atomic_inc_not_zero(&wf->count);
>> }
>>
>> -enum {
>> - INTEL_WAKEREF_PUT_ASYNC_BIT = 0,
>> - __INTEL_WAKEREF_PUT_LAST_BIT__
>> -};
>> -
>> static inline void
>> intel_wakeref_might_get(struct intel_wakeref *wf)
>> {
>> might_lock(&wf->mutex);
>> }
>>
>> +/* flags for __intel_wakeref_put() and __intel_wakeref_put_last */
>> +#define INTEL_WAKEREF_PUT_ASYNC BIT(0)
>> +#define INTEL_WAKEREF_PUT_DELAY_MASK GENMASK(BITS_PER_LONG - 1, 1)
>> +
>> /**
>> * __intel_wakeref_put: Release the wakeref
>> * @wf: the wakeref
>> @@ -154,9 +153,6 @@ intel_wakeref_might_get(struct intel_wakeref *wf)
>> */
>> static inline void
>> __intel_wakeref_put(struct intel_wakeref *wf, unsigned long flags)
>> -#define INTEL_WAKEREF_PUT_ASYNC BIT(INTEL_WAKEREF_PUT_ASYNC_BIT)
>> -#define INTEL_WAKEREF_PUT_DELAY \
>> - GENMASK(BITS_PER_LONG - 1, __INTEL_WAKEREF_PUT_LAST_BIT__)
>> {
>> INTEL_WAKEREF_BUG_ON(atomic_read(&wf->count) <= 0);
>> if (unlikely(!atomic_add_unless(&wf->count, -1, 1)))
>> @@ -181,7 +177,7 @@ intel_wakeref_put_delay(struct intel_wakeref *wf, unsigned long delay)
>> {
>> __intel_wakeref_put(wf,
>> INTEL_WAKEREF_PUT_ASYNC |
>> - FIELD_PREP(INTEL_WAKEREF_PUT_DELAY, delay));
>> + FIELD_PREP(INTEL_WAKEREF_PUT_DELAY_MASK, delay));
>> }
>>
>> static inline void
--
Jani Nikula, Intel
prev parent reply other threads:[~2025-12-16 13:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-15 12:09 [PATCH] drm/i915/wakeref: clean up INTEL_WAKEREF_PUT_* flag macros Jani Nikula
2025-12-15 16:14 ` ✓ i915.CI.BAT: success for " Patchwork
2025-12-15 21:32 ` ✗ i915.CI.Full: failure " Patchwork
2025-12-16 6:43 ` [PATCH] " Randy Dunlap
2025-12-16 13:48 ` Jani Nikula [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=707d40a5b84853a6403e537163c6cb97c3474792@intel.com \
--to=jani.nikula@intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=corbet@lwn.net \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-doc@vger.kernel.org \
--cc=rdunlap@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox