From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 652D7C433FE for ; Tue, 8 Dec 2020 08:55:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 321D823A80 for ; Tue, 8 Dec 2020 08:55:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728558AbgLHIy5 (ORCPT ); Tue, 8 Dec 2020 03:54:57 -0500 Received: from aibo.runbox.com ([91.220.196.211]:48544 "EHLO aibo.runbox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726734AbgLHIy4 (ORCPT ); Tue, 8 Dec 2020 03:54:56 -0500 X-Greylist: delayed 2147 seconds by postgrey-1.27 at vger.kernel.org; Tue, 08 Dec 2020 03:54:55 EST Received: from [10.9.9.74] (helo=submission03.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1kmYCV-0007Tz-Ey; Tue, 08 Dec 2020 09:18:23 +0100 Received: by submission03.runbox with esmtpsa [Authenticated alias (981869)] (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) id 1kmYCQ-0002zv-JO; Tue, 08 Dec 2020 09:18:18 +0100 Subject: Re: [PATCH] drm/ttm: fix unused function warning To: Arnd Bergmann , Christian Koenig , Huang Rui , David Airlie , Daniel Vetter , Dave Airlie , Madhav Chauhan Cc: Arnd Bergmann , Alex Deucher , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20201204165158.3748141-1-arnd@kernel.org> From: Martin Peres Message-ID: <3a55c203-57dd-79f3-99ec-6bdeafaba157@mupuf.org> Date: Tue, 8 Dec 2020 10:18:18 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.3 MIME-Version: 1.0 In-Reply-To: <20201204165158.3748141-1-arnd@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/12/2020 18:51, Arnd Bergmann wrote: > From: Arnd Bergmann > > ttm_pool_type_count() is not used when debugfs is disabled: > > drivers/gpu/drm/ttm/ttm_pool.c:243:21: error: unused function 'ttm_pool_type_count' [-Werror,-Wunused-function] > static unsigned int ttm_pool_type_count(struct ttm_pool_type *pt) > > Move the definition into the #ifdef block. > > Fixes: d099fc8f540a ("drm/ttm: new TT backend allocation pool v3") > Signed-off-by: Arnd Bergmann Thanks Arnd! The patch looks good to me: Reviewed-by: Martin Peres > --- > drivers/gpu/drm/ttm/ttm_pool.c | 29 ++++++++++++++--------------- > 1 file changed, 14 insertions(+), 15 deletions(-) > > diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c > index 5455b2044759..7b2f60616750 100644 > --- a/drivers/gpu/drm/ttm/ttm_pool.c > +++ b/drivers/gpu/drm/ttm/ttm_pool.c > @@ -239,21 +239,6 @@ static struct page *ttm_pool_type_take(struct ttm_pool_type *pt) > return p; > } > > -/* Count the number of pages available in a pool_type */ > -static unsigned int ttm_pool_type_count(struct ttm_pool_type *pt) > -{ > - unsigned int count = 0; > - struct page *p; > - > - spin_lock(&pt->lock); > - /* Only used for debugfs, the overhead doesn't matter */ > - list_for_each_entry(p, &pt->pages, lru) > - ++count; > - spin_unlock(&pt->lock); > - > - return count; > -} > - > /* Initialize and add a pool type to the global shrinker list */ > static void ttm_pool_type_init(struct ttm_pool_type *pt, struct ttm_pool *pool, > enum ttm_caching caching, unsigned int order) > @@ -543,6 +528,20 @@ void ttm_pool_fini(struct ttm_pool *pool) > EXPORT_SYMBOL(ttm_pool_fini); > > #ifdef CONFIG_DEBUG_FS > +/* Count the number of pages available in a pool_type */ > +static unsigned int ttm_pool_type_count(struct ttm_pool_type *pt) > +{ > + unsigned int count = 0; > + struct page *p; > + > + spin_lock(&pt->lock); > + /* Only used for debugfs, the overhead doesn't matter */ > + list_for_each_entry(p, &pt->pages, lru) > + ++count; > + spin_unlock(&pt->lock); > + > + return count; > +} > > /* Dump information about the different pool types */ > static void ttm_pool_debugfs_orders(struct ttm_pool_type *pt, >