linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] usb: host: unhide suspend/resume declarations
       [not found] <1456932255-71725-1-git-send-email-arnd@arndb.de>
@ 2016-03-02 15:24 ` Arnd Bergmann
  2016-03-02 15:58   ` Alan Stern
  2016-03-02 15:24 ` [PATCH 2/6] usb: xhci-mtk: use __maybe_unused to hide pm functions Arnd Bergmann
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Arnd Bergmann @ 2016-03-02 15:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-arm-kernel, Felipe Balbi, Alan Stern, linux-usb,
	Arnd Bergmann, linux-kernel

There is no need to hide function declarations, and making
these visible to the SoC specific host drivers lets us
use __maybe_unused and IS_ENABLED() checks to control
their use, rather than having to use #ifdef to hide all
callers.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/usb/host/ehci.h | 2 --
 drivers/usb/host/ohci.h | 2 --
 2 files changed, 4 deletions(-)

diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 2ddf35203c05..3f3b74aeca97 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -888,12 +888,10 @@ extern int	ehci_handshake(struct ehci_hcd *ehci, void __iomem *ptr,
 				u32 mask, u32 done, int usec);
 extern int	ehci_reset(struct ehci_hcd *ehci);
 
-#ifdef CONFIG_PM
 extern int	ehci_suspend(struct usb_hcd *hcd, bool do_wakeup);
 extern int	ehci_resume(struct usb_hcd *hcd, bool force_reset);
 extern void	ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci,
 			bool suspending, bool do_wakeup);
-#endif	/* CONFIG_PM */
 
 extern int	ehci_hub_control(struct usb_hcd	*hcd, u16 typeReq, u16 wValue,
 				 u16 wIndex, char *buf, u16 wLength);
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index bc462288cfb0..37f1725e7a46 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -735,10 +735,8 @@ extern void	ohci_init_driver(struct hc_driver *drv,
 				const struct ohci_driver_overrides *over);
 extern int	ohci_restart(struct ohci_hcd *ohci);
 extern int	ohci_setup(struct usb_hcd *hcd);
-#ifdef CONFIG_PM
 extern int	ohci_suspend(struct usb_hcd *hcd, bool do_wakeup);
 extern int	ohci_resume(struct usb_hcd *hcd, bool hibernated);
-#endif
 extern int	ohci_hub_control(struct usb_hcd	*hcd, u16 typeReq, u16 wValue,
 				 u16 wIndex, char *buf, u16 wLength);
 extern int	ohci_hub_status_data(struct usb_hcd *hcd, char *buf);
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/6] usb: xhci-mtk: use __maybe_unused to hide pm functions
       [not found] <1456932255-71725-1-git-send-email-arnd@arndb.de>
  2016-03-02 15:24 ` [PATCH 1/6] usb: host: unhide suspend/resume declarations Arnd Bergmann
