From patchwork Thu Sep 3 11:25:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 11753401 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CFE1A14E5 for ; Thu, 3 Sep 2020 11:34:03 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A4A1B206A5 for ; Thu, 3 Sep 2020 11:34:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="2/GKG3ks"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=crapouillou.net header.i=@crapouillou.net header.b="uyPH2gOX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A4A1B206A5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=crapouillou.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9e4RlhyWNxui9QvXGoXY8mHNqVyO2Bnlzgqr+NtqSts=; b=2/GKG3ksP8fgkkxMLGqTYbf37 L+/my9rkjeTeq9cnB90D5yaYoImGvXPJg0tc+ls/91hDtYDJnBcDY/DMD978uuDY4aX7z7YmyMent cq3j90zLxip4iCNVFMFB0DgfZebNMhvFf0MrXoVf7FykAEiDe8SXx9HlAOk6QVtC5hlp0tQ7JVlcA Od6O1jdOMFfr9jxuQ2uaB95gMuYHXEGXJR6S1CgX9i71CUlE+6H4le27X8fuxIXfOUuJy1X0ns/X+ E33l1A18aHZmnPophE8C/C6Uyb8mgUuctjxvQYBJj20Tz7tk6QpbHGAuMCwOEHysxZd83d8QkJsJ5 iOjph7lnw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDnT0-0005U3-Ej; Thu, 03 Sep 2020 11:31:46 +0000 Received: from crapouillou.net ([89.234.176.41]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDnQ6-0003hf-Ci for linux-arm-kernel@lists.infradead.org; Thu, 03 Sep 2020 11:28:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1599132416; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d/usum2lMn5S572mPjualJXpI8Hb8PYrLN5qLjcBg/E=; b=uyPH2gOXuLKzSt6R9ogD6oYnN48BacMq2YCnxfq+SGRV9cExif4lnLNhWfRYfiVN93vpTU iNEmJHYhwhvBHbRXKzQno5TLuA3CiRE064g8znLpMhPwYtZ6Op5Vc612zeV2FlJUHU6NF7 kv1P84KdA4TY9WoGREISDXYqyfPPtow= From: Paul Cercueil To: Greg Kroah-Hartman , Peter Chen , Cristian Birsan , Felipe Balbi , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Alan Stern , Tony Prisk , Bin Liu , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Subject: [PATCH 20/20] usb/gadget/udc: snps: Use pm_ptr() macro Date: Thu, 3 Sep 2020 13:25:54 +0200 Message-Id: <20200903112554.34263-21-paul@crapouillou.net> In-Reply-To: <20200903112554.34263-1-paul@crapouillou.net> References: <20200903112554.34263-1-paul@crapouillou.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200903_072846_829704_6FD146AC X-CRM114-Status: GOOD ( 14.09 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Cercueil , openbmc@lists.ozlabs.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Use the newly introduced pm_ptr() macro, and mark the suspend/resume functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler. Signed-off-by: Paul Cercueil --- drivers/usb/gadget/udc/snps_udc_plat.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/usb/gadget/udc/snps_udc_plat.c b/drivers/usb/gadget/udc/snps_udc_plat.c index 32f1d3e90c26..6b8f08287c84 100644 --- a/drivers/usb/gadget/udc/snps_udc_plat.c +++ b/drivers/usb/gadget/udc/snps_udc_plat.c @@ -257,8 +257,7 @@ static int udc_plat_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP -static int udc_plat_suspend(struct device *dev) +static int __maybe_unused udc_plat_suspend(struct device *dev) { struct udc *udc; @@ -275,7 +274,7 @@ static int udc_plat_suspend(struct device *dev) return 0; } -static int udc_plat_resume(struct device *dev) +static int __maybe_unused udc_plat_resume(struct device *dev) { struct udc *udc; int ret; @@ -302,11 +301,8 @@ static int udc_plat_resume(struct device *dev) return 0; } -static const struct dev_pm_ops udc_plat_pm_ops = { - .suspend = udc_plat_suspend, - .resume = udc_plat_resume, -}; -#endif + +static SIMPLE_DEV_PM_OPS(plat_pm_ops, udc_plat_suspend, udc_plat_resume); #if defined(CONFIG_OF) static const struct of_device_id of_udc_match[] = { @@ -324,9 +320,7 @@ static struct platform_driver udc_plat_driver = { .driver = { .name = "snps-udc-plat", .of_match_table = of_match_ptr(of_udc_match), -#ifdef CONFIG_PM_SLEEP - .pm = &udc_plat_pm_ops, -#endif + .pm = pm_ptr(&udc_plat_pm_ops), }, }; module_platform_driver(udc_plat_driver);