OSDN Git Service

Input: Use fallthrough pseudo-keyword
authorGustavo A. R. Silva <gustavoars@kernel.org>
Tue, 7 Jul 2020 18:24:55 +0000 (11:24 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 7 Jul 2020 18:25:54 +0000 (11:25 -0700)
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>
30 files changed:
drivers/input/joystick/db9.c
drivers/input/joystick/gamecon.c
drivers/input/joystick/sidewinder.c
drivers/input/joystick/spaceball.c
drivers/input/keyboard/adp5589-keys.c
drivers/input/keyboard/atkbd.c
drivers/input/keyboard/gpio_keys.c
drivers/input/misc/iqs269a.c
drivers/input/misc/pwm-vibra.c
drivers/input/misc/xen-kbdfront.c
drivers/input/mouse/appletouch.c
drivers/input/mouse/cyapa_gen3.c
drivers/input/mouse/cyapa_gen5.c
drivers/input/mouse/cyapa_gen6.c
drivers/input/mouse/elantech.c
drivers/input/mouse/hgpk.c
drivers/input/mouse/navpoint.c
drivers/input/mouse/sentelic.c
drivers/input/mouse/sermouse.c
drivers/input/serio/i8042.c
drivers/input/serio/libps2.c
drivers/input/sparse-keymap.c
drivers/input/tablet/gtco.c
drivers/input/tablet/pegasus_notetaker.c
drivers/input/touchscreen/edt-ft5x06.c
drivers/input/touchscreen/elants_i2c.c
drivers/input/touchscreen/elo.c
drivers/input/touchscreen/iqs5xx.c
drivers/input/touchscreen/max11801_ts.c
drivers/input/touchscreen/stmfts.c

index a7bc576..434d265 100644 (file)
@@ -247,7 +247,7 @@ static unsigned char db9_saturn_read_packet(struct parport *port, unsigned char
                        db9_saturn_write_sub(port, type, 3, powered, 0);
                        return data[0] = 0xe3;
                }
-               /* fall through */
+               fallthrough;
        default:
                return data[0];
        }
@@ -267,14 +267,14 @@ static int db9_saturn_report(unsigned char id, unsigned char data[60], struct in
                switch (data[j]) {
                case 0x16: /* multi controller (analog 4 axis) */
                        input_report_abs(dev, db9_abs[5], data[j + 6]);
-                       /* fall through */
+                       fallthrough;
                case 0x15: /* mission stick (analog 3 axis) */
                        input_report_abs(dev, db9_abs[3], data[j + 4]);
                        input_report_abs(dev, db9_abs[4], data[j + 5]);
-                       /* fall through */
+                       fallthrough;
                case 0x13: /* racing controller (analog 1 axis) */
                        input_report_abs(dev, db9_abs[2], data[j + 3]);
-                       /* fall through */
+                       fallthrough;
                case 0x34: /* saturn keyboard (udlr ZXC ASD QE Esc) */
                case 0x02: /* digital pad (digital 2 axis + buttons) */
                        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)
                        input_report_abs(dev2, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1));
                        input_report_abs(dev2, ABS_Y, (data & DB9_DOWN  ? 0 : 1) - (data & DB9_UP   ? 0 : 1));
                        input_report_key(dev2, BTN_TRIGGER, ~data & DB9_FIRE1);
-                       /* fall through */
+                       fallthrough;
 
                case DB9_MULTI_0802:
 