@ 2016-03-02 15:24 ` Arnd Bergmann
  2016-03-04 16:33   ` Matthias Brugger
  2016-03-02 15:24 ` [PATCH 3/6] usb: ohci-at91: " Arnd Bergmann
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Arnd Bergmann @ 2016-03-02 15:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-arm-kernel, Felipe Balbi, Alan Stern, linux-usb,
	Arnd Bergmann, Mathias Nyman, Matthias Brugger, linux-mediatek,
	linux-kernel

The mediatek XHCI glue driver uses SET_SYSTEM_SLEEP_PM_OPS() to
conditionally set the correct suspend/resume options, and
also puts both the dev_pm_ops and the functions inside of
an #ifdef testing for CONFIG_PM_SLEEP, but those functions
then call other code that becomes unused:

drivers/usb/host/xhci-mtk.c:135:12: error: 'xhci_mtk_host_disable' defined but not used [-Werror=unused-function]
drivers/usb/host/xhci-mtk.c:313:13: error: 'usb_wakeup_enable' defined but not used [-Werror=unused-function]
drivers/usb/host/xhci-mtk.c:321:13: error: 'usb_wakeup_disable' defined but not used [-Werror=unused-function]

This replaces the #ifdef with __maybe_unused annotations so the
compiler knows it can silently drop them instead of warning.

For the DEV_PM_OPS definition, we can use an IS_ENABLED() check
to avoid defining the structure when CONFIG_PM is not set without
the #ifdef.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/usb/host/xhci-mtk.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index 9532f5aef71b..79959f17c38c 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -695,7 +695,6 @@ static int xhci_mtk_remove(struct platform_device *dev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 /*
  * if ip sleep fails, and all clocks are disabled, access register will hang
  * AHB bus, so stop polling roothubs to avoid regs access on bus suspend.
@@ -703,7 +702,7 @@ static int xhci_mtk_remove(struct platform_device *dev)
  * to wake up system immediately after system suspend complete if ip sleep
  * fails, it is what we wanted.
  */
-static int xhci_mtk_suspend(struct device *dev)
+static int __maybe_unused xhci_mtk_suspend(struct device *dev)
 {
 	struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev);
 	struct usb_hcd *hcd = mtk->hcd;
@@ -722,7 +721,7 @@ static int xhci_mtk_suspend(struct device *dev)
 	return 0;
 }
 
-static int xhci_mtk_resume(struct device *dev)
+static int __maybe_unused xhci_mtk_resume(struct device *dev)
 {
 	struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev);
 	struct usb_hcd *hcd = mtk->hcd;
@@ -744,10 +743,7 @@ static int xhci_mtk_resume(struct device *dev)
 static const struct dev_pm_ops xhci_mtk_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(xhci_mtk_suspend, xhci_mtk_resume)
 };
-#define DEV_PM_OPS	(&xhci_mtk_pm_ops)
-#else
-#define DEV_PM_OPS	NULL
-#endif /* CONFIG_PM */
+#define DEV_PM_OPS IS_ENABLED(CONFIG_PM) ? &xhci_mtk_pm_ops : NULL
 
 #ifdef CONFIG_OF
 static const struct of_device_id mtk_xhci_of_match[] = {
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/6] usb: ohci-at91: use __maybe_unused to hide pm functions
       [not found] <1456932255-71725-1-git-send-email-arnd@arndb.de>
  2016-03-02 15:24 ` [PATCH 1/6] usb: host: unhide suspend/resume declarations Arnd Bergmann
  2016-03-02 15:24 ` [PATCH 2/6] usb: xhci-mtk: use __maybe_unused to hide pm functions Arnd Bergmann
@ 2016-03-02 15:24 ` Arnd Bergmann
  2016-03-02 15:34   ` Nicolas Ferre
  2016-03-02 15:24 ` [PATCH 4/6] usb: ehci-atmel: " Arnd Bergmann
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Arnd Bergmann @ 2016-03-02 15:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-arm-kernel, Felipe Balbi, Alan Stern, linux-usb,
	Arnd Bergmann, linux-kernel

The ohci-at91 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/ohci-at91.c:587:1: error: 'ohci_hcd_at91_drv_suspend' defined but not used [-Werror=unused-function]
drivers/usb/host/ohci-at91.c:631:12: error: 'ohci_hcd_at91_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/ohci-at91.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 95c8ddde0725..d177372bb357 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -581,9 +581,7 @@ static int ohci_hcd_at91_drv_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM
-
-static int
+static int __maybe_unused
 ohci_hcd_at91_drv_suspend(struct device *dev)
 {
 	struct usb_hcd	*hcd = dev_get_drvdata(dev);
@@ -628,7 +626,8 @@ ohci_hcd_at91_drv_suspend(struct device *dev)
 	return ret;
 }
 
-static int ohci_hcd_at91_drv_resume(struct device *dev)
+static int __maybe_unused
+ohci_hcd_at91_drv_resume(struct device *dev)
 {
 	struct usb_hcd	*hcd = dev_get_drvdata(dev);
 	struct ohci_at91_priv *ohci_at91 = hcd_to_ohci_at91_priv(hcd);
@@ -641,7 +640,6 @@ static int ohci_hcd_at91_drv_resume(struct device *dev)
 	ohci_resume(hcd, false);
 	return 0;
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(ohci_hcd_at91_pm_ops, ohci_hcd_at91_drv_suspend,
 					ohci_hcd_at91_drv_resume);
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/6] usb: ehci-atmel: use __maybe_unused to hide pm functions
       [not found] <1456932255-71725-1-git-send-email-arnd@arndb.de>
                   ` (2 preceding siblings ...)
  2016-03-02 15:24 ` [PATCH 3/6] usb: ohci-at91: " Arnd Bergmann
@ 2016-03-02 15:24 ` Arnd Bergmann
  2016-03-02 15:34   ` Nicolas Ferre
  2016-03-02 15:24 ` [PATCH 5/6] phy: dm816x: " Arnd Bergmann
  2016-03-02 15:24 ` [PATCH 6/6] phy: twl4030: " Arnd Bergmann
  5 siblings, 1 reply; 11+ messages in thread
From: Arnd Bergmann @ 2016-03-02 15:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-arm-kernel, Felipe Balbi, Alan Stern, linux-usb,
	Arnd Bergmann, linux-kernel

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/6] phy: dm816x: use __maybe_unused to hide pm functions
       [not found] <1456932255-71725-1-git-send-email-arnd@arndb.de>
                   ` (3 preceding siblings ...)
  2016-03-02 15:24 ` [PATCH 4/6] usb: ehci-atmel: " Arnd Bergmann
@ 2016-03-02 15:24 ` Arnd Bergmann
  2016-03-02 15:24 ` [PATCH 6/6] phy: twl4030: " Arnd Bergmann
  5 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2016-03-02 15:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Kishon Vijay Abraham I
  Cc: linux-arm-kernel, Felipe Balbi, Alan Stern, linux-usb,
	Arnd Bergmann, linux-kernel

The dm816x USB PHY driver uses UNIVERSAL_DEV_PM_OPS to access
its suspend/resume functions, which causes a warning about
unused symbols when CONFIG_PM is disabled:

drivers/phy/phy-dm816x-usb.c:121:12: error: 'dm816x_usb_phy_runtime_suspend' defined but not used [-Werror=unused-function]
drivers/phy/phy-dm816x-usb.c:139:12: error: 'dm816x_usb_phy_runtime_resume' defined but not used [-Werror=unused-function]

This adds __maybe_unused annotations to let the compiler know
it can silently drop the function definition.

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

diff --git a/drivers/phy/phy-dm816x-usb.c b/drivers/phy/phy-dm816x-usb.c
index b4bbef664d20..cbcce7cf0028 100644
--- a/drivers/phy/phy-dm816x-usb.c
+++ b/drivers/phy/phy-dm816x-usb.c
@@ -118,7 +118,7 @@ static const struct phy_ops ops = {
 	.owner		= THIS_MODULE,
 };
 
-static int dm816x_usb_phy_runtime_suspend(struct device *dev)
+static int __maybe_unused dm816x_usb_phy_runtime_suspend(struct device *dev)
 {
 	struct dm816x_usb_phy *phy = dev_get_drvdata(dev);
 	unsigned int mask, val;
@@ -136,7 +136,7 @@ static int dm816x_usb_phy_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-static int dm816x_usb_phy_runtime_resume(struct device *dev)
+static int __maybe_unused dm816x_usb_phy_runtime_resume(struct device *dev)
 {
 	struct dm816x_usb_phy *phy = dev_get_drvdata(dev);
 	unsigned int mask, val;
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 6/6] phy: twl4030: use __maybe_unused to hide pm functions
       [not found] <1456932255-71725-1-git-send-email-arnd@arndb.de>
                   ` (4 preceding siblings ...)
  2016-03-02 15:24 ` [PATCH 5/6] phy: dm816x: " Arnd Bergmann
@ 2016-03-02 15:24 ` Arnd Bergmann
  5 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2016-03-02 15:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Kishon Vijay Abraham I
  Cc: linux-arm-kernel, Felipe Balbi, Alan Stern, linux-usb,
	Arnd Bergmann, linux-kernel

The twl4030 USB PHY driver uses UNIVERSAL_DEV_PM_OPS to access
its suspend/resume functions, which causes a warning about
unused symbols when CONFIG_PM is disabled:

drivers/phy/phy-twl4030-usb.c:394:12: error: 'twl4030_usb_runtime_suspend' defined but not used [-Werror=unused-function]
drivers/phy/phy-twl4030-usb.c:408:12: error: 'twl4030_usb_runtime_resume' defined but not used [-Werror=unused-function]

This adds __maybe_unused annotations to let the compiler know
it can silently drop the function definition.

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

diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c
index 840f3eae428b..6b6af6cba454 100644
--- a/drivers/phy/phy-twl4030-usb.c
+++ b/drivers/phy/phy-twl4030-usb.c
@@ -391,7 +391,7 @@ static void __twl4030_phy_power(struct twl4030_usb *twl, int on)
 	WARN_ON(twl4030_usb_write_verify(twl, PHY_PWR_CTRL, pwr) < 0);
 }
 
-static int twl4030_usb_runtime_suspend(struct device *dev)
+static int __maybe_unused twl4030_usb_runtime_suspend(struct device *dev)
 {
 	struct twl4030_usb *twl = dev_get_drvdata(dev);
 
@@ -405,7 +405,7 @@ static int twl4030_usb_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-static int twl4030_usb_runtime_resume(struct device *dev)
+static int __maybe_unused twl4030_usb_runtime_resume(struct device *dev)
 {
 	struct twl4030_usb *twl = dev_get_drvdata(dev);
 	int res;
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/6] usb: ohci-at91: use __maybe_unused to hide pm functions
  2016-03-02 15:24 ` [PATCH 3/6] usb: ohci-at91: " Arnd Bergmann
@ 2016-03-02 15:34   ` Nicolas Ferre
  0 siblings, 0 replies; 11+ messages in thread
From: Nicolas Ferre @ 2016-03-02 15:34 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman
  Cc: Felipe Balbi, linux-usb, linux-kernel, Alan Stern, linux-arm-kernel

Le 02/03/2016 16:24, Arnd Bergmann a écrit :
> The ohci-at91 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/ohci-at91.c:587:1: error: 'ohci_hcd_at91_drv_suspend' defined but not used [-Werror=unused-function]
> drivers/usb/host/ohci-at91.c:631:12: error: 'ohci_hcd_at91_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>

Thanks Arnd, bye.

> ---
>  drivers/usb/host/ohci-at91.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
> index 95c8ddde0725..d177372bb357 100644
> --- a/drivers/usb/host/ohci-at91.c
> +++ b/drivers/usb/host/ohci-at91.c
> @@ -581,9 +581,7 @@ static int ohci_hcd_at91_drv_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -#ifdef CONFIG_PM
> -
> -static int
> +static int __maybe_unused
>  ohci_hcd_at91_drv_suspend(struct device *dev)
>  {
>  	struct usb_hcd	*hcd = dev_get_drvdata(dev);
> @@ -628,7 +626,8 @@ ohci_hcd_at91_drv_suspend(struct device *dev)
>  	return ret;
>  }
>  
> -static int ohci_hcd_at91_drv_resume(struct device *dev)
> +static int __maybe_unused
> +ohci_hcd_at91_drv_resume(struct device *dev)
>  {
>  	struct usb_hcd	*hcd = dev_get_drvdata(dev);
>  	struct ohci_at91_priv *ohci_at91 = hcd_to_ohci_at91_priv(hcd);
> @@ -641,7 +640,6 @@ static int ohci_hcd_at91_drv_resume(struct device *dev)
>  	ohci_resume(hcd, false);
>  	return 0;
>  }
> -#endif
>  
>  static SIMPLE_DEV_PM_OPS(ohci_hcd_at91_pm_ops, ohci_hcd_at91_drv_suspend,
>  					ohci_hcd_at91_drv_resume);
> 


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/6] usb: ehci-atmel: use __maybe_unused to hide pm functions
  2016-03-02 15:24 ` [PATCH 4/6] usb: ehci-atmel: " Arnd Bergmann
@ 2016-03-02 15:34   ` Nicolas Ferre
  0 siblings, 0 replies; 11+ messages in thread
From: Nicolas Ferre @ 2016-03-02 15:34 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman
  Cc: Felipe Balbi, linux-usb, linux-kernel, Alan Stern, linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/6] usb: host: unhide suspend/resume declarations
  2016-03-02 15:24 ` [PATCH 1/6] usb: host: unhide suspend/resume declarations Arnd Bergmann
@ 2016-03-02 15:58   ` Alan Stern
  0 siblings, 0 replies; 11+ messages in thread
From: Alan Stern @ 2016-03-02 15:58 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Greg Kroah-Hartman, linux-arm-kernel, Felipe Balbi, linux-usb,
	linux-kernel

On Wed, 2 Mar 2016, Arnd Bergmann wrote:

> There is no need to hide function declarations, and making
> these visible to the SoC specific host drivers lets us
> use __maybe_unused and IS_ENABLED() checks to control
> their use, rather than having to use #ifdef to hide all
> callers.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/usb/host/ehci.h | 2 --
>  drivers/usb/host/ohci.h | 2 --
>  2 files changed, 4 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
> index 2ddf35203c05..3f3b74aeca97 100644
> --- a/drivers/usb/host/ehci.h
> +++ b/drivers/usb/host/ehci.h
> @@ -888,12 +888,10 @@ extern int	ehci_handshake(struct ehci_hcd *ehci, void __iomem *ptr,
>  				u32 mask, u32 done, int usec);
>  extern int	ehci_reset(struct ehci_hcd *ehci);
>  
> -#ifdef CONFIG_PM
>  extern int	ehci_suspend(struct usb_hcd *hcd, bool do_wakeup);
>  extern int	ehci_resume(struct usb_hcd *hcd, bool force_reset);
>  extern void	ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci,
>  			bool suspending, bool do_wakeup);
> -#endif	/* CONFIG_PM */
>  
>  extern int	ehci_hub_control(struct usb_hcd	*hcd, u16 typeReq, u16 wValue,
>  				 u16 wIndex, char *buf, u16 wLength);
> diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
> index bc462288cfb0..37f1725e7a46 100644
> --- a/drivers/usb/host/ohci.h
> +++ b/drivers/usb/host/ohci.h
> @@ -735,10 +735,8 @@ extern void	ohci_init_driver(struct hc_driver *drv,
>  				const struct ohci_driver_overrides *over);
>  extern int	ohci_restart(struct ohci_hcd *ohci);
>  extern int	ohci_setup(struct usb_hcd *hcd);
> -#ifdef CONFIG_PM
>  extern int	ohci_suspend(struct usb_hcd *hcd, bool do_wakeup);
>  extern int	ohci_resume(struct usb_hcd *hcd, bool hibernated);
> -#endif
>  extern int	ohci_hub_control(struct usb_hcd	*hcd, u16 typeReq, u16 wValue,
>  				 u16 wIndex, char *buf, u16 wLength);
>  extern int	ohci_hub_status_data(struct usb_hcd *hcd, char *buf);

Acked-by: Alan Stern <stern@rowland.harvard.edu>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/6] usb: xhci-mtk: use __maybe_unused to hide pm functions
  2016-03-02 15:24 ` [PATCH 2/6] usb: xhci-mtk: use __maybe_unused to hide pm functions Arnd Bergmann
@ 2016-03-04 16:33   ` Matthias Brugger
  2016-03-10 11:42     ` Mathias Nyman
  0 siblings, 1 reply; 11+ messages in thread
From: Matthias Brugger @ 2016-03-04 16:33 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman
  Cc: linux-arm-kernel, Felipe Balbi, Alan Stern, linux-usb,
	Mathias Nyman, linux-mediatek, linux-kernel



On 02/03/16 16:24, Arnd Bergmann wrote:
> The mediatek XHCI glue driver uses SET_SYSTEM_SLEEP_PM_OPS() to
> conditionally set the correct suspend/resume options, and
> also puts both the dev_pm_ops and the functions inside of
> an #ifdef testing for CONFIG_PM_SLEEP, but those functions
> then call other code that becomes unused:
>
> drivers/usb/host/xhci-mtk.c:135:12: error: 'xhci_mtk_host_disable' defined but not used [-Werror=unused-function]
> drivers/usb/host/xhci-mtk.c:313:13: error: 'usb_wakeup_enable' defined but not used [-Werror=unused-function]
> drivers/usb/host/xhci-mtk.c:321:13: error: 'usb_wakeup_disable' defined but not used [-Werror=unused-function]
>
> This replaces the #ifdef with __maybe_unused annotations so the
> compiler knows it can silently drop them instead of warning.
>
> For the DEV_PM_OPS definition, we can use an IS_ENABLED() check
> to avoid defining the structure when CONFIG_PM is not set without
> the #ifdef.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>

>   drivers/usb/host/xhci-mtk.c | 10 +++-------
>   1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
> index 9532f5aef71b..79959f17c38c 100644
> --- a/drivers/usb/host/xhci-mtk.c
> +++ b/drivers/usb/host/xhci-mtk.c
> @@ -695,7 +695,6 @@ static int xhci_mtk_remove(struct platform_device *dev)
>   	return 0;
>   }
>
> -#ifdef CONFIG_PM_SLEEP
>   /*
>    * if ip sleep fails, and all clocks are disabled, access register will hang
>    * AHB bus, so stop polling roothubs to avoid regs access on bus suspend.
> @@ -703,7 +702,7 @@ static int xhci_mtk_remove(struct platform_device *dev)
>    * to wake up system immediately after system suspend complete if ip sleep
>    * fails, it is what we wanted.
>    */
> -static int xhci_mtk_suspend(struct device *dev)
> +static int __maybe_unused xhci_mtk_suspend(struct device *dev)
>   {
>   	struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev);
>   	struct usb_hcd *hcd = mtk->hcd;
> @@ -722,7 +721,7 @@ static int xhci_mtk_suspend(struct device *dev)
>   	return 0;
>   }
>
> -static int xhci_mtk_resume(struct device *dev)
> +static int __maybe_unused xhci_mtk_resume(struct device *dev)
>   {
>   	struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev);
>   	struct usb_hcd *hcd = mtk->hcd;
> @@ -744,10 +743,7 @@ static int xhci_mtk_resume(struct device *dev)
>   static const struct dev_pm_ops xhci_mtk_pm_ops = {
>   	SET_SYSTEM_SLEEP_PM_OPS(xhci_mtk_suspend, xhci_mtk_resume)
>   };
> -#define DEV_PM_OPS	(&xhci_mtk_pm_ops)
> -#else
> -#define DEV_PM_OPS	NULL
> -#endif /* CONFIG_PM */
> +#define DEV_PM_OPS IS_ENABLED(CONFIG_PM) ? &xhci_mtk_pm_ops : NULL
>
>   #ifdef CONFIG_OF
>   static const struct of_device_id mtk_xhci_of_match[] = {
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/6] usb: xhci-mtk: use __maybe_unused to hide pm functions
  2016-03-04 16:33   ` Matthias Brugger
@ 2016-03-10 11:42     ` Mathias Nyman
  0 siblings, 0 replies; 11+ messages in thread
From: Mathias Nyman @ 2016-03-10 11:42 UTC (permalink / raw)
  To: Matthias Brugger, Arnd Bergmann, Greg Kroah-Hartman
  Cc: linux-arm-kernel, Felipe Balbi, Alan Stern, linux-usb,
	Mathias Nyman, linux-mediatek, linux-kernel

On 04.03.2016 18:33, Matthias Brugger wrote:
>
>
> On 02/03/16 16:24, Arnd Bergmann wrote:
>> The mediatek XHCI glue driver uses SET_SYSTEM_SLEEP_PM_OPS() to
>> conditionally set the correct suspend/resume options, and
>> also puts both the dev_pm_ops and the functions inside of
>> an #ifdef testing for CONFIG_PM_SLEEP, but those functions
>> then call other code that becomes unused:
>>
>> drivers/usb/host/xhci-mtk.c:135:12: error: 'xhci_mtk_host_disable' defined but not used [-Werror=unused-function]
>> drivers/usb/host/xhci-mtk.c:313:13: error: 'usb_wakeup_enable' defined but not used [-Werror=unused-function]
>> drivers/usb/host/xhci-mtk.c:321:13: error: 'usb_wakeup_disable' defined but not used [-Werror=unused-function]
>>
>> This replaces the #ifdef with __maybe_unused annotations so the
>> compiler knows it can silently drop them instead of warning.
>>
>> For the DEV_PM_OPS definition, we can use an IS_ENABLED() check
>> to avoid defining the structure when CONFIG_PM is not set without
>> the #ifdef.
>>
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>
> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
>

Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-03-10 11:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1456932255-71725-1-git-send-email-arnd@arndb.de>
2016-03-02 15:24 ` [PATCH 1/6] usb: host: unhide suspend/resume declarations Arnd Bergmann
2016-03-02 15:58   ` Alan Stern
2016-03-02 15:24 ` [PATCH 2/6] usb: xhci-mtk: use __maybe_unused to hide pm functions Arnd Bergmann
2016-03-04 16:33   ` Matthias Brugger
2016-03-10 11:42     ` Mathias Nyman
2016-03-02 15:24 ` [PATCH 3/6] usb: ohci-at91: " Arnd Bergmann
2016-03-02 15:34   ` Nicolas Ferre
2016-03-02 15:24 ` [PATCH 4/6] usb: ehci-atmel: " Arnd Bergmann
2016-03-02 15:34   ` Nicolas Ferre
2016-03-02 15:24 ` [PATCH 5/6] phy: dm816x: " Arnd Bergmann
2016-03-02 15:24 ` [PATCH 6/6] phy: twl4030: " Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).