[RFC,10/23] ALSA: usb/line6: remove 'defined but not used' warning
diff mbox series

Message ID 20200702193604.169059-11-pierre-louis.bossart@linux.intel.com
State New
Headers show
Series
  • ALSA: fix kernel-doc and W=1 warnings
Related show

Commit Message

Pierre-Louis Bossart July 2, 2020, 7:35 p.m. UTC
Fix W=1 warning. Variables are declared in a header file included from
multiple C files. Mark as __maybe_unused.

sound/usb/line6/driver.h:70:18: warning: ‘SYSEX_EXTRA_SIZE’ defined
but not used [-Wunused-const-variable=]
   70 | static const int SYSEX_EXTRA_SIZE = sizeof(line6_midi_id) + 4;
      |                  ^~~~~~~~~~~~~~~~
sound/usb/line6/driver.h:69:18: warning: ‘SYSEX_DATA_OFS’ defined but
   not used [-Wunused-const-variable=]
   69 | static const int SYSEX_DATA_OFS = sizeof(line6_midi_id) + 3;
      |                  ^~~~~~~~~~~~~~

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/usb/line6/driver.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Takashi Iwai July 7, 2020, 10:08 a.m. UTC | #1
On Thu, 02 Jul 2020 21:35:51 +0200,
Pierre-Louis Bossart wrote:
> 
> Fix W=1 warning. Variables are declared in a header file included from
> multiple C files. Mark as __maybe_unused.
> 
> sound/usb/line6/driver.h:70:18: warning: ‘SYSEX_EXTRA_SIZE’ defined
> but not used [-Wunused-const-variable=]
>    70 | static const int SYSEX_EXTRA_SIZE = sizeof(line6_midi_id) + 4;
>       |                  ^~~~~~~~~~~~~~~~
> sound/usb/line6/driver.h:69:18: warning: ‘SYSEX_DATA_OFS’ defined but
>    not used [-Wunused-const-variable=]
>    69 | static const int SYSEX_DATA_OFS = sizeof(line6_midi_id) + 3;
>       |                  ^~~~~~~~~~~~~~
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
>  sound/usb/line6/driver.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/usb/line6/driver.h b/sound/usb/line6/driver.h
> index 1a4e3700c80c..3f75855f142a 100644
> --- a/sound/usb/line6/driver.h
> +++ b/sound/usb/line6/driver.h
> @@ -66,8 +66,8 @@
>  
>  extern const unsigned char line6_midi_id[3];
>  
> -static const int SYSEX_DATA_OFS = sizeof(line6_midi_id) + 3;
> -static const int SYSEX_EXTRA_SIZE = sizeof(line6_midi_id) + 4;
> +static __maybe_unused const int SYSEX_DATA_OFS = sizeof(line6_midi_id) + 3;
> +static __maybe_unused const int SYSEX_EXTRA_SIZE = sizeof(line6_midi_id) + 4;

IMO, this can be clearer to make them define.
The static const doesn't look like a right usage in such a case in
anyway...


thanks,

Takashi
Pierre-Louis Bossart July 7, 2020, 3:49 p.m. UTC | #2
>> -static const int SYSEX_DATA_OFS = sizeof(line6_midi_id) + 3;
>> -static const int SYSEX_EXTRA_SIZE = sizeof(line6_midi_id) + 4;
>> +static __maybe_unused const int SYSEX_DATA_OFS = sizeof(line6_midi_id) + 3;
>> +static __maybe_unused const int SYSEX_EXTRA_SIZE = sizeof(line6_midi_id) + 4;
> 
> IMO, this can be clearer to make them define.
> The static const doesn't look like a right usage in such a case in
> anyway...

Right, and the capital letters do hint at a define indeed. Will resend, 
thanks Takashi for the review.

Patch
diff mbox series

diff --git a/sound/usb/line6/driver.h b/sound/usb/line6/driver.h
index 1a4e3700c80c..3f75855f142a 100644
--- a/sound/usb/line6/driver.h
+++ b/sound/usb/line6/driver.h
@@ -66,8 +66,8 @@ 
 
 extern const unsigned char line6_midi_id[3];
 
-static const int SYSEX_DATA_OFS = sizeof(line6_midi_id) + 3;
-static const int SYSEX_EXTRA_SIZE = sizeof(line6_midi_id) + 4;
+static __maybe_unused const int SYSEX_DATA_OFS = sizeof(line6_midi_id) + 3;
+static __maybe_unused const int SYSEX_EXTRA_SIZE = sizeof(line6_midi_id) + 4;
 
 /*
 	 Common properties of Line 6 devices.