From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753775AbdCTMM7 (ORCPT ); Mon, 20 Mar 2017 08:12:59 -0400 Received: from mga09.intel.com ([134.134.136.24]:1142 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753395AbdCTMM4 (ORCPT ); Mon, 20 Mar 2017 08:12:56 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,194,1486454400"; d="scan'208";a="238242208" From: "Winkler, Tomas" To: Arnd Bergmann , Peter Huewe , "Marcel Selhorst" , Jarkko Sakkinen CC: Jason Gunthorpe , Jerry Snitselaar , "tpmdd-devel@lists.sourceforge.net" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] tpm/tpm_crb: mark PM functions as __maybe_unused Thread-Topic: [PATCH] tpm/tpm_crb: mark PM functions as __maybe_unused Thread-Index: AQHSoVr9x3fd6karfEGn7YYVRJSuU6GdoYFw Date: Mon, 20 Mar 2017 12:11:55 +0000 Message-ID: <5B8DA87D05A7694D9FA63FD143655C1B543B032E@hasmsx108.ger.corp.intel.com> References: <20170320091755.1043811-1-arnd@arndb.de> In-Reply-To: <20170320091755.1043811-1-arnd@arndb.de> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOTFkZmZmNzItNzdiMC00ZGJiLTg3YjctMzg2ZTMxNTYxZDc3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkxjdGRWXC9yUUZaTHFHTE9PNnVKRGJyazJOZjl3OURiY0U1dnkyZFlTK0FvPSJ9 x-originating-ip: [10.184.70.11] Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v2KCE2ak019462 > > 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. > We could solve this with more sophistated #ifdefs, but a simpler and safer way > is to just mark them as __maybe_unused. > > Fixes: 848efcfb560c ("tpm/tpm_crb: enter the low power state upon device > suspend") > Signed-off-by: Arnd Bergmann > --- > drivers/char/tpm/tpm_crb.c | 11 ++++------- > 1 file changed, 4 insertions(+), 7 deletions(-) > > diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c index > 1dfc37e33c02..15f1118982a6 100644 > --- a/drivers/char/tpm/tpm_crb.c > +++ b/drivers/char/tpm/tpm_crb.c > @@ -519,8 +519,7 @@ static int crb_acpi_remove(struct acpi_device *device) > return 0; > } > > -#ifdef CONFIG_PM > -static int crb_pm_runtime_suspend(struct device *dev) > +static __maybe_unused int crb_pm_runtime_suspend(struct device *dev) > { > struct tpm_chip *chip = dev_get_drvdata(dev); > struct crb_priv *priv = dev_get_drvdata(&chip->dev); @@ -528,7 > +527,7 @@ static int crb_pm_runtime_suspend(struct device *dev) > return crb_go_idle(dev, priv); > } > > -static int crb_pm_runtime_resume(struct device *dev) > +static __maybe_unused int crb_pm_runtime_resume(struct device *dev) > { > struct tpm_chip *chip = dev_get_drvdata(dev); > struct crb_priv *priv = dev_get_drvdata(&chip->dev); @@ -536,7 > +535,7 @@ static int crb_pm_runtime_resume(struct device *dev) > return crb_cmd_ready(dev, priv); > } > > -static int crb_pm_suspend(struct device *dev) > +static __maybe_unused int crb_pm_suspend(struct device *dev) > { > int ret; > > @@ -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 > - > static const struct dev_pm_ops crb_pm = { > SET_SYSTEM_SLEEP_PM_OPS(crb_pm_suspend, crb_pm_resume) > SET_RUNTIME_PM_OPS(crb_pm_runtime_suspend, > crb_pm_runtime_resume, NULL) > -- > 2.9.0