public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: host: xhci: remove #ifdef around PM functions
@ 2017-04-21 21:42 Arnd Bergmann
  2017-04-21 22:02 ` Guenter Roeck
  2017-04-26 20:55 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2017-04-21 21:42 UTC (permalink / raw)
  To: Mathias Nyman, Greg Kroah-Hartman
  Cc: Arnd Bergmann, Yoshihiro Shimoda, Felipe Balbi, Heikki Krogerus,
	Guenter Roeck, Baolin Wang, Lu Baolu, linux-usb, linux-kernel

The #ifdef is slightly wrong as it doesn't cover the xhci_priv_resume_quirk()
function, causing a harmless warning:

drivers/usb/host/xhci-plat.c:58:12: error: 'xhci_priv_resume_quirk' defined but not used [-Werror=unused-function]
 static int xhci_priv_resume_quirk(struct usb_hcd *hcd)

A simpler way to do this correctly is to use __maybe_unused annotations
that let the compiler silently drop the functions when there is no
reference.

Fixes: b0c69b4bace3 ("usb: host: plat: Enable xHCI plat runtime PM")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/usb/host/xhci-plat.c | 12 ++++--------
 drivers/usb/host/xhci.h      |  5 -----
 2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 057571fab599..7c2a9e7c8e0f 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -355,8 +355,7 @@ static int xhci_plat_remove(struct platform_device *dev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
-static int xhci_plat_suspend(struct device *dev)
+static int __maybe_unused xhci_plat_suspend(struct device *dev)
 {
 	struct usb_hcd	*hcd = dev_get_drvdata(dev);
 	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
@@ -378,7 +377,7 @@ static int xhci_plat_suspend(struct device *dev)
 	return ret;
 }
 
-static int xhci_plat_resume(struct device *dev)
+static int __maybe_unused xhci_plat_resume(struct device *dev)
 {
 	struct usb_hcd	*hcd = dev_get_drvdata(dev);
 	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
@@ -393,10 +392,8 @@ static int xhci_plat_resume(struct device *dev)
 
 	return xhci_resume(xhci, 0);
 }
-#endif /* CONFIG_PM_SLEEP */
 
-#ifdef CONFIG_PM
-static int xhci_plat_runtime_suspend(struct device *dev)
+static int __maybe_unused xhci_plat_runtime_suspend(struct device *dev)
 {
 	struct usb_hcd  *hcd = dev_get_drvdata(dev);
 	struct xhci_hcd *xhci = hcd_to_xhci(hcd);
@@ -404,14 +401,13 @@ static int xhci_plat_runtime_suspend(struct device *dev)
 	return xhci_suspend(xhci, true);
 }
 
-static int xhci_plat_runtime_resume(struct device *dev)
+static int __maybe_unused xhci_plat_runtime_resume(struct device *dev)
 {
 	struct usb_hcd  *hcd = dev_get_drvdata(dev);
 	struct xhci_hcd *xhci = hcd_to_xhci(hcd);
 
 	return xhci_resume(xhci, 0);
 }
-#endif /* CONFIG_PM */
 
 static const struct dev_pm_ops xhci_plat_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(xhci_plat_suspend, xhci_plat_resume)
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index cae8fb901aa8..73a28a986d5e 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -2004,13 +2004,8 @@ void xhci_init_driver(struct hc_driver *drv,
 int xhci_disable_slot(struct xhci_hcd *xhci,
 			struct xhci_command *command, u32 slot_id);
 
-#ifdef	CONFIG_PM
 int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup);
 int xhci_resume(struct xhci_hcd *xhci, bool hibernated);
-#else
-#define	xhci_suspend	NULL
-#define	xhci_resume	NULL
-#endif
 
 irqreturn_t xhci_irq(struct usb_hcd *hcd);
 irqreturn_t xhci_msi_irq(int irq, void *hcd);
-- 
2.9.0

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

* Re: [PATCH] usb: host: xhci: remove #ifdef around PM functions
  2017-04-21 21:42 [PATCH] usb: host: xhci: remove #ifdef around PM functions Arnd Bergmann
@ 2017-04-21 22:02 ` Guenter Roeck
  2017-04-26 20:55 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2017-04-21 22:02 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Mathias Nyman, Greg Kroah-Hartman, Yoshihiro Shimoda,
	Felipe Balbi, Heikki Krogerus, Baolin Wang, Lu Baolu, linux-usb,
	linux-kernel

On Fri, Apr 21, 2017 at 11:42:54PM +0200, Arnd Bergmann wrote:
> The #ifdef is slightly wrong as it doesn't cover the xhci_priv_resume_quirk()
> function, causing a harmless warning:
> 
> drivers/usb/host/xhci-plat.c:58:12: error: 'xhci_priv_resume_quirk' defined but not used [-Werror=unused-function]
>  static int xhci_priv_resume_quirk(struct usb_hcd *hcd)
> 
> A simpler way to do this correctly is to use __maybe_unused annotations
> that let the compiler silently drop the functions when there is no
> reference.
> 
> Fixes: b0c69b4bace3 ("usb: host: plat: Enable xHCI plat runtime PM")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/usb/host/xhci-plat.c | 12 ++++--------
>  drivers/usb/host/xhci.h      |  5 -----
>  2 files changed, 4 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> index 057571fab599..7c2a9e7c8e0f 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -355,8 +355,7 @@ static int xhci_plat_remove(struct platform_device *dev)
>  	return 0;
>  }
>  
> -#ifdef CONFIG_PM_SLEEP
> -static int xhci_plat_suspend(struct device *dev)
> +static int __maybe_unused xhci_plat_suspend(struct device *dev)
>  {
>  	struct usb_hcd	*hcd = dev_get_drvdata(dev);
>  	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
> @@ -378,7 +377,7 @@ static int xhci_plat_suspend(struct device *dev)
>  	return ret;
>  }
>  
> -static int xhci_plat_resume(struct device *dev)
> +static int __maybe_unused xhci_plat_resume(struct device *dev)
>  {
>  	struct usb_hcd	*hcd = dev_get_drvdata(dev);
>  	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
> @@ -393,10 +392,8 @@ static int xhci_plat_resume(struct device *dev)
>  
>  	return xhci_resume(xhci, 0);
>  }
> -#endif /* CONFIG_PM_SLEEP */
>  
> -#ifdef CONFIG_PM
> -static int xhci_plat_runtime_suspend(struct device *dev)
> +static int __maybe_unused xhci_plat_runtime_suspend(struct device *dev)
>  {
>  	struct usb_hcd  *hcd = dev_get_drvdata(dev);
>  	struct xhci_hcd *xhci = hcd_to_xhci(hcd);
> @@ -404,14 +401,13 @@ static int xhci_plat_runtime_suspend(struct device *dev)
>  	return xhci_suspend(xhci, true);
>  }
>  
> -static int xhci_plat_runtime_resume(struct device *dev)
> +static int __maybe_unused xhci_plat_runtime_resume(struct device *dev)
>  {
>  	struct usb_hcd  *hcd = dev_get_drvdata(dev);
>  	struct xhci_hcd *xhci = hcd_to_xhci(hcd);
>  
>  	return xhci_resume(xhci, 0);
>  }
> -#endif /* CONFIG_PM */
>  
>  static const struct dev_pm_ops xhci_plat_pm_ops = {
>  	SET_SYSTEM_SLEEP_PM_OPS(xhci_plat_suspend, xhci_plat_resume)
> diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
> index cae8fb901aa8..73a28a986d5e 100644
> --- a/drivers/usb/host/xhci.h
> +++ b/drivers/usb/host/xhci.h
> @@ -2004,13 +2004,8 @@ void xhci_init_driver(struct hc_driver *drv,
>  int xhci_disable_slot(struct xhci_hcd *xhci,
>  			struct xhci_command *command, u32 slot_id);
>  
> -#ifdef	CONFIG_PM
>  int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup);
>  int xhci_resume(struct xhci_hcd *xhci, bool hibernated);
> -#else
> -#define	xhci_suspend	NULL
> -#define	xhci_resume	NULL
> -#endif
>  
>  irqreturn_t xhci_irq(struct usb_hcd *hcd);
>  irqreturn_t xhci_msi_irq(int irq, void *hcd);
> -- 
> 2.9.0
> 

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

* Re: [PATCH] usb: host: xhci: remove #ifdef around PM functions
  2017-04-21 21:42 [PATCH] usb: host: xhci: remove #ifdef around PM functions Arnd Bergmann
  2017-04-21 22:02 ` Guenter Roeck
@ 2017-04-26 20:55 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2017-04-26 20:55 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Mathias Nyman, Yoshihiro Shimoda, Felipe Balbi, Heikki Krogerus,
	Guenter Roeck, Baolin Wang, Lu Baolu, linux-usb, linux-kernel

On Fri, Apr 21, 2017 at 11:42:54PM +0200, Arnd Bergmann wrote:
> The #ifdef is slightly wrong as it doesn't cover the xhci_priv_resume_quirk()
> function, causing a harmless warning:
> 
> drivers/usb/host/xhci-plat.c:58:12: error: 'xhci_priv_resume_quirk' defined but not used [-Werror=unused-function]
>  static int xhci_priv_resume_quirk(struct usb_hcd *hcd)
> 
> A simpler way to do this correctly is to use __maybe_unused annotations
> that let the compiler silently drop the functions when there is no
> reference.
> 
> Fixes: b0c69b4bace3 ("usb: host: plat: Enable xHCI plat runtime PM")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/usb/host/xhci-plat.c | 12 ++++--------
>  drivers/usb/host/xhci.h      |  5 -----
>  2 files changed, 4 insertions(+), 13 deletions(-)

Now applied, thanks.

greg k-h

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

end of thread, other threads:[~2017-04-26 20:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-21 21:42 [PATCH] usb: host: xhci: remove #ifdef around PM functions Arnd Bergmann
2017-04-21 22:02 ` Guenter Roeck
2017-04-26 20:55 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox