linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Cleanup of -Wunused-const-variable in drivers/usb/host/xhci-tegra.c
@ 2019-06-13 18:38 Nathan Huckleberry
  2019-06-13 18:44 ` Greg KH
  2019-06-14  9:09 ` Cleanup of -Wunused-const-variable in drivers/usb/host/xhci-tegra.c Thierry Reding
  0 siblings, 2 replies; 5+ messages in thread
From: Nathan Huckleberry @ 2019-06-13 18:38 UTC (permalink / raw)
  To: treding, mathias.nyman, gregkh, thierry.reding, jonathanh
  Cc: linux-usb, linux-tegra, linux-kernel, clang-built-linux

Hey all,

I'm looking into cleaning up ignored warnings in the kernel so we can
remove compiler flags to ignore warnings.

There's an unused variable ('mbox_cmd_name') in xhci-tegra.c. Looks
like it was intended for logging or debugging, but never used. Just
wanted to reach out to ask the best steps for cleaning this up.

If the variable is no longer needed I'd like to send a patch to remove it.

https://github.com/ClangBuiltLinux/linux/issues/533

Thanks,
Nathan Huckleberry

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

* Re: Cleanup of -Wunused-const-variable in drivers/usb/host/xhci-tegra.c
  2019-06-13 18:38 Cleanup of -Wunused-const-variable in drivers/usb/host/xhci-tegra.c Nathan Huckleberry
@ 2019-06-13 18:44 ` Greg KH
  2019-06-13 18:58   ` [PATCH] usb: host: xhci-tegra: Fix Wunused-const-variable Nathan Huckleberry
  2019-06-14  9:09 ` Cleanup of -Wunused-const-variable in drivers/usb/host/xhci-tegra.c Thierry Reding
  1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2019-06-13 18:44 UTC (permalink / raw)
  To: Nathan Huckleberry
  Cc: treding, mathias.nyman, thierry.reding, jonathanh, linux-usb,
	linux-tegra, linux-kernel, clang-built-linux

On Thu, Jun 13, 2019 at 11:38:38AM -0700, Nathan Huckleberry wrote:
> Hey all,
> 
> I'm looking into cleaning up ignored warnings in the kernel so we can
> remove compiler flags to ignore warnings.
> 
> There's an unused variable ('mbox_cmd_name') in xhci-tegra.c. Looks
> like it was intended for logging or debugging, but never used. Just
> wanted to reach out to ask the best steps for cleaning this up.
> 
> If the variable is no longer needed I'd like to send a patch to remove it.

You never have to ask permission to send a patch :)

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

* [PATCH] usb: host: xhci-tegra: Fix Wunused-const-variable
  2019-06-13 18:44 ` Greg KH
@ 2019-06-13 18:58   ` Nathan Huckleberry
  2019-06-14  9:24     ` Thierry Reding
  0 siblings, 1 reply; 5+ messages in thread
From: Nathan Huckleberry @ 2019-06-13 18:58 UTC (permalink / raw)
  To: mathias.nyman, gregkh, thierry.reding, jonathanh
  Cc: linux-usb, linux-tegra, Nathan Huckleberry, clang-built-linux

Clang produces the following warning

