Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932219AbcCCMeB (ORCPT ); Thu, 3 Mar 2016 07:34:01 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:51547 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756904AbcCCMdx (ORCPT ); Thu, 3 Mar 2016 07:33:53 -0500 From: Arnd Bergmann To: Vinod Koul Cc: Barry Song , linux-arm-kernel@lists.infradead.org, Dan Williams , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 06/14] dma: sirf: use __maybe_unused to hide pm functions Date: Thu, 03 Mar 2016 13:33:17 +0100 Message-ID: <2913625.BbPcKOOv7K@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <20160303034731.GI11154@localhost> References: <1456934350-1389172-1-git-send-email-arnd@arndb.de> <1456934350-1389172-7-git-send-email-arnd@arndb.de> <20160303034731.GI11154@localhost> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:SJmA97+DJKPtyBQBo4OX+gsB+a6JuAoAJwdumXEuyFwwk89oMrS J7pQcrS0h3DY7EjcjLXtfoGSwy06+7p8nvjh+CVManoD+X7/0ZVSjRpEUcaCiGLBrUfTjUJ 2/9AByDANXTI5d9+K7tlVfjpPa3+opISG2ATwG7ImyppOAZICeHEKpweI74ytRVqFtWhGBN 3BsJONszUXKXhGCB1VhIQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:VCj7SSyIblI=:9N6f31Kna0TT6JJUHlwrjg hLc9W1rH6H8AHQNHoS/dElkA5BQZAqv3vYxy5lUoQZtibuxG+SvXBrgiVk2e+5xwifw6jHbwP xOZUqC6fzKyI74/yr3w5DGwnSpVYh3atOtfQlOzUz5w+2pldN7l4zphsmvg29EJUqEji9yJR8 MDZp64wcyoJ/XCtCRsMcdYuSopK351wBPXX1juRHFeU8PJrNZxTa+yghNzRVuVVArCD7CVSC7 MQZ3V9adE/mlKa6W4sY/NG4SAu5bP6iQLA4C7GhvQWwrRilKmlrrimW+t9CPv4+GFu0AB7byj sL+58I9uqtpq0l+jp9C8DyyZtUqsAAiYRdPries0OvIJe5gq9a8ywZQeMf+YW/wlTbdTYgDKs h6Je7UqU/CUxWhOsdZ+cvza7sfTOe3YOXS0Ncb+jebx78JaLSnk02Vf2Kaiyfo2Gty8DUBJHj 3tO27V4viCMYEV6R+Sq5RRGjWTUyGAvclUeqHiod6+kNzLgD3GqEhn/xe/tpiHBCpWnG/nzJm DaK8FEzLaBi6fCeSYah+EOx0QOugVgUsUboR6LHhllthvYY1EDvAMdBoCVoMe1zZ5/Z14hiIj yOAwe2CsV6tWUZuN5dPeR5E1q2+YgdM3m4l578axpwqfhyNGR7ZTtzvW2BzL36s1t+2NFmIsK tWjpWs5d84lW/8TqH4EFla3mB2DTozKYioIap/b2Fwj5Ls7EocKpTMrkwQ00FIPXe76gXr0za 2JrDZdbuxRyR25BL Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1392 Lines: 32 On Thursday 03 March 2016 09:17:31 Vinod Koul wrote: > On Wed, Mar 02, 2016 at 04:58:58PM +0100, Arnd Bergmann wrote: > > The sirf dma driver uses #ifdef to check for CONFIG_PM_SLEEP > > for its suspend/resume code but then has no #ifdef for the > > respective runtime PM code, so we get a warning if CONFIG_PM > > is disabled altogether: > > > > drivers/dma/sirf-dma.c:1000:12: error: 'sirfsoc_dma_runtime_resume' defined but not used [-Werror=unused-function] > > > > This removes the existing #ifdef and instead uses __maybe_unused > > annotations for all four functions to let the compiler know it > > can silently drop the function definition. > > Hi Arnd, > > Rather than telling compiler that this maybe used why not add ifdef for it's > suspend/resume as well, what are the demerits of that approach? > As I tried to explain in the cover letter, everyone gets the #ifdef wrong, and the __maybe_unused annotation is harder to get wrong here. This particular driver illustrates that well: sirfsoc_dma_remove() calls sirfsoc_dma_runtime_suspend(), so we must hide the resume function, but not suspend, and that is counterintuitive. Other drivers have other problems, e.g. functions that get called only from within the sections under an #ifdef, and then those need the same #ifdef added, which gets even more complicated when you have both runtime-pm and suspend support. Arnd