diff mbox series

usb: hide unused usbfs_notify_suspend/resume functions

Message ID 20230516202103.558301-1-arnd@kernel.org (mailing list archive)
State Accepted
Commit 8e6bd945e6dde64fbc60ec3fe252164493a8d3a2
Headers show
Series usb: hide unused usbfs_notify_suspend/resume functions | expand

Commit Message

Arnd Bergmann May 16, 2023, 8:17 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

The declaration is in an #ifdef, which causes warnings when building
with 'make W=1' and without CONFIG_PM:

drivers/usb/core/devio.c:742:6: error: no previous prototype for 'usbfs_notify_suspend'
drivers/usb/core/devio.c:747:6: error: no previous prototype for 'usbfs_notify_resume'

Use the same #ifdef check around the function definitions to avoid
the warnings and slightly shrink the USB core.

Fixes: 7794f486ed0b ("usbfs: Add ioctls for runtime power management")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/usb/core/devio.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Sebastian Reichel May 16, 2023, 8:44 p.m. UTC | #1
Hi,

On Tue, May 16, 2023 at 10:17:42PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The declaration is in an #ifdef, which causes warnings when building
> with 'make W=1' and without CONFIG_PM:
> 
> drivers/usb/core/devio.c:742:6: error: no previous prototype for 'usbfs_notify_suspend'
> drivers/usb/core/devio.c:747:6: error: no previous prototype for 'usbfs_notify_resume'
> 
> Use the same #ifdef check around the function definitions to avoid
> the warnings and slightly shrink the USB core.
> 
> Fixes: 7794f486ed0b ("usbfs: Add ioctls for runtime power management")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

I have no clue why I'm CC'd, but patch LGTM:

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>

-- Sebastian

>  drivers/usb/core/devio.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
> index e501a03d6c70..1622ad35428d 100644
> --- a/drivers/usb/core/devio.c
> +++ b/drivers/usb/core/devio.c
> @@ -738,6 +738,7 @@ static int driver_resume(struct usb_interface *intf)
>  	return 0;
>  }
>  
> +#ifdef CONFIG_PM
>  /* The following routines apply to the entire device, not interfaces */
>  void usbfs_notify_suspend(struct usb_device *udev)
>  {
> @@ -756,6 +757,7 @@ void usbfs_notify_resume(struct usb_device *udev)
>  	}
>  	mutex_unlock(&usbfs_mutex);
>  }
> +#endif
>  
>  struct usb_driver usbfs_driver = {
>  	.name =		"usbfs",
> -- 
> 2.39.2
>
Alan Stern May 16, 2023, 8:53 p.m. UTC | #2
On Tue, May 16, 2023 at 10:17:42PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The declaration is in an #ifdef, which causes warnings when building
> with 'make W=1' and without CONFIG_PM:
> 
> drivers/usb/core/devio.c:742:6: error: no previous prototype for 'usbfs_notify_suspend'
> drivers/usb/core/devio.c:747:6: error: no previous prototype for 'usbfs_notify_resume'
> 
> Use the same #ifdef check around the function definitions to avoid
> the warnings and slightly shrink the USB core.
> 
> Fixes: 7794f486ed0b ("usbfs: Add ioctls for runtime power management")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

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

>  drivers/usb/core/devio.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
> index e501a03d6c70..1622ad35428d 100644
> --- a/drivers/usb/core/devio.c
> +++ b/drivers/usb/core/devio.c
> @@ -738,6 +738,7 @@ static int driver_resume(struct usb_interface *intf)
>  	return 0;
>  }
>  
> +#ifdef CONFIG_PM
>  /* The following routines apply to the entire device, not interfaces */
>  void usbfs_notify_suspend(struct usb_device *udev)
>  {
> @@ -756,6 +757,7 @@ void usbfs_notify_resume(struct usb_device *udev)
>  	}
>  	mutex_unlock(&usbfs_mutex);
>  }
> +#endif
>  
>  struct usb_driver usbfs_driver = {
>  	.name =		"usbfs",
> -- 
> 2.39.2
>
diff mbox series

Patch

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index e501a03d6c70..1622ad35428d 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -738,6 +738,7 @@  static int driver_resume(struct usb_interface *intf)
 	return 0;
 }
 
+#ifdef CONFIG_PM
 /* The following routines apply to the entire device, not interfaces */
 void usbfs_notify_suspend(struct usb_device *udev)
 {
@@ -756,6 +757,7 @@  void usbfs_notify_resume(struct usb_device *udev)
 	}
 	mutex_unlock(&usbfs_mutex);
 }
+#endif
 
 struct usb_driver usbfs_driver = {
 	.name =		"usbfs",