Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20200707180857.GA30600@embeddedor
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Gustavo A. R. Silva and committed by
Dmitry Torokhov
6f49c4f5 08a6caae

+62 -67
+5 -5
drivers/input/joystick/db9.c
··· 247 247 db9_saturn_write_sub(port, type, 3, powered, 0); 248 248 return data[0] = 0xe3; 249 249 } 250 - /* fall through */ 250 + fallthrough; 251 251 default: 252 252 return data[0]; 253 253 } ··· 267 267 switch (data[j]) { 268 268 case 0x16: /* multi controller (analog 4 axis) */ 269 269 input_report_abs(dev, db9_abs[5], data[j + 6]); 270 - /* fall through */ 270 + fallthrough; 271 271 case 0x15: /* mission stick (analog 3 axis) */ 272 272 input_report_abs(dev, db9_abs[3], data[j + 4]); 273 273 input_report_abs(dev, db9_abs[4], data[j + 5]); 274 - /* fall through */ 274 + fallthrough; 275 275 case 0x13: /* racing controller (analog 1 axis) */ 276 276 input_report_abs(dev, db9_abs[2], data[j + 3]); 277 - /* fall through */ 277 + fallthrough; 278 278 case 0x34: /* saturn keyboard (udlr ZXC ASD QE Esc) */ 279 279 case 0x02: /* digital pad (digital 2 axis + buttons) */ 280 280 input_report_abs(dev, db9_abs[0], !(data[j + 1] & 128) - !(data[j + 1] & 64)); ··· 368 368 input_report_abs(dev2, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1)); 369 369 input_report_abs(dev2, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1)); 370 370 input_report_key(dev2, BTN_TRIGGER, ~data & DB9_FIRE1); 371 - /* fall through */ 371 + fallthrough; 372 372 373 373 case DB9_MULTI_0802: 374 374
+6 -4
drivers/input/joystick/gamecon.c
··· 485 485 switch (pad->type) { 486 486 case GC_MULTI2: 487 487 input_report_key(dev, BTN_THUMB, s & data[5]); 488 - /* fall through */ 488 + fallthrough; 489 489 490 490 case GC_MULTI: 491 491 input_report_abs(dev, ABS_X, ··· 638 638 639 639 input_report_key(dev, BTN_THUMBL, ~data[0] & 0x04); 640 640 input_report_key(dev, BTN_THUMBR, ~data[0] & 0x02); 641 - /* fall through */ 641 + fallthrough; 642 642 643 643 case GC_PSX_NEGCON: 644 644 case GC_PSX_ANALOG: ··· 872 872 case GC_SNES: 873 873 for (i = 4; i < 8; i++) 874 874 input_set_capability(input_dev, EV_KEY, gc_snes_btn[i]); 875 - /* fall through */ 875 + fallthrough; 876 + 876 877 case GC_NES: 877 878 for (i = 0; i < 4; i++) 878 879 input_set_capability(input_dev, EV_KEY, gc_snes_btn[i]); ··· 881 880 882 881 case GC_MULTI2: 883 882 input_set_capability(input_dev, EV_KEY, BTN_THUMB); 884 - /* fall through */ 883 + fallthrough; 884 + 885 885 case GC_MULTI: 886 886 input_set_capability(input_dev, EV_KEY, BTN_TRIGGER); 887 887 /* fall through */
+10 -5
drivers/input/joystick/sidewinder.c
··· 656 656 657 657 switch (i * m) { 658 658 case 60: 659 - sw->number++; /* fall through */ 659 + sw->number++; 660 + fallthrough; 660 661 case 45: /* Ambiguous packet length */ 661 662 if (j <= 40) { /* ID length less or eq 40 -> FSP */ 662 663 case 43: 663 664 sw->type = SW_ID_FSP; 664 665 break; 665 666 } 666 - sw->number++; /* fall through */ 667 + sw->number++; 668 + fallthrough; 667 669 case 30: 668 - sw->number++; /* fall through */ 670 + sw->number++; 671 + fallthrough; 669 672 case 15: 670 673 sw->type = SW_ID_GP; 671 674 break; ··· 684 681 sw->type = SW_ID_PP; 685 682 break; 686 683 case 66: 687 - sw->bits = 3; /* fall through */ 684 + sw->bits = 3; 685 + fallthrough; 688 686 case 198: 689 - sw->length = 22; /* fall through */ 687 + sw->length = 22; 688 + fallthrough; 690 689 case 64: 691 690 sw->type = SW_ID_3DP; 692 691 if (j == 160)
+4 -4
drivers/input/joystick/spaceball.c
··· 146 146 break; 147 147 } 148 148 spaceball->escape = 0; 149 - /* fall through */ 149 + fallthrough; 150 150 case 'M': 151 151 case 'Q': 152 152 case 'S': ··· 154 154 spaceball->escape = 0; 155 155 data &= 0x1f; 156 156 } 157 - /* fall through */ 157 + fallthrough; 158 158 default: 159 159 if (spaceball->escape) 160 160 spaceball->escape = 0; ··· 220 220 input_dev->keybit[BIT_WORD(BTN_A)] |= BIT_MASK(BTN_A) | 221 221 BIT_MASK(BTN_B) | BIT_MASK(BTN_C) | 222 222 BIT_MASK(BTN_MODE); 223 - /* fall through */ 223 + fallthrough; 224 224 default: 225 225 input_dev->keybit[BIT_WORD(BTN_0)] |= BIT_MASK(BTN_2) | 226 226 BIT_MASK(BTN_3) | BIT_MASK(BTN_4) | 227 227 BIT_MASK(BTN_5) | BIT_MASK(BTN_6) | 228 228 BIT_MASK(BTN_7) | BIT_MASK(BTN_8); 229 - /* fall through */ 229 + fallthrough; 230 230 case SPACEBALL_3003C: 231 231 input_dev->keybit[BIT_WORD(BTN_0)] |= BIT_MASK(BTN_1) | 232 232 BIT_MASK(BTN_8);
+1 -1
drivers/input/keyboard/adp5589-keys.c
··· 1016 1016 switch (id->driver_data) { 1017 1017 case ADP5585_02: 1018 1018 kpad->support_row5 = true; 1019 - /* fall through */ 1019 + fallthrough; 1020 1020 case ADP5585_01: 1021 1021 kpad->is_adp5585 = true; 1022 1022 kpad->var = &const_adp5585;
+1 -1
drivers/input/keyboard/atkbd.c
··· 1241 1241 1242 1242 case SERIO_8042_XL: 1243 1243 atkbd->translated = true; 1244 - /* Fall through */ 1244 + fallthrough; 1245 1245 1246 1246 case SERIO_8042: 1247 1247 if (serio->write)
-1
drivers/input/keyboard/gpio_keys.c
··· 574 574 IRQ_TYPE_EDGE_RISING : IRQ_TYPE_EDGE_FALLING; 575 575 break; 576 576 case EV_ACT_ANY: 577 - /* fall through */ 578 577 default: 579 578 /* 580 579 * For other cases, we are OK letting suspend/resume
+7 -14
drivers/input/misc/iqs269a.c
··· 575 575 576 576 case IQS269_LOCAL_CAP_SIZE_GLOBAL_0pF5: 577 577 engine_a |= IQS269_CHx_ENG_A_LOCAL_CAP_SIZE; 578 - 579 - /* fall through */ 578 + fallthrough; 580 579 581 580 case IQS269_LOCAL_CAP_SIZE_GLOBAL_ONLY: 582 581 engine_b |= IQS269_CHx_ENG_B_LOCAL_CAP_ENABLE; ··· 730 731 iqs269->switches[i].code = val; 731 732 iqs269->switches[i].enabled = true; 732 733 } 733 - 734 - /* fall through */ 734 + fallthrough; 735 735 736 736 case IQS269_CHx_HALL_INACTIVE: 737 737 if (iqs269->hall_enable) 738 738 break; 739 - 740 - /* fall through */ 739 + fallthrough; 741 740 742 741 default: 743 742 iqs269->keycode[i * IQS269_NUM_CH + reg] = val; ··· 1140 1143 sw_code, 1141 1144 state & BIT(j)); 1142 1145 } 1143 - 1144 - /* fall through */ 1146 + fallthrough; 1145 1147 1146 1148 case IQS269_CHx_HALL_INACTIVE: 1147 1149 if (iqs269->hall_enable) 1148 1150 continue; 1149 - 1150 - /* fall through */ 1151 + fallthrough; 1151 1152 1152 1153 default: 1153 1154 if (keycode != KEY_RESERVED) ··· 1268 1273 input_report_switch(iqs269->keypad, 1269 1274 sw_code, 1270 1275 state & BIT(j)); 1271 - 1272 - /* fall through */ 1276 + fallthrough; 1273 1277 1274 1278 case IQS269_CHx_HALL_INACTIVE: 1275 1279 if (iqs269->hall_enable) 1276 1280 continue; 1277 - 1278 - /* fall through */ 1281 + fallthrough; 1279 1282 1280 1283 default: 1281 1284 input_report_key(iqs269->keypad, keycode,
+1 -1
drivers/input/misc/pwm-vibra.c
··· 190 190 191 191 default: 192 192 dev_err(&pdev->dev, "Failed to request direction pwm: %d", err); 193 - /* Fall through */ 193 + fallthrough; 194 194 195 195 case -EPROBE_DEFER: 196 196 return err;
+2 -2
drivers/input/misc/xen-kbdfront.c
··· 124 124 switch (mtouch->event_type) { 125 125 case XENKBD_MT_EV_DOWN: 126 126 input_mt_report_slot_state(info->mtouch, MT_TOOL_FINGER, true); 127 - /* fall through */ 127 + fallthrough; 128 128 129 129 case XENKBD_MT_EV_MOTION: 130 130 input_report_abs(info->mtouch, ABS_MT_POSITION_X, ··· 524 524 case XenbusStateClosed: 525 525 if (dev->state == XenbusStateClosed) 526 526 break; 527 - /* fall through - Missed the backend's CLOSING state */ 527 + fallthrough; /* Missed the backend's CLOSING state */ 528 528 case XenbusStateClosing: 529 529 xenbus_frontend_closed(dev); 530 530 break;
+1 -1
drivers/input/mouse/appletouch.c
··· 458 458 dev->info->datalen, dev->urb->actual_length); 459 459 dev->overflow_warned = true; 460 460 } 461 - /* fall through */ 461 + fallthrough; 462 462 case -ECONNRESET: 463 463 case -ENOENT: 464 464 case -ESHUTDOWN:
+2 -2
drivers/input/mouse/cyapa_gen3.c
··· 1067 1067 return error; 1068 1068 } 1069 1069 1070 - /* Fall through */ 1070 + fallthrough; 1071 1071 case CYAPA_STATE_BL_IDLE: 1072 1072 /* Try to get firmware version in bootloader mode. */ 1073 1073 cyapa_gen3_bl_query_data(cyapa); ··· 1078 1078 return error; 1079 1079 } 1080 1080 1081 - /* Fall through */ 1081 + fallthrough; 1082 1082 case CYAPA_STATE_OP: 1083 1083 /* 1084 1084 * Reading query data before going back to the full mode
+1 -1
drivers/input/mouse/cyapa_gen5.c
··· 2554 2554 } 2555 2555 2556 2556 cyapa->state = CYAPA_STATE_GEN5_APP; 2557 - /* fall through */ 2557 + fallthrough; 2558 2558 2559 2559 case CYAPA_STATE_GEN5_APP: 2560 2560 /*
+1 -1
drivers/input/mouse/cyapa_gen6.c
··· 680 680 } 681 681 682 682 cyapa->state = CYAPA_STATE_GEN6_APP; 683 - /* fall through */ 683 + fallthrough; 684 684 685 685 case CYAPA_STATE_GEN6_APP: 686 686 /*
+2 -4
drivers/input/mouse/elantech.c
··· 383 383 */ 384 384 if (packet[3] & 0x80) 385 385 fingers = 4; 386 - /* fall through */ 386 + fallthrough; 387 387 case 1: 388 388 /* 389 389 * byte 1: . . . . x11 x10 x9 x8 ··· 1146 1146 case 2: 1147 1147 __set_bit(BTN_TOOL_QUADTAP, dev->keybit); 1148 1148 __set_bit(INPUT_PROP_SEMI_MT, dev->propbit); 1149 - /* fall through */ 1149 + fallthrough; 1150 1150 case 3: 1151 1151 if (info->hw_version == 3) 1152 1152 elantech_set_buttonpad_prop(psmouse); ··· 1877 1877 /* expected case */ 1878 1878 break; 1879 1879 case ETP_BUS_SMB_ALERT_ONLY: 1880 - /* fall-through */ 1881 1880 case ETP_BUS_PS2_SMB_ALERT: 1882 1881 psmouse_dbg(psmouse, "Ignoring SMBus provider through alert protocol.\n"); 1883 1882 break; 1884 1883 case ETP_BUS_SMB_HST_NTFY_ONLY: 1885 - /* fall-through */ 1886 1884 case ETP_BUS_PS2_SMB_HST_NTFY: 1887 1885 return true; 1888 1886 default:
+2 -2
drivers/input/mouse/hgpk.c
··· 238 238 /* we're not spewing, but this packet might be the start */ 239 239 priv->spew_flag = MAYBE_SPEWING; 240 240 241 - /* fall-through */ 241 + fallthrough; 242 242 243 243 case MAYBE_SPEWING: 244 244 priv->spew_count++; ··· 249 249 /* excessive spew detected, request recalibration */ 250 250 priv->spew_flag = SPEW_DETECTED; 251 251 252 - /* fall-through */ 252 + fallthrough; 253 253 254 254 case SPEW_DETECTED: 255 255 /* only recalibrate when the overall delta to the cursor
+1 -1
drivers/input/mouse/navpoint.c
··· 105 105 case 0x19: /* Module 0, Hello packet */ 106 106 if ((navpoint->data[1] & 0xf0) == 0x10) 107 107 break; 108 - /* FALLTHROUGH */ 108 + fallthrough; 109 109 default: 110 110 dev_warn(navpoint->dev, 111 111 "spurious packet: data=0x%02x,0x%02x,...\n",
+1 -1
drivers/input/mouse/sentelic.c
··· 794 794 /* on-pad click, filter it if necessary */ 795 795 if ((ad->flags & FSPDRV_FLAG_EN_OPC) != FSPDRV_FLAG_EN_OPC) 796 796 packet[0] &= ~FSP_PB0_LBTN; 797 - /* fall through */ 797 + fallthrough; 798 798 799 799 case FSP_PKT_TYPE_NORMAL: 800 800 /* normal packet */
+2 -2
drivers/input/mouse/sermouse.c
··· 128 128 129 129 case SERIO_MS: 130 130 sermouse->type = SERIO_MP; 131 - /* fall through */ 131 + fallthrough; 132 132 133 133 case SERIO_MP: 134 134 if ((data >> 2) & 3) break; /* M++ Wireless Extension packet. */ ··· 139 139 case SERIO_MZP: 140 140 case SERIO_MZPP: 141 141 input_report_key(dev, BTN_SIDE, (data >> 5) & 1); 142 - /* fall through */ 142 + fallthrough; 143 143 144 144 case SERIO_MZ: 145 145 input_report_key(dev, BTN_MIDDLE, (data >> 4) & 1);
+1 -1
drivers/input/serio/i8042.c
··· 562 562 str = last_str; 563 563 break; 564 564 } 565 - /* fall through - report timeout */ 565 + fallthrough; /* report timeout */ 566 566 case 0xfc: 567 567 case 0xfd: 568 568 case 0xfe: dfl = SERIO_TIMEOUT; data = 0xfe; break;
+1 -1
drivers/input/serio/libps2.c
··· 418 418 ps2dev->nak = 0; 419 419 break; 420 420 } 421 - /* Fall through */ 421 + fallthrough; 422 422 default: 423 423 /* 424 424 * Do not signal errors if we get unexpected reply while
+1 -1
drivers/input/sparse-keymap.c
··· 247 247 248 248 case KE_SW: 249 249 value = ke->sw.value; 250 - /* fall through */ 250 + fallthrough; 251 251 252 252 case KE_VSW: 253 253 input_report_switch(dev, ke->sw.code, value);
+3 -3
drivers/input/tablet/gtco.c
··· 676 676 677 677 /* Mask out the Y tilt value used for pressure */ 678 678 device->buffer[7] = (u8)((device->buffer[7]) & 0x7F); 679 + fallthrough; 679 680 680 - /* Fall thru */ 681 681 case 4: 682 682 /* Tilt */ 683 683 input_report_abs(inputdev, ABS_TILT_X, ··· 685 685 686 686 input_report_abs(inputdev, ABS_TILT_Y, 687 687 sign_extend32(device->buffer[7], 6)); 688 + fallthrough; 688 689 689 - /* Fall thru */ 690 690 case 2: 691 691 case 3: 692 692 /* Convert buttons, only 5 bits possible */ ··· 695 695 /* We don't apply any meaning to the bitmask, 696 696 just report */ 697 697 input_event(inputdev, EV_MSC, MSC_SERIAL, val); 698 + fallthrough; 698 699 699 - /* Fall thru */ 700 700 case 1: 701 701 /* All reports have X and Y coords in the same place */ 702 702 val = get_unaligned_le16(&device->buffer[1]);
+1 -1
drivers/input/tablet/pegasus_notetaker.c
··· 146 146 /* xy data */ 147 147 case BATTERY_LOW: 148 148 dev_warn_once(&dev->dev, "Pen battery low\n"); 149 - /* fall through */ 149 + fallthrough; 150 150 151 151 case BATTERY_NO_REPORT: 152 152 case BATTERY_GOOD:
+1 -2
drivers/input/touchscreen/edt-ft5x06.c
··· 288 288 wrbuf[3] = wrbuf[0] ^ wrbuf[1] ^ wrbuf[2]; 289 289 return edt_ft5x06_ts_readwrite(tsdata->client, 4, 290 290 wrbuf, 0, NULL); 291 - /* fallthrough */ 291 + 292 292 case EDT_M09: 293 293 case EDT_M12: 294 294 case EV_FT: ··· 330 330 } 331 331 break; 332 332 333 - /* fallthrough */ 334 333 case EDT_M09: 335 334 case EDT_M12: 336 335 case EV_FT:
+1 -1
drivers/input/touchscreen/elants_i2c.c
··· 955 955 break; 956 956 957 957 ts->state = ELAN_STATE_NORMAL; 958 - /* fall through */ 958 + fallthrough; 959 959 960 960 case ELAN_STATE_NORMAL: 961 961
+1 -1
drivers/input/touchscreen/elo.c
··· 348 348 349 349 case 1: /* 6-byte protocol */ 350 350 input_set_abs_params(input_dev, ABS_PRESSURE, 0, 15, 0, 0); 351 - /* fall through */ 351 + fallthrough; 352 352 353 353 case 2: /* 4-byte protocol */ 354 354 input_set_abs_params(input_dev, ABS_X, 96, 4000, 0, 0);
+1 -1
drivers/input/touchscreen/iqs5xx.c
··· 289 289 break; 290 290 case IQS5XX_BL_CMD_EXEC: 291 291 usleep_range(10000, 10100); 292 - /* fall through */ 292 + fallthrough; 293 293 default: 294 294 return 0; 295 295 }
-1
drivers/input/touchscreen/max11801_ts.c
··· 130 130 131 131 switch (buf[1] & EVENT_TAG_MASK) { 132 132 case EVENT_INIT: 133 - /* fall through */ 134 133 case EVENT_MIDDLE: 135 134 input_report_abs(data->input_dev, ABS_X, x); 136 135 input_report_abs(data->input_dev, ABS_Y, y);
+1 -1
drivers/input/touchscreen/stmfts.c
··· 255 255 case STMFTS_EV_SLEEP_OUT_CONTROLLER_READY: 256 256 case STMFTS_EV_STATUS: 257 257 complete(&sdata->cmd_done); 258 - /* fall through */ 258 + fallthrough; 259 259 260 260 case STMFTS_EV_NO_EVENT: 261 261 case STMFTS_EV_DEBUG: