usb: gadget: Use fallthrough pseudo-keyword
authorGustavo A. R. Silva <gustavoars@kernel.org>
Tue, 7 Jul 2020 17:15:00 +0000 (12:15 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Jul 2020 06:55:18 +0000 (08:55 +0200)
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/20200707171500.GA13620@embeddedor
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16 files changed:
drivers/usb/gadget/composite.c
drivers/usb/gadget/function/f_fs.c
drivers/usb/gadget/function/f_hid.c
drivers/usb/gadget/function/f_mass_storage.c
drivers/usb/gadget/function/f_phonet.c
drivers/usb/gadget/function/f_printer.c
drivers/usb/gadget/function/f_rndis.c
drivers/usb/gadget/function/f_tcm.c
drivers/usb/gadget/function/u_ether.c
drivers/usb/gadget/function/u_serial.c
drivers/usb/gadget/legacy/inode.c
drivers/usb/gadget/udc/dummy_hcd.c
drivers/usb/gadget/udc/goku_udc.c
drivers/usb/gadget/udc/omap_udc.c
drivers/usb/gadget/udc/s3c2410_udc.c
drivers/usb/gadget/udc/tegra-xudc.c

index 8fbf73467fef988fb1afd30e7055192d93c1e31c..05b176c82cc522b7416b0379915af615b3eac4ec 100644 (file)
@@ -72,17 +72,17 @@ function_descriptors(struct usb_function *f,
                descriptors = f->ssp_descriptors;
                if (descriptors)
                        break;
-               /* FALLTHROUGH */
+               fallthrough;
        case USB_SPEED_SUPER:
                descriptors = f->ss_descriptors;
                if (descriptors)
                        break;
-               /* FALLTHROUGH */
+               fallthrough;
        case USB_SPEED_HIGH:
                descriptors = f->hs_descriptors;
                if (descriptors)
                        break;
-               /* FALLTHROUGH */
+               fallthrough;
        default:
                descriptors = f->fs_descriptors;
        }
@@ -170,20 +170,20 @@ int config_ep_by_speed_and_alt(struct usb_gadget *g,
                        want_comp_desc = 1;
                        break;
                }
-               /* fall through */
+               fallthrough;
        case USB_SPEED_SUPER:
                if (gadget_is_superspeed(g)) {
                        speed_desc = f->ss_descriptors;
                        want_comp_desc = 1;
                        break;
                }
-               /* fall through */
+               fallthrough;
        case USB_SPEED_HIGH:
                if (gadget_is_dualspeed(g)) {
                        speed_desc = f->hs_descriptors;
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                speed_desc = f->fs_descriptors;
        }
@@ -237,7 +237,7 @@ ep_found:
                case USB_ENDPOINT_XFER_ISOC:
                        /* mult: bits 1:0 of bmAttributes */
                        _ep->mult = (comp_desc->bmAttributes & 0x3) + 1;
-                       /* fall through */
+                       fallthrough;
                case USB_ENDPOINT_XFER_BULK:
                case USB_ENDPOINT_XFER_INT:
                        _ep->maxburst = comp_desc->bMaxBurst + 1;
@@ -1697,7 +1697,7 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
                        if (!gadget_is_dualspeed(gadget) ||
                            gadget->speed >= USB_SPEED_SUPER)
                                break;
-                       /* FALLTHROUGH */
+                       fallthrough;
                case USB_DT_CONFIG:
                        value = config_desc(cdev, w_value);
                        if (value >= 0)
index 2d00ba0726453f22c3016ca6a61aec36dca6b1a0..046f770a76dae1cd0d40cb028ae950bd797287d2 100644 (file)
@@ -2726,7 +2726,7 @@ static void __ffs_event_add(struct ffs_data *ffs,
        switch (type) {
        case FUNCTIONFS_RESUME:
                rem_type2 = FUNCTIONFS_SUSPEND;
-               /* FALL THROUGH */
+               fallthrough;
        case FUNCTIONFS_SUSPEND:
        case FUNCTIONFS_SETUP:
                rem_type1 = type;
index df671acdd464b7e9c323ebfbadc0fefd9e37acfd..1125f4715830de1e5e201001e042f758a7ac395e 100644 (file)
@@ -477,7 +477,7 @@ static void hidg_set_report_complete(struct usb_ep *ep, struct usb_request *req)
                break;
        default:
                ERROR(cdev, "Set report failed %d\n", req->status);
-               /* FALLTHROUGH */
+               fallthrough;
        case -ECONNABORTED:             /* hardware forced ep reset */
        case -ECONNRESET:               /* request dequeued */
        case -ESHUTDOWN:                /* disconnect from host */
index 950d2a85f098e1532ae3744759a3c2d410b3d991..331c951d72dc994ab4f16f4ee9d1c095f046dae6 100644 (file)
@@ -2039,7 +2039,7 @@ static int do_scsi_command(struct fsg_common *common)
        case RELEASE:
        case RESERVE:
        case SEND_DIAGNOSTIC:
-               /* Fall through */
+               fallthrough;
 
        default:
 unknown_cmnd:
index d7f6cc51b7ece7abc93d63fa5931887c052c4c43..0b468f5d55bc5df968de2ab142ddcc2c8d50c3aa 100644 (file)
@@ -212,7 +212,7 @@ static void pn_tx_complete(struct usb_ep *ep, struct usb_request *req)
        case -ESHUTDOWN: /* disconnected */
        case -ECONNRESET: /* disabled */
                dev->stats.tx_aborted_errors++;
-               /* fall through */
+               fallthrough;
        default:
                dev->stats.tx_errors++;
        }
@@ -360,7 +360,7 @@ static void pn_rx_complete(struct usb_ep *ep, struct usb_request *req)
        /* Do resubmit in these cases: */
        case -EOVERFLOW: /* request buffer overflow */
                dev->stats.rx_over_errors++;
-               /* fall through */
+               fallthrough;
        default:
                dev->stats.rx_errors++;
                break;
index 9c7ed2539ff7727c64427d76a681a063c82937b7..ec15f7637e405eb1c69955b85f989ebf61443bac 100644 (file)
@@ -285,7 +285,7 @@ static void rx_complete(struct usb_ep *ep, struct usb_request *req)
 
        /* data overrun */
        case -EOVERFLOW:
-               /* FALLTHROUGH */
+               fallthrough;
 
        default:
                DBG(dev, "rx status %d\n", status);
@@ -304,7 +304,7 @@ static void tx_complete(struct usb_ep *ep, struct usb_request *req)
        switch (req->status) {
        default:
                VDBG(dev, "tx err %d\n", req->status);
-               /* FALLTHROUGH */
+               fallthrough;
        case -ECONNRESET:               /* unlink */
        case -ESHUTDOWN:                /* disconnect etc */
                break;
@@ -919,7 +919,7 @@ static bool gprinter_req_match(struct usb_function *f,
                if (!w_value && !w_length &&
                   !(USB_DIR_IN & ctrl->bRequestType))
                        break;
-               /* fall through */
+               fallthrough;
        default:
                return false;
        }
index 0d8e4a364ca6e0d54d01fc644c4907287b88646c..9534c8ab62a8e4c7bcd4e8e47b2e87c501582f13 100644 (file)
@@ -426,7 +426,7 @@ static void rndis_response_complete(struct usb_ep *ep, struct usb_request *req)
                DBG(cdev, "RNDIS %s response error %d, %d/%d\n",
                        ep->name, status,
                        req->actual, req->length);
-               /* FALLTHROUGH */
+               fallthrough;
        case 0:
                if (ep != rndis->notify)
                        break;
index eaf556ceac32b741f054c3cde8f044df72f06228..d94b814328c8bfb447e14947e5b4e34a97d4f31f 100644 (file)
@@ -1150,7 +1150,7 @@ static int usbg_submit_command(struct f_uas *fu,
        default:
                pr_debug_once("Unsupported prio_attr: %02x.\n",
                                cmd_iu->prio_attr);
-               /* fall through */
+               fallthrough;
        case UAS_SIMPLE_TAG:
                cmd->prio_attr = TCM_SIMPLE_TAG;
                break;
index f01e3e21ecf2155683a7e137a75bc936cade41cf..c3cc6bd14e615a26bfaaa938938e4d0859814978 100644 (file)
@@ -321,7 +321,7 @@ quiesce:
        /* data overrun */
        case -EOVERFLOW:
                dev->net->stats.rx_over_errors++;
-               /* FALLTHROUGH */
+               fallthrough;
 
        default:
                dev->net->stats.rx_errors++;
@@ -444,7 +444,7 @@ static void tx_complete(struct usb_ep *ep, struct usb_request *req)
        default:
                dev->net->stats.tx_errors++;
                VDBG(dev, "tx err %d\n", req->status);
-               /* FALLTHROUGH */
+               fallthrough;
        case -ECONNRESET:               /* unlink */
        case -ESHUTDOWN:                /* disconnect etc */
                dev_kfree_skb_any(skb);
index c295defe7ecd3a725705215e2f4e0b5efe6ebc8c..127ecc2b431766730a2989d39495fc492178f70c 100644 (file)
@@ -386,7 +386,7 @@ static void gs_rx_push(struct work_struct *work)
                        /* presumably a transient fault */
                        pr_warn("ttyGS%d: unexpected RX status %d\n",
                                port->port_num, req->status);
-                       /* FALLTHROUGH */
+                       fallthrough;
                case 0:
                        /* normal completion */
                        break;
@@ -472,7 +472,7 @@ static void gs_write_complete(struct usb_ep *ep, struct usb_request *req)
                /* presumably a transient fault */
                pr_warn("%s: unexpected %s status %d\n",
                        __func__, ep->name, req->status);
-               /* FALL THROUGH */
+               fallthrough;
        case 0:
                /* normal completion */
                gs_start_tx(port);
@@ -871,7 +871,7 @@ static void gs_console_complete_out(struct usb_ep *ep, struct usb_request *req)
        default:
                pr_warn("%s: unexpected %s status %d\n",
                        __func__, ep->name, req->status);
-               /* fall through */
+               fallthrough;
        case 0:
                /* normal completion */
                spin_lock(&cons->lock);
index 9ee0bfe7bcdaeac2b6377894adf05b64813b7c2d..1b430b36d0a6be6042732c586446129c09a823a5 100644 (file)
@@ -312,7 +312,7 @@ nonblock:
        case STATE_EP_READY:                    /* not configured yet */
                if (is_write)
                        return 0;
-               // FALLTHRU
+               fallthrough;
        case STATE_EP_UNBOUND:                  /* clean disconnect */
                break;
        // case STATE_EP_DISABLED:              /* "can't happen" */
@@ -1084,7 +1084,7 @@ next_event (struct dev_data *dev, enum usb_gadgetfs_event_type type)
        case GADGETFS_DISCONNECT:
                if (dev->state == STATE_DEV_SETUP)
                        dev->setup_abort = 1;
-               // FALL THROUGH
+               fallthrough;
        case GADGETFS_CONNECT:
                dev->ev_next = 0;
                break;
@@ -1381,7 +1381,6 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
                        make_qualifier (dev);
                        break;
                case USB_DT_OTHER_SPEED_CONFIG:
-                       // FALLTHROUGH
                case USB_DT_CONFIG:
                        value = config_buf (dev,
                                        w_value >> 8,
@@ -1718,7 +1717,7 @@ gadgetfs_suspend (struct usb_gadget *gadget)
        case STATE_DEV_UNCONNECTED:
                next_event (dev, GADGETFS_SUSPEND);
                ep0_readable (dev);
-               /* FALLTHROUGH */
+               fallthrough;
        default:
                break;
        }
index de65d424fb65d73005c03a72bd9d3bc3615f682c..53a227217f1cbc8ba42792af3721423941950412 100644 (file)
@@ -567,12 +567,12 @@ static int dummy_enable(struct usb_ep *_ep,
                        if (max <= 1024)
                                break;
                        /* save a return statement */
-                       /* fall through */
+                       fallthrough;
                case USB_SPEED_FULL:
                        if (max <= 64)
                                break;
                        /* save a return statement */
-                       /* fall through */
+                       fallthrough;
                default:
                        if (max <= 8)
                                break;
@@ -590,7 +590,7 @@ static int dummy_enable(struct usb_ep *_ep,
                        if (max <= 1024)
                                break;
                        /* save a return statement */
-                       /* fall through */
+                       fallthrough;
                case USB_SPEED_FULL:
                        if (max <= 1023)
                                break;
@@ -1943,7 +1943,7 @@ restart:
                         * this almost certainly polls too fast.
                         */
                        limit = max(limit, periodic_bytes(dum, ep));
-                       /* FALLTHROUGH */
+                       fallthrough;
 
                default:
 treat_control_like_bulk:
@@ -2252,7 +2252,7 @@ static int dummy_hub_control(
                                         "supported for USB 2.0 roothub\n");
                                goto error;
                        }
-                       /* FALLS THROUGH */
+                       fallthrough;
                case USB_PORT_FEAT_RESET:
                        /* if it's already enabled, disable */
                        if (hcd->speed == HCD_USB3) {
@@ -2276,7 +2276,7 @@ static int dummy_hub_control(
                         * interval? Is it still 50msec as for HS?
                         */
                        dum_hcd->re_timeout = jiffies + msecs_to_jiffies(50);
-                       /* FALLS THROUGH */
+                       fallthrough;
                default:
                        if (hcd->speed == HCD_USB3) {
                                if ((dum_hcd->port_status &
index 91dcb1995c27d935811671b0c5b27738942e233b..25c1d6ab5adb457d4af5904dca7e3ff6b299a28b 100644 (file)
@@ -125,11 +125,14 @@ goku_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
        max = get_unaligned_le16(&desc->wMaxPacketSize);
        switch (max) {
        case 64:
-               mode++; /* fall through */
+               mode++;
+               fallthrough;
        case 32:
-               mode++; /* fall through */
+               mode++;
+               fallthrough;
        case 16:
-               mode++; /* fall through */
+               mode++;
+               fallthrough;
        case 8:
                mode <<= 3;
                break;
index 4139da8856516c3ecdd87167149b11b06a06f039..494da00398d7cb460f89dcee771fea5ea1336cfa 100644 (file)
@@ -2831,7 +2831,7 @@ static int omap_udc_probe(struct platform_device *pdev)
                                type = "integrated";
                                break;
                        }
-                       /* FALL THROUGH */
+                       fallthrough;
                case 3:
                case 11:
                case 16:
@@ -2848,7 +2848,7 @@ static int omap_udc_probe(struct platform_device *pdev)
                case 14:                        /* transceiverless */
                        if (cpu_is_omap1710())
                                goto bad_on_1710;
-                       /* FALL THROUGH */
+                       fallthrough;
                case 13:
                case 15:
                        type = "no";
index 80002d97b59d82e788ce1c378b877661fb999cff..bc2e8eb737c3166280a929306719b87154ea5cf0 100644 (file)
@@ -308,7 +308,7 @@ static int s3c2410_udc_write_fifo(struct s3c2410_ep *ep,
        switch (idx) {
        default:
                idx = 0;
-               /* fall through */
+               fallthrough;
        case 0:
                fifo_reg = S3C2410_UDC_EP0_FIFO_REG;
                break;
@@ -413,7 +413,7 @@ static int s3c2410_udc_read_fifo(struct s3c2410_ep *ep,
        switch (idx) {
        default:
                idx = 0;
-               /* fall through */
+               fallthrough;
        case 0:
                fifo_reg = S3C2410_UDC_EP0_FIFO_REG;
                break;
index bbe1a04686dabf91d7c4f537ab58061417c6241a..404f77806c6a0a0a40f88b9c29c7b953732299dc 100644 (file)
@@ -2742,7 +2742,7 @@ static void tegra_xudc_handle_transfer_event(struct tegra_xudc *xudc,
                ep_wait_for_stopped(xudc, ep_index);
                ep->enq_ptr = ep->deq_ptr;
                tegra_xudc_ep_nuke(ep, -EIO);
-               /* FALLTHROUGH */
+               fallthrough;
        case TRB_CMPL_CODE_STREAM_NUMP_ERROR:
        case TRB_CMPL_CODE_CTRL_DIR_ERR:
        case TRB_CMPL_CODE_INVALID_STREAM_TYPE_ERR: