From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754625AbdCTM27 (ORCPT ); Mon, 20 Mar 2017 08:28:59 -0400 Received: from mail-ot0-f193.google.com ([74.125.82.193]:34150 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754569AbdCTM2d (ORCPT ); Mon, 20 Mar 2017 08:28:33 -0400 MIME-Version: 1.0 In-Reply-To: <5B8DA87D05A7694D9FA63FD143655C1B543B032E@hasmsx108.ger.corp.intel.com> References: <20170320091755.1043811-1-arnd@arndb.de> <5B8DA87D05A7694D9FA63FD143655C1B543B032E@hasmsx108.ger.corp.intel.com> From: Arnd Bergmann Date: Mon, 20 Mar 2017 13:27:32 +0100 X-Google-Sender-Auth: bas2oPq6QuqQjWb7e-8c9IYp1JM Message-ID: Subject: Re: [PATCH] tpm/tpm_crb: mark PM functions as __maybe_unused To: "Winkler, Tomas" Cc: Peter Huewe , Marcel Selhorst , Jarkko Sakkinen , Jason Gunthorpe , Jerry Snitselaar , "tpmdd-devel@lists.sourceforge.net" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 20, 2017 at 1:11 PM, Winkler, Tomas wrote: >> >> When CONFIG_PM_SLEEP is disabled, we get a warning about unused >> functions: >> >> drivers/char/tpm/tpm_crb.c:551:12: error: 'crb_pm_resume' defined but not >> used [-Werror=unused-function] >> drivers/char/tpm/tpm_crb.c:540:12: error: 'crb_pm_suspend' defined but not >> used [-Werror=unused-function] >> > Note that the runtime_pm functions are not affected by this issue the macro > SET_RUNTIME_PM_OPS is under CONFIG_PM. This patch does more than described. Well, the problem is that there is an #ifdef that is wrong here as I tried to indicate: >> We could solve this with more sophistated #ifdefs, but a simpler and safer way >> is to just mark them as __maybe_unused. >> @@ -547,7 +546,7 @@ static int crb_pm_suspend(struct device *dev) >> return crb_pm_runtime_suspend(dev); >> } > > It's enough to > #endif /* CONFIG_PM */ > #ifdef CONFIG_PM_SLEEP >> -static int crb_pm_resume(struct device *dev) >> +static __maybe_unused int crb_pm_resume(struct device *dev) >> { >> int ret; >> >> @@ -558,8 +557,6 @@ static int crb_pm_resume(struct device *dev) >> return tpm_pm_resume(dev); >> } >> >> -#endif /* CONFIG_PM */ > And > #endif CONFIG_PM_SLEEP This tends to cause other warnings half of the time, when both the runtime-pm and pm-sleep variants call into another function that becomes unused when both are disabled. Arnd