linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: nintendo: Fix unused-const-variable compiler warning
@ 2022-07-20  5:42 Aashish Sharma
  2022-07-20 15:27 ` Guenter Roeck
  2022-07-22 13:04 ` Jiri Kosina
  0 siblings, 2 replies; 3+ messages in thread
From: Aashish Sharma @ 2022-07-20  5:42 UTC (permalink / raw)
  To: Daniel J . Ogorchock , Jiri Kosina, Benjamin Tissoires, Guenter Roeck
  Cc: linux-input, linux-kernel, Aashish Sharma

The following compiler warning is produced when CONFIG_NINTENDO_FF
is not set:

>> drivers/hid/hid-nintendo.c:405:29: warning: 'JC_RUMBLE_ZERO_AMP_PKT_CNT'
   defined but not used [-Wunused-const-variable=]

To fix this, move the variable 'JC_RUMBLE_ZERO_AMP_PKT_CNT' under the
CONFIG_NINTENDO_FF's conditional compilation block.

Signed-off-by: Aashish Sharma <shraash@google.com>
---
 drivers/hid/hid-nintendo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c
index 2204de889739..69de7504bdbc 100644
--- a/drivers/hid/hid-nintendo.c
+++ b/drivers/hid/hid-nintendo.c
@@ -402,8 +402,6 @@ struct joycon_input_report {
 #define JC_RUMBLE_DATA_SIZE	8
 #define JC_RUMBLE_QUEUE_SIZE	8
 
-static const unsigned short JC_RUMBLE_ZERO_AMP_PKT_CNT = 5;
-
 static const char * const joycon_player_led_names[] = {
 	LED_FUNCTION_PLAYER1,
 	LED_FUNCTION_PLAYER2,
@@ -1512,6 +1510,8 @@ static void joycon_clamp_rumble_freqs(struct joycon_ctlr *ctlr)
 	spin_unlock_irqrestore(&ctlr->lock, flags);
 }
 
+static const unsigned short JC_RUMBLE_ZERO_AMP_PKT_CNT = 5;
+
 static int joycon_set_rumble(struct joycon_ctlr *ctlr, u16 amp_r, u16 amp_l,
 			     bool schedule_now)
 {
-- 
2.37.0.170.g444d1eabd0-goog


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

* Re: [PATCH] HID: nintendo: Fix unused-const-variable compiler warning
  2022-07-20  5:42 [PATCH] HID: nintendo: Fix unused-const-variable compiler warning Aashish Sharma
@ 2022-07-20 15:27 ` Guenter Roeck
  2022-07-22 13:04 ` Jiri Kosina
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2022-07-20 15:27 UTC (permalink / raw)
  To: Aashish Sharma
  Cc: Daniel J . Ogorchock, Jiri Kosina, Benjamin Tissoires,
	Guenter Roeck, open list:HID CORE LAYER, linux-kernel

On Tue, Jul 19, 2022 at 10:43 PM Aashish Sharma <shraash@google.com> wrote:
>
> The following compiler warning is produced when CONFIG_NINTENDO_FF
> is not set:
>
> >> drivers/hid/hid-nintendo.c:405:29: warning: 'JC_RUMBLE_ZERO_AMP_PKT_CNT'
>    defined but not used [-Wunused-const-variable=]
>
> To fix this, move the variable 'JC_RUMBLE_ZERO_AMP_PKT_CNT' under the
> CONFIG_NINTENDO_FF's conditional compilation block.
>
> Signed-off-by: Aashish Sharma <shraash@google.com>

Reviewed-by: Guenter Roeck <groeck@chromium.org>

> ---
>  drivers/hid/hid-nintendo.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c
> index 2204de889739..69de7504bdbc 100644
> --- a/drivers/hid/hid-nintendo.c
> +++ b/drivers/hid/hid-nintendo.c
> @@ -402,8 +402,6 @@ struct joycon_input_report {
>  #define JC_RUMBLE_DATA_SIZE    8
>  #define JC_RUMBLE_QUEUE_SIZE   8
>
> -static const unsigned short JC_RUMBLE_ZERO_AMP_PKT_CNT = 5;
> -
>  static const char * const joycon_player_led_names[] = {
>         LED_FUNCTION_PLAYER1,
>         LED_FUNCTION_PLAYER2,
> @@ -1512,6 +1510,8 @@ static void joycon_clamp_rumble_freqs(struct joycon_ctlr *ctlr)
>         spin_unlock_irqrestore(&ctlr->lock, flags);
>  }
>
> +static const unsigned short JC_RUMBLE_ZERO_AMP_PKT_CNT = 5;
> +
>  static int joycon_set_rumble(struct joycon_ctlr *ctlr, u16 amp_r, u16 amp_l,
>                              bool schedule_now)
>  {
> --
> 2.37.0.170.g444d1eabd0-goog
>

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

* Re: [PATCH] HID: nintendo: Fix unused-const-variable compiler warning
  2022-07-20  5:42 [PATCH] HID: nintendo: Fix unused-const-variable compiler warning Aashish Sharma
  2022-07-20 15:27 ` Guenter Roeck
@ 2022-07-22 13:04 ` Jiri Kosina
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2022-07-22 13:04 UTC (permalink / raw)
  To: Aashish Sharma
  Cc: Daniel J . Ogorchock ,
	Benjamin Tissoires, Guenter Roeck, linux-input, linux-kernel

On Wed, 20 Jul 2022, Aashish Sharma wrote:

> The following compiler warning is produced when CONFIG_NINTENDO_FF
> is not set:
> 
> >> drivers/hid/hid-nintendo.c:405:29: warning: 'JC_RUMBLE_ZERO_AMP_PKT_CNT'
>    defined but not used [-Wunused-const-variable=]
> 
> To fix this, move the variable 'JC_RUMBLE_ZERO_AMP_PKT_CNT' under the
> CONFIG_NINTENDO_FF's conditional compilation block.
> 
> Signed-off-by: Aashish Sharma <shraash@google.com>

Applied to for-5.20/ninitendo. Thanks,

-- 
Jiri Kosina
SUSE Labs


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

end of thread, other threads:[~2022-07-22 13:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-20  5:42 [PATCH] HID: nintendo: Fix unused-const-variable compiler warning Aashish Sharma
2022-07-20 15:27 ` Guenter Roeck
2022-07-22 13:04 ` Jiri Kosina

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