Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1348156 > unrolled thread

[PATCH 4/6] usb: ehci-atmel: use __maybe_unused to hide pm functions

Started byArnd Bergmann <arnd@arndb.de>
First post2016-03-02 16:30 +0100
Last post2016-03-02 16:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4/6] usb: ehci-atmel: use __maybe_unused to hide pm functions Arnd Bergmann <arnd@arndb.de> - 2016-03-02 16:30 +0100
    Re: [PATCH 4/6] usb: ehci-atmel: use __maybe_unused to hide pm  functions Nicolas Ferre <nicolas.ferre@atmel.com> - 2016-03-02 16:40 +0100

#1348156 — [PATCH 4/6] usb: ehci-atmel: use __maybe_unused to hide pm functions

FromArnd Bergmann <arnd@arndb.de>
Date2016-03-02 16:30 +0100
Subject[PATCH 4/6] usb: ehci-atmel: use __maybe_unused to hide pm functions
Message-ID<r8gST-14i-39@gated-at.bofh.it>
The ehci-atmel driver uses #ifdef to check for CONFIG_PM, but then
uses SIMPLE_DEV_PM_OPS, which leaves the references out when
CONFIG_PM_SLEEP is not defined, so we get a warning with
PM=y && PM_SLEEP=n:

drivers/usb/host/ehci-atmel.c:189:12: error: 'ehci_atmel_drv_suspend' defined but not used [-Werror=unused-function]
drivers/usb/host/ehci-atmel.c:203:12: error: 'ehci_atmel_drv_resume' defined but not used [-Werror=unused-function]

This removes the incorrect #ifdef and instead uses a __maybe_unused
annotation to let the compiler know it can silently drop
the function definition.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/usb/host/ehci-atmel.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index be0964a801e8..7440722bfbf0 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -185,8 +185,7 @@ static int ehci_atmel_drv_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM
-static int ehci_atmel_drv_suspend(struct device *dev)
+static int __maybe_unused ehci_atmel_drv_suspend(struct device *dev)
 {
 	struct usb_hcd *hcd = dev_get_drvdata(dev);
 	struct atmel_ehci_priv *atmel_ehci = hcd_to_atmel_ehci_priv(hcd);
@@ -200,7 +199,7 @@ static int ehci_atmel_drv_suspend(struct device *dev)
 	return 0;
 }
 
-static int ehci_atmel_drv_resume(struct device *dev)
+static int __maybe_unused ehci_atmel_drv_resume(struct device *dev)
 {
 	struct usb_hcd *hcd = dev_get_drvdata(dev);
 	struct atmel_ehci_priv *atmel_ehci = hcd_to_atmel_ehci_priv(hcd);
@@ -208,7 +207,6 @@ static int ehci_atmel_drv_resume(struct device *dev)
 	atmel_start_clock(atmel_ehci);
 	return ehci_resume(hcd, false);
 }
-#endif
 
 #ifdef CONFIG_OF
 static const struct of_device_id atmel_ehci_dt_ids[] = {
-- 
2.7.0

[toc] | [next] | [standalone]


#1348164 — Re: [PATCH 4/6] usb: ehci-atmel: use __maybe_unused to hide pm functions

FromNicolas Ferre <nicolas.ferre@atmel.com>
Date2016-03-02 16:40 +0100
SubjectRe: [PATCH 4/6] usb: ehci-atmel: use __maybe_unused to hide pm functions
Message-ID<r8h2y-18n-29@gated-at.bofh.it>
In reply to#1348156
Le 02/03/2016 16:24, Arnd Bergmann a écrit :
> The ehci-atmel driver uses #ifdef to check for CONFIG_PM, but then
> uses SIMPLE_DEV_PM_OPS, which leaves the references out when
> CONFIG_PM_SLEEP is not defined, so we get a warning with
> PM=y && PM_SLEEP=n:
> 
> drivers/usb/host/ehci-atmel.c:189:12: error: 'ehci_atmel_drv_suspend' defined but not used [-Werror=unused-function]
> drivers/usb/host/ehci-atmel.c:203:12: error: 'ehci_atmel_drv_resume' defined but not used [-Werror=unused-function]
> 
> This removes the incorrect #ifdef and instead uses a __maybe_unused
> annotation to let the compiler know it can silently drop
> the function definition.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

> ---
>  drivers/usb/host/ehci-atmel.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
> index be0964a801e8..7440722bfbf0 100644
> --- a/drivers/usb/host/ehci-atmel.c
> +++ b/drivers/usb/host/ehci-atmel.c
> @@ -185,8 +185,7 @@ static int ehci_atmel_drv_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -#ifdef CONFIG_PM
> -static int ehci_atmel_drv_suspend(struct device *dev)
> +static int __maybe_unused ehci_atmel_drv_suspend(struct device *dev)
>  {
>  	struct usb_hcd *hcd = dev_get_drvdata(dev);
>  	struct atmel_ehci_priv *atmel_ehci = hcd_to_atmel_ehci_priv(hcd);
> @@ -200,7 +199,7 @@ static int ehci_atmel_drv_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int ehci_atmel_drv_resume(struct device *dev)
> +static int __maybe_unused ehci_atmel_drv_resume(struct device *dev)
>  {
>  	struct usb_hcd *hcd = dev_get_drvdata(dev);
>  	struct atmel_ehci_priv *atmel_ehci = hcd_to_atmel_ehci_priv(hcd);
> @@ -208,7 +207,6 @@ static int ehci_atmel_drv_resume(struct device *dev)
>  	atmel_start_clock(atmel_ehci);
>  	return ehci_resume(hcd, false);
>  }
> -#endif
>  
>  #ifdef CONFIG_OF
>  static const struct of_device_id atmel_ehci_dt_ids[] = {
> 


-- 
Nicolas Ferre

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web