2015-02-07 21:00:26

by Andreas Ruprecht

[permalink] [raw]
Subject: [PATCH] usb/core: Remove unneeded #ifdef and associated dead code

In commit ceb6c9c862c8 ("USB / PM: Drop CONFIG_PM_RUNTIME from the
USB core"), all occurrences of CONFIG_PM_RUNTIME in the USB core
code were replaced by CONFIG_PM. This created the following structure
of #ifdef blocks in drivers/usb/core/hub.c:

[...]
#ifdef CONFIG_PM
#ifdef CONFIG_PM
/* always on / undead */
#else
/* dead */
#endif
[...]

This patch removes the function in the dead #ifdef block and the
unnecessary inner #ifdef. This inconsistency was found using the
undertaker-checkpatch tool.

Signed-off-by: Andreas Ruprecht <[email protected]>
---
drivers/usb/core/hub.c | 12 ------------
1 file changed, 12 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 3e9c4d4..c362bbc 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -3452,8 +3452,6 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
return status;
}

-#ifdef CONFIG_PM
-
int usb_remote_wakeup(struct usb_device *udev)
{
int status = 0;
@@ -3512,16 +3510,6 @@ static int hub_handle_remote_wakeup(struct usb_hub *hub, unsigned int port,
return connect_change;
}

-#else
-
-static int hub_handle_remote_wakeup(struct usb_hub *hub, unsigned int port,
- u16 portstatus, u16 portchange)
-{
- return 0;
-}
-
-#endif
-
static int check_ports_changed(struct usb_hub *hub)
{
int port1;
--
1.9.1


2015-02-08 19:37:36

by Andreas Ruprecht

[permalink] [raw]
Subject: [PATCH v2] usb: core: Remove unneeded #ifdef and associated dead code

In commit ceb6c9c862c8 ("USB / PM: Drop CONFIG_PM_RUNTIME from the
USB core"), all occurrences of CONFIG_PM_RUNTIME in the USB core
code were replaced by CONFIG_PM. This created the following structure
of #ifdef blocks in drivers/usb/core/hub.c:

[...]
#ifdef CONFIG_PM
#ifdef CONFIG_PM
/* always on / undead */
#else
/* dead */
#endif
[...]

This patch removes unnecessary inner "#ifdef CONFIG_PM" as well as
the corresponding dead #else block. This inconsistency was found using
the undertaker-checkpatch tool.

Signed-off-by: Andreas Ruprecht <[email protected]>
---
Changes to v1:
- Better description of what was removed in the commit message

drivers/usb/core/hub.c | 12 ------------
1 file changed, 12 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 3e9c4d4..c362bbc 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -3452,8 +3452,6 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
return status;
}

-#ifdef CONFIG_PM
-
int usb_remote_wakeup(struct usb_device *udev)
{
int status = 0;
@@ -3512,16 +3510,6 @@ static int hub_handle_remote_wakeup(struct usb_hub *hub, unsigned int port,
return connect_change;
}

-#else
-
-static int hub_handle_remote_wakeup(struct usb_hub *hub, unsigned int port,
- u16 portstatus, u16 portchange)
-{
- return 0;
-}
-
-#endif
-
static int check_ports_changed(struct usb_hub *hub)
{
int port1;
--
1.9.1

2015-02-08 22:42:51

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH v2] usb: core: Remove unneeded #ifdef and associated dead code

On Sunday, February 08, 2015 08:36:38 PM Andreas Ruprecht wrote:
> In commit ceb6c9c862c8 ("USB / PM: Drop CONFIG_PM_RUNTIME from the
> USB core"), all occurrences of CONFIG_PM_RUNTIME in the USB core
> code were replaced by CONFIG_PM. This created the following structure
> of #ifdef blocks in drivers/usb/core/hub.c:
>
> [...]
> #ifdef CONFIG_PM
> #ifdef CONFIG_PM
> /* always on / undead */
> #else
> /* dead */
> #endif
> [...]
>
> This patch removes unnecessary inner "#ifdef CONFIG_PM" as well as
> the corresponding dead #else block. This inconsistency was found using
> the undertaker-checkpatch tool.
>
> Signed-off-by: Andreas Ruprecht <[email protected]>

Applied, thanks!

> ---
> Changes to v1:
> - Better description of what was removed in the commit message
>
> drivers/usb/core/hub.c | 12 ------------
> 1 file changed, 12 deletions(-)
>
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 3e9c4d4..c362bbc 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -3452,8 +3452,6 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
> return status;
> }
>
> -#ifdef CONFIG_PM
> -
> int usb_remote_wakeup(struct usb_device *udev)
> {
> int status = 0;
> @@ -3512,16 +3510,6 @@ static int hub_handle_remote_wakeup(struct usb_hub *hub, unsigned int port,
> return connect_change;
> }
>
> -#else
> -
> -static int hub_handle_remote_wakeup(struct usb_hub *hub, unsigned int port,
> - u16 portstatus, u16 portchange)
> -{
> - return 0;
> -}
> -
> -#endif
> -
> static int check_ports_changed(struct usb_hub *hub)
> {
> int port1;
>

--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.