Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp458550pxk; Thu, 3 Sep 2020 04:32:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqxcNENgeGuiFKRek//XdSxYJqRZrSJCCZuKyT16Mf1tyWTAGQI1OJWiOldovF9Ap3S0po X-Received: by 2002:a17:906:3785:: with SMTP id n5mr1759930ejc.218.1599132733728; Thu, 03 Sep 2020 04:32:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599132733; cv=none; d=google.com; s=arc-20160816; b=eWbySaRa3P+lijXAvBkQBU4WHMR0PdwsdH/atL6uPBYCSTr38sSjdqglVb68d0Ce01 bKO0uv01lRwvEdCWeAlsbRr/KVpB2O/cfoosaBFROqcI7s15gwDT3cozrP/uw9ixkwaU CTcd4J4PovExKN9c+3Yqb1G3G3sXPOEd0ieZ5XwdWFmL6vFfvHUF1IRHTwObubj4ubAD 5kBc0LCHGDIsxL1AvVu6oAUQDvZ+aCfW8nmN35PAUI8H3cJyY/2NiADkT4pTQCH5RB7D 7lJ8z0VUwEC2gIMvJvX4sdfIn14lSuH5f0iwHtr57fYG35juNFvBgC1mpc8RCjFmz4Bi thMA== 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=nylEOZ/ud9dJuiCng3IS9pJVAuTv7JQFJCJlDdh38kA=; b=I2YuCNGMd8z6b6ZbujZ42pM2uhoAmLU2HOXTJN4lvU+c+SwoQuVuzkv2e/YtA9N9bB dJEDqb76qBkpCY8i1BPouya5Kyq6v44CdYmCkn8ET+EJuF6mp/e6c2agqTi8eC22XkJZ 9oFbxiMDcf6LiPVDQhMuNK6V8EbbRGdzT0h8ntyLYXhTLX5QXs/8on+rZ6K2V9DPrR5F Os7BA23LLk3RjkzEBx4C4fdm9yug8G0zWxcxlSuenwc6GStWbvB3YUqnJrb+p8mmzXF7 jTEKzchlXU6Ku02kwpF9rl+rOEKyDYKTwgGEj7Cj3DkfkX41QQdQt1ABeyD4mDKKXmjN JsYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=JuRU33RE; 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 x2si1888247ejy.84.2020.09.03.04.31.51; Thu, 03 Sep 2020 04:32:13 -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=JuRU33RE; 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 S1728271AbgICL3o (ORCPT + 99 others); Thu, 3 Sep 2020 07:29:44 -0400 Received: from crapouillou.net ([89.234.176.41]:50376 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728422AbgICL0T (ORCPT ); Thu, 3 Sep 2020 07:26:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1599132365; 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=nylEOZ/ud9dJuiCng3IS9pJVAuTv7JQFJCJlDdh38kA=; b=JuRU33REs724J6eVnbhIDjfeUMWW9tOA78MdFBc3i95nB9cktLPxKK2ChHPcQK628+jfXp i3+e9cDmuhgUwtVBolHIKO9sH8/eX+Ybb3YnUm1v+0udsj1vdEp3baEUPowH0LfsUOS6V5 R9po9WQ1ueOAKCWhmtjbsOVyV8m+OMk= 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 01/20] usb/host: ohci-platform: Use pm_ptr() macro Date: Thu, 3 Sep 2020 13:25:35 +0200 Message-Id: <20200903112554.34263-2-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/host/ohci-platform.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index 4a8456f12a73..21400d7d8b0a 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c @@ -176,22 +176,21 @@ static int ohci_platform_probe(struct platform_device *dev) if (pdata->num_ports) ohci->num_ports = pdata->num_ports; -#ifndef CONFIG_USB_OHCI_BIG_ENDIAN_MMIO - if (ohci->flags & OHCI_QUIRK_BE_MMIO) { + if (!IS_ENABLED(CONFIG_USB_OHCI_BIG_ENDIAN_MMIO) && + ohci->flags & OHCI_QUIRK_BE_MMIO) { dev_err(&dev->dev, "Error: CONFIG_USB_OHCI_BIG_ENDIAN_MMIO not set\n"); err = -EINVAL; goto err_reset; } -#endif -#ifndef CONFIG_USB_OHCI_BIG_ENDIAN_DESC - if (ohci->flags & OHCI_QUIRK_BE_DESC) { + + if (!IS_ENABLED(CONFIG_USB_OHCI_BIG_ENDIAN_DESC) && + ohci->flags & OHCI_QUIRK_BE_DESC) { dev_err(&dev->dev, "Error: CONFIG_USB_OHCI_BIG_ENDIAN_DESC not set\n"); err = -EINVAL; goto err_reset; } -#endif pm_runtime_set_active(&dev->dev); pm_runtime_enable(&dev->dev); @@ -267,8 +266,7 @@ static int ohci_platform_remove(struct platform_device *dev) return 0; } -#ifdef CONFIG_PM_SLEEP -static int ohci_platform_suspend(struct device *dev) +static int __maybe_unused ohci_platform_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); struct usb_ohci_pdata *pdata = dev->platform_data; @@ -286,7 +284,7 @@ static int ohci_platform_suspend(struct device *dev) return ret; } -static int ohci_platform_resume(struct device *dev) +static int __maybe_unused ohci_platform_resume(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); struct usb_ohci_pdata *pdata = dev_get_platdata(dev); @@ -306,7 +304,6 @@ static int ohci_platform_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM_SLEEP */ static const struct of_device_id ohci_platform_ids[] = { { .compatible = "generic-ohci", }, @@ -332,7 +329,7 @@ static struct platform_driver ohci_platform_driver = { .shutdown = usb_hcd_platform_shutdown, .driver = { .name = "ohci-platform", - .pm = &ohci_platform_pm_ops, + .pm = pm_ptr(&ohci_platform_pm_ops), .of_match_table = ohci_platform_ids, } }; -- 2.28.0