Skip to contentSkip to conversation

HID: nintendo: Fix unused-const-variable compiler warning

PATCH Applied Aashish Sharma 3 participants 3 messages Jul 20, 2022 – Jul 22, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: nintendo: Fix unused-const-variable compiler warning

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

Quoted 1 line
Quoted 1 line

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.

---
 drivers/hid/hid-nintendo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/hid-nintendo.c +2 -2
index 2204de889739..69de7504bdbc 100644
@@ -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)
 {
Signature · 1 line
2.37.0.170.g444d1eabd0-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Aashish Sharma

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

Quoted 1 line
Quoted 1 line

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.

Quoted 29 lines
---
 drivers/hid/hid-nintendo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/hid-nintendo.c +2 -3
index 2204de889739..69de7504bdbc 100644
@@ -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

maintainer Applied
#2 lore raw
In reply to Aashish Sharma
Quoted 10 lines · Aashish Sharma

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

Quoted 1 line
Quoted 1 line

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.

Applied to for-5.20/ninitendo. Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs