Skip to content

Commit 6f49c4f

Browse files
GustavoARSilvadtor
authored andcommitted
Input: Use fallthrough pseudo-keyword
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through Signed-off-by: Gustavo A. R. Silva <[email protected]> Link: https://lore.kernel.org/r/20200707180857.GA30600@embeddedor Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 08a6caa commit 6f49c4f

30 files changed

+62
-67
lines changed

drivers/input/joystick/db9.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ static unsigned char db9_saturn_read_packet(struct parport *port, unsigned char
247247
db9_saturn_write_sub(port, type, 3, powered, 0);
248248
return data[0] = 0xe3;
249249
}
250-
/* fall through */
250+
fallthrough;
251251
default:
252252
return data[0];
253253
}
@@ -267,14 +267,14 @@ static int db9_saturn_report(unsigned char id, unsigned char data[60], struct in
267267
switch (data[j]) {
268268
case 0x16: /* multi controller (analog 4 axis) */
269269
input_report_abs(dev, db9_abs[5], data[j + 6]);
270-
/* fall through */
270+
fallthrough;
271271
case 0x15: /* mission stick (analog 3 axis) */
272272
input_report_abs(dev, db9_abs[3], data[j + 4]);
273273
input_report_abs(dev, db9_abs[4], data[j + 5]);
274-
/* fall through */
274+
fallthrough;
275275
case 0x13: /* racing controller (analog 1 axis) */
276276
input_report_abs(dev, db9_abs[2], data[j + 3]);
277-
/* fall through */
277+
fallthrough;
278278
case 0x34: /* saturn keyboard (udlr ZXC ASD QE Esc) */
279279
case 0x02: /* digital pad (digital 2 axis + buttons) */
280280
input_report_abs(dev, db9_abs[0], !(data[j + 1] & 128) - !(data[j + 1] & 64));
@@ -368,7 +368,7 @@ static void db9_timer(struct timer_list *t)
368368
input_report_abs(dev2, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1));
369369
input_report_abs(dev2, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1));
370370
input_report_key(dev2, BTN_TRIGGER, ~data & DB9_FIRE1);
371-
/* fall through */
371+
fallthrough;
372372

373373
case DB9_MULTI_0802:
374374

drivers/input/joystick/gamecon.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ static void gc_multi_process_packet(struct gc *gc)
485485
switch (pad->type) {
486486
case GC_MULTI2:
487487
input_report_key(dev, BTN_THUMB, s & data[5]);
488-
/* fall through */
488+
fallthrough;
489489

490490
case GC_MULTI:
491491
input_report_abs(dev, ABS_X,
@@ -638,7 +638,7 @@ static void gc_psx_report_one(struct gc_pad *pad, unsigned char psx_type,
638638

639639
input_report_key(dev, BTN_THUMBL, ~data[0] & 0x04);
640640
input_report_key(dev, BTN_THUMBR, ~data[0] & 0x02);
641-
/* fall through */
641+
fallthrough;
642642

643643
case GC_PSX_NEGCON:
644644
case GC_PSX_ANALOG:
@@ -872,15 +872,17 @@ static int gc_setup_pad(struct gc *gc, int idx, int pad_type)
872872
case GC_SNES:
873873
for (i = 4; i < 8; i++)
874874
input_set_capability(input_dev, EV_KEY, gc_snes_btn[i]);
875-
/* fall through */
875+
fallthrough;
876+
876877
case GC_NES:
877878
for (i = 0; i < 4; i++)
878879
input_set_capability(input_dev, EV_KEY, gc_snes_btn[i]);
879880
break;
880881

881882
case GC_MULTI2:
882883
input_set_capability(input_dev, EV_KEY, BTN_THUMB);
883-
/* fall through */
884+
fallthrough;
885+
884886
case GC_MULTI:
885887
input_set_capability(input_dev, EV_KEY, BTN_TRIGGER);
886888
/* fall through */

drivers/input/joystick/sidewinder.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -656,16 +656,19 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv)
656656

657657
switch (i * m) {
658658
case 60:
659-
sw->number++; /* fall through */
659+
sw->number++;
660+
fallthrough;
660661
case 45: /* Ambiguous packet length */
661662
if (j <= 40) { /* ID length less or eq 40 -> FSP */
662663
case 43:
663664
sw->type = SW_ID_FSP;
664665
break;
665666
}
666-
sw->number++; /* fall through */
667+
sw->number++;
668+
fallthrough;
667669
case 30:
668-
sw->number++; /* fall through */
670+
sw->number++;
671+
fallthrough;
669672
case 15:
670673
sw->type = SW_ID_GP;
671674
break;
@@ -681,9 +684,11 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv)
681684
sw->type = SW_ID_PP;
682685
break;
683686
case 66:
684-
sw->bits = 3; /* fall through */
687+
sw->bits = 3;
688+
fallthrough;
685689
case 198:
686-
sw->length = 22; /* fall through */
690+
sw->length = 22;
691+
fallthrough;
687692
case 64:
688693
sw->type = SW_ID_3DP;
689694
if (j == 160)

drivers/input/joystick/spaceball.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,15 @@ static irqreturn_t spaceball_interrupt(struct serio *serio,
146146
break;
147147
}
148148
spaceball->escape = 0;
149-
/* fall through */
149+
fallthrough;
150150
case 'M':
151151
case 'Q':
152152
case 'S':
153153
if (spaceball->escape) {
154154
spaceball->escape = 0;
155155
data &= 0x1f;
156156
}
157-
/* fall through */
157+
fallthrough;
158158
default:
159159
if (spaceball->escape)
160160
spaceball->escape = 0;
@@ -220,13 +220,13 @@ static int spaceball_connect(struct serio *serio, struct serio_driver *drv)
220220
input_dev->keybit[BIT_WORD(BTN_A)] |= BIT_MASK(BTN_A) |
221221
BIT_MASK(BTN_B) | BIT_MASK(BTN_C) |
222222
BIT_MASK(BTN_MODE);
223-
/* fall through */
223+
fallthrough;
224224
default:
225225
input_dev->keybit[BIT_WORD(BTN_0)] |= BIT_MASK(BTN_2) |
226226
BIT_MASK(BTN_3) | BIT_MASK(BTN_4) |
227227
BIT_MASK(BTN_5) | BIT_MASK(BTN_6) |
228228
BIT_MASK(BTN_7) | BIT_MASK(BTN_8);
229-
/* fall through */
229+
fallthrough;
230230
case SPACEBALL_3003C:
231231
input_dev->keybit[BIT_WORD(BTN_0)] |= BIT_MASK(BTN_1) |
232232
BIT_MASK(BTN_8);

drivers/input/keyboard/adp5589-keys.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ static int adp5589_probe(struct i2c_client *client,
10161016
switch (id->driver_data) {
10171017
case ADP5585_02:
10181018
kpad->support_row5 = true;
1019-
/* fall through */
1019+
fallthrough;
10201020
case ADP5585_01:
10211021
kpad->is_adp5585 = true;
10221022
kpad->var = &const_adp5585;

drivers/input/keyboard/atkbd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv)
12411241

12421242
case SERIO_8042_XL:
12431243
atkbd->translated = true;
1244-
/* Fall through */
1244+
fallthrough;
12451245

12461246
case SERIO_8042:
12471247
if (serio->write)

drivers/input/keyboard/gpio_keys.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,6 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
574574
IRQ_TYPE_EDGE_RISING : IRQ_TYPE_EDGE_FALLING;
575575
break;
576576
case EV_ACT_ANY:
577-
/* fall through */
578577
default:
579578
/*
580579
* For other cases, we are OK letting suspend/resume

drivers/input/misc/iqs269a.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,7 @@ static int iqs269_parse_chan(struct iqs269_private *iqs269,
575575

576576
case IQS269_LOCAL_CAP_SIZE_GLOBAL_0pF5:
577577
engine_a |= IQS269_CHx_ENG_A_LOCAL_CAP_SIZE;
578-
579-
/* fall through */
578+
fallthrough;
580579

581580
case IQS269_LOCAL_CAP_SIZE_GLOBAL_ONLY:
582581
engine_b |= IQS269_CHx_ENG_B_LOCAL_CAP_ENABLE;
@@ -731,14 +730,12 @@ static int iqs269_parse_chan(struct iqs269_private *iqs269,
731730
iqs269->switches[i].code = val;
732731
iqs269->switches[i].enabled = true;
733732
}
734-
735-
/* fall through */
733+
fallthrough;
736734

737735
case IQS269_CHx_HALL_INACTIVE:
738736
if (iqs269->hall_enable)
739737
break;
740-
741-
/* fall through */
738+
fallthrough;
742739

743740
default:
744741
iqs269->keycode[i * IQS269_NUM_CH + reg] = val;
@@ -1143,14 +1140,12 @@ static int iqs269_input_init(struct iqs269_private *iqs269)
11431140
sw_code,
11441141
state & BIT(j));
11451142
}
1146-
1147-
/* fall through */
1143+
fallthrough;
11481144

11491145
case IQS269_CHx_HALL_INACTIVE:
11501146
if (iqs269->hall_enable)
11511147
continue;
1152-
1153-
/* fall through */
1148+
fallthrough;
11541149

11551150
default:
11561151
if (keycode != KEY_RESERVED)
@@ -1273,14 +1268,12 @@ static int iqs269_report(struct iqs269_private *iqs269)
12731268
input_report_switch(iqs269->keypad,
12741269
sw_code,
12751270
state & BIT(j));
1276-
1277-
/* fall through */
1271+
fallthrough;
12781272

12791273
case IQS269_CHx_HALL_INACTIVE:
12801274
if (iqs269->hall_enable)
12811275
continue;
1282-
1283-
/* fall through */
1276+
fallthrough;
12841277

12851278
default:
12861279
input_report_key(iqs269->keypad, keycode,

drivers/input/misc/pwm-vibra.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ static int pwm_vibrator_probe(struct platform_device *pdev)
190190

191191
default:
192192
dev_err(&pdev->dev, "Failed to request direction pwm: %d", err);
193-
/* Fall through */
193+
fallthrough;
194194

195195
case -EPROBE_DEFER:
196196
return err;

drivers/input/misc/xen-kbdfront.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static void xenkbd_handle_mt_event(struct xenkbd_info *info,
124124
switch (mtouch->event_type) {
125125
case XENKBD_MT_EV_DOWN:
126126
input_mt_report_slot_state(info->mtouch, MT_TOOL_FINGER, true);
127-
/* fall through */
127+
fallthrough;
128128

129129
case XENKBD_MT_EV_MOTION:
130130
input_report_abs(info->mtouch, ABS_MT_POSITION_X,
@@ -524,7 +524,7 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
524524
case XenbusStateClosed:
525525
if (dev->state == XenbusStateClosed)
526526
break;
527-
/* fall through - Missed the backend's CLOSING state */
527+
fallthrough; /* Missed the backend's CLOSING state */
528528
case XenbusStateClosing:
529529
xenbus_frontend_closed(dev);
530530
break;

0 commit comments

Comments
 (0)