Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1477380 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2016-09-06 15:30 +0200 |
| Last post | 2016-09-07 13:40 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH for v4.8] usb: dwc3: mark PM function as __maybe_unused Arnd Bergmann <arnd@arndb.de> - 2016-09-06 15:30 +0200
Re: [PATCH for v4.8] usb: dwc3: mark PM function as __maybe_unused Felipe Balbi <balbi@kernel.org> - 2016-09-07 12:50 +0200
Re: [PATCH for v4.8] usb: dwc3: mark PM function as __maybe_unused Arnd Bergmann <arnd@arndb.de> - 2016-09-07 13:40 +0200
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-09-06 15:30 +0200 |
| Subject | [PATCH for v4.8] usb: dwc3: mark PM function as __maybe_unused |
| Message-ID | <seoBQ-2y1-41@gated-at.bofh.it> |
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 */
static struct dev_pm_ops dwc3_pci_dev_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(dwc3_pci_pm_dummy, dwc3_pci_pm_dummy)
--
2.9.0
[toc] | [next] | [standalone]
| From | Felipe Balbi <balbi@kernel.org> |
|---|---|
| Date | 2016-09-07 12:50 +0200 |
| Message-ID | <seIAy-72R-7@gated-at.bofh.it> |
| In reply to | #1477380 |
[Multipart message — attachments visible in raw view] — view raw
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
[toc] | [prev] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-09-07 13:40 +0200 |
| Message-ID | <seJmV-7z9-19@gated-at.bofh.it> |
| In reply to | #1478172 |
On Wednesday, September 7, 2016 1:39:16 PM CEST Felipe Balbi wrote:
>
> 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.
>
I'm sure this solves the problem too
Acked-by: Arnd Bergmann <arnd@arndb.de>
I usually prefer the __maybe_unused annotation over the #ifdef
because it's much harder to get wrong, but I'm really only interested
in killing that last warning in the v4.8 kernel build at the
moment ;-)
I am getting a bit annoyed with seeing at least half a dozen such
bugs every week (in linux-next) and I have an idea for how to replace
SET_SYSTEM_SLEEP_PM_OPS() etc with something that doesn't need any
#ifdef of __maybe_unused, but that is a bigger chunk of work that
will require careful planning.
Arnd
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web