dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>
Subject: Re: [PATCH v1 1/1] drm/mm: Mark drm_mm_interval_tree*() functions with __maybe_unused
Date: Fri, 30 Aug 2024 14:43:38 +0300	[thread overview]
Message-ID: <87ttf2utg5.fsf@intel.com> (raw)
In-Reply-To: <20240829154640.1120050-1-andriy.shevchenko@linux.intel.com>

On Thu, 29 Aug 2024, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> The INTERVAL_TREE_DEFINE() uncoditionally provides a bunch of helper
> functions which in some cases may be not used. This, in particular,
> prevents kernel builds with `make W=1` and CONFIG_WERROR=y:
>
> .../drm/drm_mm.c:152:1: error: unused function 'drm_mm_interval_tree_insert' [-Werror,-Wunused-function]
>   152 | INTERVAL_TREE_DEFINE(struct drm_mm_node, rb,
>       | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   153 |                      u64, __subtree_last,
>       |                      ~~~~~~~~~~~~~~~~~~~~
>   154 |                      START, LAST, static inline, drm_mm_interval_tree)
>       |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Fix this by marking drm_mm_interval_tree*() functions with __maybe_unused.
>
> Fixes: 202b52b7fbf7 ("drm: Track drm_mm nodes with an interval tree")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

As discussed in [1], the key combo is W=1 and Clang, which enables
detection for unused static inlines.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>


BR,
Jani.


[1] https://lore.kernel.org/r/20240829155950.1141978-1-andriy.shevchenko@linux.intel.com


> ---
>  drivers/gpu/drm/drm_mm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
> index 5ace481c1901..1ed68d3cd80b 100644
> --- a/drivers/gpu/drm/drm_mm.c
> +++ b/drivers/gpu/drm/drm_mm.c
> @@ -151,7 +151,7 @@ static void show_leaks(struct drm_mm *mm) { }
>  
>  INTERVAL_TREE_DEFINE(struct drm_mm_node, rb,
>  		     u64, __subtree_last,
> -		     START, LAST, static inline, drm_mm_interval_tree)
> +		     START, LAST, static inline __maybe_unused, drm_mm_interval_tree)
>  
>  struct drm_mm_node *
>  __drm_mm_interval_first(const struct drm_mm *mm, u64 start, u64 last)

-- 
Jani Nikula, Intel

  reply	other threads:[~2024-08-30 11:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-29 15:46 [PATCH v1 1/1] drm/mm: Mark drm_mm_interval_tree*() functions with __maybe_unused Andy Shevchenko
2024-08-30 11:43 ` Jani Nikula [this message]
2024-09-04  9:18   ` Jani Nikula

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=87ttf2utg5.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=airlied@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=tzimmermann@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).