drivers/usb/host/xhci-tegra.c:357:27: warning: unused variable
'mbox_cmd_name' [-Wunused-const-variable]
static const char * const mbox_cmd_name[] = {

Looks like it was intended for logging or debugging, but was
never implemented. Removing mbox_cmd_name.

Cc: clang-built-linux@googlegroups.com
Link: https://github.com/ClangBuiltLinux/linux/issues/533
Signed-off-by: Nathan Huckleberry <nhuck@google.com>
---
 drivers/usb/host/xhci-tegra.c | 23 -----------------------
 1 file changed, 23 deletions(-)

diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
index 294158113d62..dafc65911fc0 100644
--- a/drivers/usb/host/xhci-tegra.c
+++ b/drivers/usb/host/xhci-tegra.c
@@ -354,29 +354,6 @@ enum tegra_xusb_mbox_cmd {
 	MBOX_CMD_NAK
 };
 
-static const char * const mbox_cmd_name[] = {
-	[  1] = "MSG_ENABLE",
-	[  2] = "INC_FALCON_CLOCK",
-	[  3] = "DEC_FALCON_CLOCK",
-	[  4] = "INC_SSPI_CLOCK",
-	[  5] = "DEC_SSPI_CLOCK",
-	[  6] = "SET_BW",
-	[  7] = "SET_SS_PWR_GATING",
-	[  8] = "SET_SS_PWR_UNGATING",
-	[  9] = "SAVE_DFE_CTLE_CTX",
-	[ 10] = "AIRPLANE_MODE_ENABLED",
-	[ 11] = "AIRPLANE_MODE_DISABLED",
-	[ 12] = "START_HSIC_IDLE",
-	[ 13] = "STOP_HSIC_IDLE",
-	[ 14] = "DBC_WAKE_STACK",
-	[ 15] = "HSIC_PRETEND_CONNECT",
-	[ 16] = "RESET_SSPI",
-	[ 17] = "DISABLE_SS_LFPS_DETECTION",
-	[ 18] = "ENABLE_SS_LFPS_DETECTION",
-	[128] = "ACK",
-	[129] = "NAK",
-};
-
 struct tegra_xusb_mbox_msg {
 	u32 cmd;
 	u32 data;
-- 
2.22.0.rc2.383.gf4fbbf30c2-goog


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

* Re: Cleanup of -Wunused-const-variable in drivers/usb/host/xhci-tegra.c
  2019-06-13 18:38 Cleanup of -Wunused-const-variable in drivers/usb/host/xhci-tegra.c Nathan Huckleberry
  2019-06-13 18:44 ` Greg KH
@ 2019-06-14  9:09 ` Thierry Reding
  1 sibling, 0 replies; 5+ messages in thread
From: Thierry Reding @ 2019-06-14  9:09 UTC (permalink / raw)
  To: Nathan Huckleberry
  Cc: mathias.nyman, gregkh, thierry.reding, jonathanh, linux-usb,
	linux-tegra, linux-kernel, clang-built-linux

[-- Attachment #1: Type: text/plain, Size: 687 bytes --]

On Thu, Jun 13, 2019 at 11:38:38AM -0700, Nathan Huckleberry wrote:
> Hey all,
> 
> I'm looking into cleaning up ignored warnings in the kernel so we can
> remove compiler flags to ignore warnings.
> 
> There's an unused variable ('mbox_cmd_name') in xhci-tegra.c. Looks
> like it was intended for logging or debugging, but never used. Just
> wanted to reach out to ask the best steps for cleaning this up.
> 
> If the variable is no longer needed I'd like to send a patch to remove it.
> 
> https://github.com/ClangBuiltLinux/linux/issues/533

Feel free to send that patch. If we ever need this debug information
again we can easily add it back by reverting.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] usb: host: xhci-tegra: Fix Wunused-const-variable
  2019-06-13 18:58   ` [PATCH] usb: host: xhci-tegra: Fix Wunused-const-variable Nathan Huckleberry
@ 2019-06-14  9:24     ` Thierry Reding
  0 siblings, 0 replies; 5+ messages in thread
From: Thierry Reding @ 2019-06-14  9:24 UTC (permalink / raw)
  To: Nathan Huckleberry
  Cc: mathias.nyman, gregkh, jonathanh, linux-usb, linux-tegra,
	clang-built-linux

[-- Attachment #1: Type: text/plain, Size: 2094 bytes --]

On Thu, Jun 13, 2019 at 11:58:38AM -0700, Nathan Huckleberry wrote:
> Clang produces the following warning
> 
> drivers/usb/host/xhci-tegra.c:357:27: warning: unused variable
> 'mbox_cmd_name' [-Wunused-const-variable]
> static const char * const mbox_cmd_name[] = {
> 
> Looks like it was intended for logging or debugging, but was
> never implemented. Removing mbox_cmd_name.
> 
> Cc: clang-built-linux@googlegroups.com
> Link: https://github.com/ClangBuiltLinux/linux/issues/533
> Signed-off-by: Nathan Huckleberry <nhuck@google.com>
> ---
>  drivers/usb/host/xhci-tegra.c | 23 -----------------------
>  1 file changed, 23 deletions(-)

I wonder why we're not seeing this with regular GCC builds. This code
has been in the kernel for a long time. Oh... looking at the git log, I
see that -Wunused-const-variable was moved to W=1 about 3 years ago, so
these are no longer showing up by default. That would explain it.

Anyway:

Acked-by: Thierry Reding <treding@nvidia.com>

> diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
> index 294158113d62..dafc65911fc0 100644
> --- a/drivers/usb/host/xhci-tegra.c
> +++ b/drivers/usb/host/xhci-tegra.c
> @@ -354,29 +354,6 @@ enum tegra_xusb_mbox_cmd {
>  	MBOX_CMD_NAK
>  };
>  
> -static const char * const mbox_cmd_name[] = {
> -	[  1] = "MSG_ENABLE",
> -	[  2] = "INC_FALCON_CLOCK",
> -	[  3] = "DEC_FALCON_CLOCK",
> -	[  4] = "INC_SSPI_CLOCK",
> -	[  5] = "DEC_SSPI_CLOCK",
> -	[  6] = "SET_BW",
> -	[  7] = "SET_SS_PWR_GATING",
> -	[  8] = "SET_SS_PWR_UNGATING",
> -	[  9] = "SAVE_DFE_CTLE_CTX",
> -	[ 10] = "AIRPLANE_MODE_ENABLED",
> -	[ 11] = "AIRPLANE_MODE_DISABLED",
> -	[ 12] = "START_HSIC_IDLE",
> -	[ 13] = "STOP_HSIC_IDLE",
> -	[ 14] = "DBC_WAKE_STACK",
> -	[ 15] = "HSIC_PRETEND_CONNECT",
> -	[ 16] = "RESET_SSPI",
> -	[ 17] = "DISABLE_SS_LFPS_DETECTION",
> -	[ 18] = "ENABLE_SS_LFPS_DETECTION",
> -	[128] = "ACK",
> -	[129] = "NAK",
> -};
> -
>  struct tegra_xusb_mbox_msg {
>  	u32 cmd;
>  	u32 data;
> -- 
> 2.22.0.rc2.383.gf4fbbf30c2-goog
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2019-06-14  9:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-13 18:38 Cleanup of -Wunused-const-variable in drivers/usb/host/xhci-tegra.c Nathan Huckleberry
2019-06-13 18:44 ` Greg KH
2019-06-13 18:58   ` [PATCH] usb: host: xhci-tegra: Fix Wunused-const-variable Nathan Huckleberry
2019-06-14  9:24     ` Thierry Reding
2019-06-14  9:09 ` Cleanup of -Wunused-const-variable in drivers/usb/host/xhci-tegra.c Thierry Reding

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).