index e0a362b..88df68c 100644 (file)
@@ -485,7 +485,7 @@ static void gc_multi_process_packet(struct gc *gc)
                switch (pad->type) {
                case GC_MULTI2:
                        input_report_key(dev, BTN_THUMB, s & data[5]);
-                       /* fall through */
+                       fallthrough;
 
                case GC_MULTI:
                        input_report_abs(dev, ABS_X,
@@ -638,7 +638,7 @@ static void gc_psx_report_one(struct gc_pad *pad, unsigned char psx_type,
 
                input_report_key(dev, BTN_THUMBL, ~data[0] & 0x04);
                input_report_key(dev, BTN_THUMBR, ~data[0] & 0x02);
-               /* fall through */
+               fallthrough;
 
        case GC_PSX_NEGCON:
        case GC_PSX_ANALOG:
@@ -872,7 +872,8 @@ static int gc_setup_pad(struct gc *gc, int idx, int pad_type)
        case GC_SNES:
                for (i = 4; i < 8; i++)
                        input_set_capability(input_dev, EV_KEY, gc_snes_btn[i]);
-               /* fall through */
+               fallthrough;
+
        case GC_NES:
                for (i = 0; i < 4; i++)
                        input_set_capability(input_dev, EV_KEY, gc_snes_btn[i]);
@@ -880,7 +881,8 @@ static int gc_setup_pad(struct gc *gc, int idx, int pad_type)
 
        case GC_MULTI2:
                input_set_capability(input_dev, EV_KEY, BTN_THUMB);
-               /* fall through */
+               fallthrough;
+
        case GC_MULTI:
                input_set_capability(input_dev, EV_KEY, BTN_TRIGGER);
                /* fall through */
index 1777e68..fac91ea 100644 (file)
@@ -656,16 +656,19 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv)
 
                        switch (i * m) {
                                case 60:
-                                       sw->number++;                   /* fall through */
+                                       sw->number++;
+                                       fallthrough;
                                case 45:                                /* Ambiguous packet length */
                                        if (j <= 40) {                  /* ID length less or eq 40 -> FSP */
                                case 43:
                                                sw->type = SW_ID_FSP;
                                                break;
                                        }
-                                       sw->number++;                   /* fall through */
+                                       sw->number++;
+                                       fallthrough;
                                case 30:
-                                       sw->number++;                   /* fall through */
+                                       sw->number++;
+                                       fallthrough;
                                case 15:
                                        sw->type = SW_ID_GP;
                                        break;
@@ -681,9 +684,11 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv)
                                                sw->type = SW_ID_PP;
                                        break;
                                case 66:
-                                       sw->bits = 3;                   /* fall through */
+                                       sw->bits = 3;
+                                       fallthrough;
                                case 198:
-                                       sw->length = 22;                /* fall through */
+                                       sw->length = 22;
+                                       fallthrough;
                                case 64:
                                        sw->type = SW_ID_3DP;
                                        if (j == 160)
index cf7cbcd..429411c 100644 (file)
@@ -146,7 +146,7 @@ static irqreturn_t spaceball_interrupt(struct serio *serio,
                                break;
                        }
                        spaceball->escape = 0;
-                       /* fall through */
+                       fallthrough;
                case 'M':
                case 'Q':
                case 'S':
@@ -154,7 +154,7 @@ static irqreturn_t spaceball_interrupt(struct serio *serio,
                                spaceball->escape = 0;
                                data &= 0x1f;
                        }
-                       /* fall through */
+                       fallthrough;
                default:
                        if (spaceball->escape)
                                spaceball->escape = 0;
@@ -220,13 +220,13 @@ static int spaceball_connect(struct serio *serio, struct serio_driver *drv)
                        input_dev->keybit[BIT_WORD(BTN_A)] |= BIT_MASK(BTN_A) |
                                BIT_MASK(BTN_B) | BIT_MASK(BTN_C) |
                                BIT_MASK(BTN_MODE);
-                       /* fall through */
+                       fallthrough;
                default:
                        input_dev->keybit[BIT_WORD(BTN_0)] |= BIT_MASK(BTN_2) |
                                BIT_MASK(BTN_3) | BIT_MASK(BTN_4) |
                                BIT_MASK(BTN_5) | BIT_MASK(BTN_6) |
                                BIT_MASK(BTN_7) | BIT_MASK(BTN_8);
-                       /* fall through */
+                       fallthrough;
                case SPACEBALL_3003C:
                        input_dev->keybit[BIT_WORD(BTN_0)] |= BIT_MASK(BTN_1) |
                                BIT_MASK(BTN_8);
index e7d58e7..eb0e9cd 100644 (file)
@@ -1016,7 +1016,7 @@ static int adp5589_probe(struct i2c_client *client,
        switch (id->driver_data) {
        case ADP5585_02:
                kpad->support_row5 = true;
-               /* fall through */
+               fallthrough;
        case ADP5585_01:
                kpad->is_adp5585 = true;
                kpad->var = &const_adp5585;
index 6ec2826..edc613e 100644 (file)
@@ -1241,7 +1241,7 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv)
 
        case SERIO_8042_XL:
                atkbd->translated = true;
-               /* Fall through */
+               fallthrough;
 
        case SERIO_8042:
                if (serio->write)
index 53c9ff3..f2d4e4d 100644 (file)
@@ -574,7 +574,6 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
                                IRQ_TYPE_EDGE_RISING : IRQ_TYPE_EDGE_FALLING;
                        break;
                case EV_ACT_ANY:
-                       /* fall through */
                default:
                        /*
                         * For other cases, we are OK letting suspend/resume
index 6699eb1..a348247 100644 (file)
@@ -575,8 +575,7 @@ static int iqs269_parse_chan(struct iqs269_private *iqs269,
 
                case IQS269_LOCAL_CAP_SIZE_GLOBAL_0pF5:
                        engine_a |= IQS269_CHx_ENG_A_LOCAL_CAP_SIZE;
-
-                       /* fall through */
+                       fallthrough;
 
                case IQS269_LOCAL_CAP_SIZE_GLOBAL_ONLY:
                        engine_b |= IQS269_CHx_ENG_B_LOCAL_CAP_ENABLE;
@@ -731,14 +730,12 @@ static int iqs269_parse_chan(struct iqs269_private *iqs269,
                                iqs269->switches[i].code = val;
                                iqs269->switches[i].enabled = true;
                        }
-
-                       /* fall through */
+                       fallthrough;
 
                case IQS269_CHx_HALL_INACTIVE:
                        if (iqs269->hall_enable)
                                break;
-
-                       /* fall through */
+                       fallthrough;
 
                default:
                        iqs269->keycode[i * IQS269_NUM_CH + reg] = val;
@@ -1143,14 +1140,12 @@ static int iqs269_input_init(struct iqs269_private *iqs269)
                                                            sw_code,
                                                            state & BIT(j));
                                }
-
-                               /* fall through */
+                               fallthrough;
 
                        case IQS269_CHx_HALL_INACTIVE:
                                if (iqs269->hall_enable)
                                        continue;
-
-                               /* fall through */
+                               fallthrough;
 
                        default:
                                if (keycode != KEY_RESERVED)
@@ -1273,14 +1268,12 @@ static int iqs269_report(struct iqs269_private *iqs269)
                                        input_report_switch(iqs269->keypad,
                                                            sw_code,
                                                            state & BIT(j));
-
-                               /* fall through */
+                               fallthrough;
 
                        case IQS269_CHx_HALL_INACTIVE:
                                if (iqs269->hall_enable)
                                        continue;
-
-                               /* fall through */
+                               fallthrough;
 
                        default:
                                input_report_key(iqs269->keypad, keycode,
index 8ceaf7d..81e777a 100644 (file)
@@ -190,7 +190,7 @@ static int pwm_vibrator_probe(struct platform_device *pdev)
 
        default:
                dev_err(&pdev->dev, "Failed to request direction pwm: %d", err);
-               /* Fall through */
+               fallthrough;
 
        case -EPROBE_DEFER:
                return err;
index a1bba72..4ff5cd2 100644 (file)
@@ -124,7 +124,7 @@ static void xenkbd_handle_mt_event(struct xenkbd_info *info,
        switch (mtouch->event_type) {
        case XENKBD_MT_EV_DOWN:
                input_mt_report_slot_state(info->mtouch, MT_TOOL_FINGER, true);
-               /* fall through */
+               fallthrough;
 
        case XENKBD_MT_EV_MOTION:
                input_report_abs(info->mtouch, ABS_MT_POSITION_X,
@@ -524,7 +524,7 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
        case XenbusStateClosed:
                if (dev->state == XenbusStateClosed)
                        break;
-               /* fall through - Missed the backend's CLOSING state */
+               fallthrough;    /* Missed the backend's CLOSING state */
        case XenbusStateClosing:
                xenbus_frontend_closed(dev);
                break;
index 3f06e8a..bfa2665 100644 (file)
@@ -458,7 +458,7 @@ static int atp_status_check(struct urb *urb)
                                dev->info->datalen, dev->urb->actual_length);
                        dev->overflow_warned = true;
                }
-               /* fall through */
+               fallthrough;
        case -ECONNRESET:
        case -ENOENT:
        case -ESHUTDOWN:
index 00e395d..a0361f9 100644 (file)
@@ -1067,7 +1067,7 @@ static int cyapa_gen3_do_operational_check(struct cyapa *cyapa)
                        return error;
                }
 
-       /* Fall through */
+               fallthrough;
        case CYAPA_STATE_BL_IDLE:
                /* Try to get firmware version in bootloader mode. */
                cyapa_gen3_bl_query_data(cyapa);
@@ -1078,7 +1078,7 @@ static int cyapa_gen3_do_operational_check(struct cyapa *cyapa)
                        return error;
                }
 
-       /* Fall through */
+               fallthrough;
        case CYAPA_STATE_OP:
                /*
                 * Reading query data before going back to the full mode
index 7f012bf..bb3a63d 100644 (file)
@@ -2554,7 +2554,7 @@ static int cyapa_gen5_do_operational_check(struct cyapa *cyapa)
                }
 
                cyapa->state = CYAPA_STATE_GEN5_APP;
-               /* fall through */
+               fallthrough;
 
        case CYAPA_STATE_GEN5_APP:
                /*
index c1b524a..7eba66f 100644 (file)
@@ -680,7 +680,7 @@ static int cyapa_gen6_operational_check(struct cyapa *cyapa)
                }
 
                cyapa->state = CYAPA_STATE_GEN6_APP;
-               /* fall through */
+               fallthrough;
 
        case CYAPA_STATE_GEN6_APP:
                /*
index e4f394c..90f8765 100644 (file)
@@ -383,7 +383,7 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse)
                 */
                if (packet[3] & 0x80)
                        fingers = 4;
-               /* fall through */
+               fallthrough;
        case 1:
                /*
                 * byte 1:  .   .   .   .  x11 x10 x9  x8
@@ -1146,7 +1146,7 @@ static int elantech_set_input_params(struct psmouse *psmouse)
        case 2:
                __set_bit(BTN_TOOL_QUADTAP, dev->keybit);
                __set_bit(INPUT_PROP_SEMI_MT, dev->propbit);
-               /* fall through */
+               fallthrough;
        case 3:
                if (info->hw_version == 3)
                        elantech_set_buttonpad_prop(psmouse);
@@ -1877,12 +1877,10 @@ static bool elantech_use_host_notify(struct psmouse *psmouse,
                /* expected case */
                break;
        case ETP_BUS_SMB_ALERT_ONLY:
-               /* fall-through  */
        case ETP_BUS_PS2_SMB_ALERT:
                psmouse_dbg(psmouse, "Ignoring SMBus provider through alert protocol.\n");
                break;
        case ETP_BUS_SMB_HST_NTFY_ONLY:
-               /* fall-through  */
        case ETP_BUS_PS2_SMB_HST_NTFY:
                return true;
        default:
index 72a083f..4dc4413 100644 (file)
@@ -238,7 +238,7 @@ static void hgpk_spewing_hack(struct psmouse *psmouse,
                /* we're not spewing, but this packet might be the start */
                priv->spew_flag = MAYBE_SPEWING;
 
-               /* fall-through */
+               fallthrough;
 
        case MAYBE_SPEWING:
                priv->spew_count++;
@@ -249,7 +249,7 @@ static void hgpk_spewing_hack(struct psmouse *psmouse,
                /* excessive spew detected, request recalibration */
                priv->spew_flag = SPEW_DETECTED;
 
-               /* fall-through */
+               fallthrough;
 
        case SPEW_DETECTED:
                /* only recalibrate when the overall delta to the cursor
index 0b75248..c112980 100644 (file)
@@ -105,7 +105,7 @@ static void navpoint_packet(struct navpoint *navpoint)
        case 0x19:      /* Module 0, Hello packet */
                if ((navpoint->data[1] & 0xf0) == 0x10)
                        break;
-               /* FALLTHROUGH */
+               fallthrough;
        default:
                dev_warn(navpoint->dev,
                         "spurious packet: data=0x%02x,0x%02x,...\n",
index e99d9bf..9f7ecc7 100644 (file)
@@ -794,7 +794,7 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse)
                /* on-pad click, filter it if necessary */
                if ((ad->flags & FSPDRV_FLAG_EN_OPC) != FSPDRV_FLAG_EN_OPC)
                        packet[0] &= ~FSP_PB0_LBTN;
-               /* fall through */
+               fallthrough;
 
        case FSP_PKT_TYPE_NORMAL:
                /* normal packet */
index ea9242d..caa79c1 100644 (file)
@@ -128,7 +128,7 @@ static void sermouse_process_ms(struct sermouse *sermouse, signed char data)
 
                                case SERIO_MS:
                                        sermouse->type = SERIO_MP;
-                                       /* fall through */
+                                       fallthrough;
 
                                case SERIO_MP:
                                        if ((data >> 2) & 3) break;     /* M++ Wireless Extension packet. */
@@ -139,7 +139,7 @@ static void sermouse_process_ms(struct sermouse *sermouse, signed char data)
                                case SERIO_MZP:
                                case SERIO_MZPP:
                                        input_report_key(dev, BTN_SIDE,   (data >> 5) & 1);
-                                       /* fall through */
+                                       fallthrough;
 
                                case SERIO_MZ:
                                        input_report_key(dev, BTN_MIDDLE, (data >> 4) & 1);
index 0dddf27..d3eda48 100644 (file)
@@ -562,7 +562,7 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id)
                                                str = last_str;
                                                break;
                                        }
-                                       /* fall through - report timeout */
+                                       fallthrough;    /* report timeout */
                                case 0xfc:
                                case 0xfd:
                                case 0xfe: dfl = SERIO_TIMEOUT; data = 0xfe; break;
index a8c94a9..8a16e41 100644 (file)
@@ -418,7 +418,7 @@ bool ps2_handle_ack(struct ps2dev *ps2dev, u8 data)
                        ps2dev->nak = 0;
                        break;
                }
-               /* Fall through */
+               fallthrough;
        default:
                /*
                 * Do not signal errors if we get unexpected reply while
index 530fd15..25bf8be 100644 (file)
@@ -247,7 +247,7 @@ void sparse_keymap_report_entry(struct input_dev *dev, const struct key_entry *k
 
        case KE_SW:
                value = ke->sw.value;
-               /* fall through */
+               fallthrough;
 
        case KE_VSW:
                input_report_switch(dev, ke->sw.code, value);
index 96d6557..44bb1f6 100644 (file)
@@ -676,8 +676,8 @@ static void gtco_urb_callback(struct urb *urbinfo)
 
                        /* Mask out the Y tilt value used for pressure */
                        device->buffer[7] = (u8)((device->buffer[7]) & 0x7F);
+                       fallthrough;
 
-                       /* Fall thru */
                case 4:
                        /* Tilt */
                        input_report_abs(inputdev, ABS_TILT_X,
@@ -685,8 +685,8 @@ static void gtco_urb_callback(struct urb *urbinfo)
 
                        input_report_abs(inputdev, ABS_TILT_Y,
                                         sign_extend32(device->buffer[7], 6));
+                       fallthrough;
 
-                       /* Fall thru */
                case 2:
                case 3:
                        /* Convert buttons, only 5 bits possible */
@@ -695,8 +695,8 @@ static void gtco_urb_callback(struct urb *urbinfo)
                        /* We don't apply any meaning to the bitmask,
                           just report */
                        input_event(inputdev, EV_MSC, MSC_SERIAL, val);
+                       fallthrough;
 
-                       /*  Fall thru */
                case 1:
                        /* All reports have X and Y coords in the same place */
                        val = get_unaligned_le16(&device->buffer[1]);
index 38f0874..749edbd 100644 (file)
@@ -146,7 +146,7 @@ static void pegasus_parse_packet(struct pegasus *pegasus)
        /* xy data */
        case BATTERY_LOW:
                dev_warn_once(&dev->dev, "Pen battery low\n");
-               /* fall through */
+               fallthrough;
 
        case BATTERY_NO_REPORT:
        case BATTERY_GOOD:
index 3a4f18d..6ff81d4 100644 (file)
@@ -288,7 +288,7 @@ static int edt_ft5x06_register_write(struct edt_ft5x06_ts_data *tsdata,
                wrbuf[3] = wrbuf[0] ^ wrbuf[1] ^ wrbuf[2];
                return edt_ft5x06_ts_readwrite(tsdata->client, 4,
                                        wrbuf, 0, NULL);
-       /* fallthrough */
+
        case EDT_M09:
        case EDT_M12:
        case EV_FT:
@@ -330,7 +330,6 @@ static int edt_ft5x06_register_read(struct edt_ft5x06_ts_data *tsdata,
                }
                break;
 
-       /* fallthrough */
        case EDT_M09:
        case EDT_M12:
        case EV_FT:
index 233cb10..a765aa8 100644 (file)
@@ -955,7 +955,7 @@ static irqreturn_t elants_i2c_irq(int irq, void *_dev)
                        break;
 
                ts->state = ELAN_STATE_NORMAL;
-               /* fall through */
+               fallthrough;
 
        case ELAN_STATE_NORMAL:
 
index d6772a2..e0bacd3 100644 (file)
@@ -348,7 +348,7 @@ static int elo_connect(struct serio *serio, struct serio_driver *drv)
 
        case 1: /* 6-byte protocol */
                input_set_abs_params(input_dev, ABS_PRESSURE, 0, 15, 0, 0);
-               /* fall through */
+               fallthrough;
 
        case 2: /* 4-byte protocol */
                input_set_abs_params(input_dev, ABS_X, 96, 4000, 0, 0);
index 5875bb1..3162b68 100644 (file)
@@ -289,7 +289,7 @@ static int iqs5xx_bl_cmd(struct i2c_client *client, u8 bl_cmd, u16 bl_addr)
                break;
        case IQS5XX_BL_CMD_EXEC:
                usleep_range(10000, 10100);
-               /* fall through */
+               fallthrough;
        default:
                return 0;
        }
index 1af08d3..f15713a 100644 (file)
@@ -130,7 +130,6 @@ static irqreturn_t max11801_ts_interrupt(int irq, void *dev_id)
 
                switch (buf[1] & EVENT_TAG_MASK) {
                case EVENT_INIT:
-                       /* fall through */
                case EVENT_MIDDLE:
                        input_report_abs(data->input_dev, ABS_X, x);
                        input_report_abs(data->input_dev, ABS_Y, y);
index b54cc64..df94686 100644 (file)
@@ -255,7 +255,7 @@ static void stmfts_parse_events(struct stmfts_data *sdata)
                case STMFTS_EV_SLEEP_OUT_CONTROLLER_READY:
                case STMFTS_EV_STATUS:
                        complete(&sdata->cmd_done);
-                       /* fall through */
+                       fallthrough;
 
                case STMFTS_EV_NO_EVENT:
                case STMFTS_EV_DEBUG: