Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp463552pxk; Thu, 3 Sep 2020 04:40:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQK+bpVZHZxD2qxOcp052t7ecVHIE+8KIat2JJlWt8TiS4XxddyGayeMMdy1AnnnR0Ymvm X-Received: by 2002:a50:d65e:: with SMTP id c30mr2256978edj.57.1599133237708; Thu, 03 Sep 2020 04:40:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599133237; cv=none; d=google.com; s=arc-20160816; b=jflCUEiZHXz3ihcsR9DELCYE6lB7SUdjbNTE9mZDVzIhjQQPK2c8PcuunqXUKPdodE FA8DMeIn5rlVXAGNKKiwKB/KlwS439dMvKXyWY1iNQafvcO32838fGPufk8DodAqU6yG c5r26FdtdzWcYg/gVKmO9M7Rf9qE7GpVYAhNXXjmuMwYEAPToV5QPzr3ZdJoGktMmjz+ eQ2NTbqeFVjLSorrvNhYANpM8TlvL7mMVv0rDVGoaaX+dyico489VoGSPmXafujkLGlI m9Q5hQ0Dw0i0p4PI0tF0QRsev7WYU9UBN9U4wCDgjp9ycYOayK8xNy3F8gZ1rdhbQCSH pqRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LJlqqFXg/MOSyVPsBSEVTxCBPa0T4MkeyfIM49qM1g0=; b=Nnw6od8zoVZLxyv2YD7Uu+8evSNg+PQQrvn5J/ZJ/sGRlrTVi2ow8H+a3xuFzQYYPS t8fdXH4FSuS8YKPUiuI0E5K74sVCcrn/0asEk8toQDXpBYko7GzNOXkzqVhQh4WUmWEs qcylUp2XRD3dl8DAX1HTaLkcXZTgCQcge3ExMTpu78a/DmG+3wh47Xp7IgDUZ3o48NDQ FmNl3Fd49IOXTL7HAPzglZRjj21vIW9KhiGwSCVLKC40qvr9i0rlC4SNoiuDe5C4w7qD 1lL94WbJpt9Phc9NqdAmcUlqgo301RI6S4QM7Lfo7QBpkAXirBOV0v6QLbk6pq2bjVZ7 mm6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=b+pvUnRt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f10si1493493edy.472.2020.09.03.04.40.14; Thu, 03 Sep 2020 04:40:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=b+pvUnRt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728145AbgICLfD (ORCPT + 99 others); Thu, 3 Sep 2020 07:35:03 -0400 Received: from crapouillou.net ([89.234.176.41]:51336 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728589AbgICLaY (ORCPT ); Thu, 3 Sep 2020 07:30:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1599132376; 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=LJlqqFXg/MOSyVPsBSEVTxCBPa0T4MkeyfIM49qM1g0=; b=b+pvUnRtEmJmpiSgtZPGUBj4jbeHQi4WsVy7CavoSjIUC28Cc4MpspoqZpIKRfwIrkBLBs RZkLN2dTM0yjA5rbk4otHIJt/lwY0is9oymHiRp5Mtl0pDgiVY5erZzlOwmsrH4ojxsLZ8 ct0D39tVUdLlv8sq6t7DbOx5TANfc3Q= 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 Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, openbmc@lists.ozlabs.org, Paul Cercueil Subject: [PATCH 05/20] usb/cdns3: core: Use pm_ptr() macro Date: Thu, 3 Sep 2020 13:25:39 +0200 Message-Id: <20200903112554.34263-6-paul@crapouillou.net> In-Reply-To: <20200903112554.34263-1-paul@crapouillou.net> References: <20200903112554.34263-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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/cdns3/core.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c index 5c1586ec7824..dacab9e9ef92 100644 --- a/drivers/usb/cdns3/core.c +++ b/drivers/usb/cdns3/core.c @@ -546,9 +546,7 @@ static int cdns3_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP - -static int cdns3_suspend(struct device *dev) +static int __maybe_unused cdns3_suspend(struct device *dev) { struct cdns3 *cdns = dev_get_drvdata(dev); unsigned long flags; @@ -568,7 +566,7 @@ static int cdns3_suspend(struct device *dev) return 0; } -static int cdns3_resume(struct device *dev) +static int __maybe_unused cdns3_resume(struct device *dev) { struct cdns3 *cdns = dev_get_drvdata(dev); unsigned long flags; @@ -588,11 +586,8 @@ static int cdns3_resume(struct device *dev) return 0; } -#endif -static const struct dev_pm_ops cdns3_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(cdns3_suspend, cdns3_resume) -}; +static SIMPLE_DEV_PM_OPS(cdns3_pm_ops, cdns3_suspend, cdns3_resume); #ifdef CONFIG_OF static const struct of_device_id of_cdns3_match[] = { @@ -608,7 +603,7 @@ static struct platform_driver cdns3_driver = { .driver = { .name = "cdns-usb3", .of_match_table = of_match_ptr(of_cdns3_match), - .pm = &cdns3_pm_ops, + .pm = pm_ptr(&cdns3_pm_ops), }, }; -- 2.28.0