public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	John Youn <John.Youn@synopsys.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH for v4.8] usb: dwc3: mark PM function as __maybe_unused
Date: Wed, 07 Sep 2016 13:39:16 +0300	[thread overview]
Message-ID: <87a8fkkn8r.fsf@linux.intel.com> (raw)
In-Reply-To: <20160906132318.2033811-1-arnd@arndb.de>

[-- Attachment #1: Type: text/plain, Size: 3045 bytes --]


Hi,

Arnd Bergmann <arnd@arndb.de> writes:
> Starting with v4.8-rc5, we get a warning about the dwc3_pci_pm_dummy function
> when CONFIG_PM_SLEEP is disabled:
>
> drivers/usb/dwc3/dwc3-pci.c:253:12: warning: 'dwc3_pci_pm_dummy' defined but not used
>
> Using __maybe_unused instead of #ifdef lets the compiler figure out
> whether it should drop the definitions silently and avoids this warning.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: f6c274e11e3b ("usb: dwc3: pci: runtime_resume child device")
> ---
>  drivers/usb/dwc3/dwc3-pci.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> After we fixed all other warnings reported by kernelci.org, this is
> now the only thing we get a warning for in the configurations we build,
> so it would be good to get this fixed before v4.8 to get a clean
> build for the first time in a release.
>
> diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
> index 0a32430f4c41..6a82b36f0d59 100644
> --- a/drivers/usb/dwc3/dwc3-pci.c
> +++ b/drivers/usb/dwc3/dwc3-pci.c
> @@ -234,8 +234,7 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
>  };
>  MODULE_DEVICE_TABLE(pci, dwc3_pci_id_table);
>  
> -#ifdef CONFIG_PM
> -static int dwc3_pci_runtime_suspend(struct device *dev)
> +static int __maybe_unused dwc3_pci_runtime_suspend(struct device *dev)
>  {
>  	if (device_run_wake(dev))
>  		return 0;
> @@ -243,14 +242,14 @@ static int dwc3_pci_runtime_suspend(struct device *dev)
>  	return -EBUSY;
>  }
>  
> -static int dwc3_pci_runtime_resume(struct device *dev)
> +static int __maybe_unused dwc3_pci_runtime_resume(struct device *dev)
>  {
>  	struct platform_device *dwc3 = dev_get_drvdata(dev);
>  
>  	return pm_runtime_get(&dwc3->dev);
>  }
>  
> -static int dwc3_pci_pm_dummy(struct device *dev)
> +static int __maybe_unused dwc3_pci_pm_dummy(struct device *dev)
>  {
>  	/*
>  	 * There's nothing to do here. No, seriously. Everything is either taken
> @@ -262,7 +261,6 @@ static int dwc3_pci_pm_dummy(struct device *dev)
>  	 */
>  	return 0;
>  }
> -#endif /* CONFIG_PM */

seems like it would've been enough to define dwc3_pci_pm_dummy() if
CONFIG_PM_SLEEP. Right? IOW:

diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index 0a32430f4c41..6df0f5dad9a4 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -249,7 +249,9 @@ static int dwc3_pci_runtime_resume(struct device *dev)
 
        return pm_runtime_get(&dwc3->dev);
 }
+#endif /* CONFIG_PM */
 
+#ifdef CONFIG_PM_SLEEP
 static int dwc3_pci_pm_dummy(struct device *dev)
 {
        /*
@@ -262,7 +264,7 @@ static int dwc3_pci_pm_dummy(struct device *dev)
         */
        return 0;
 }
-#endif /* CONFIG_PM */
+#endif /* CONFIG_PM_SLEEP */
 
 static struct dev_pm_ops dwc3_pci_dev_pm_ops = {
        SET_SYSTEM_SLEEP_PM_OPS(dwc3_pci_pm_dummy, dwc3_pci_pm_dummy)

Can you check if this is enough for you? Works just fine here.

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]

  reply	other threads:[~2016-09-07 10:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-06 13:23 [PATCH for v4.8] usb: dwc3: mark PM function as __maybe_unused Arnd Bergmann
2016-09-07 10:39 ` Felipe Balbi [this message]
2016-09-07 11:35   ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a8fkkn8r.fsf@linux.intel.com \
    --to=balbi@kernel.org \
    --cc=John.Youn@synopsys.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox