mtd: Convert fallthrough comments into statements
authorMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 25 Mar 2020 21:21:15 +0000 (22:21 +0100)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Mon, 30 Mar 2020 08:14:54 +0000 (10:14 +0200)
Use Joe Perches cvt_fallthrough.pl script to convert

/* fallthrough */

comments (and its derivatives) into a

fallthrough;

statement. This automatically drops useless ones.

Do it MTD-wide.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Vignesh Raghavendra <vigneshr@ti.com>
Acked-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Acked-by: Richard Weinberger <richard@nod.at>
Link: https://lore.kernel.org/linux-mtd/20200325212115.14170-1-miquel.raynal@bootlin.com
22 files changed:
drivers/mtd/chips/cfi_cmdset_0001.c
drivers/mtd/chips/cfi_cmdset_0002.c
drivers/mtd/chips/cfi_cmdset_0020.c
drivers/mtd/chips/cfi_util.c
drivers/mtd/devices/block2mtd.c
drivers/mtd/devices/phram.c
drivers/mtd/lpddr/lpddr_cmds.c
drivers/mtd/maps/sa1100-flash.c
drivers/mtd/nand/onenand/onenand_base.c
drivers/mtd/nand/raw/diskonchip.c
drivers/mtd/nand/raw/fsl_elbc_nand.c
drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
drivers/mtd/nand/raw/ingenic/jz4725b_bch.c
drivers/mtd/nand/raw/ingenic/jz4780_bch.c
drivers/mtd/nand/raw/nand_base.c
drivers/mtd/nand/raw/nand_legacy.c
drivers/mtd/nand/raw/nandsim.c
drivers/mtd/nand/raw/omap_elm.c
drivers/mtd/spi-nor/controllers/aspeed-smc.c
drivers/mtd/spi-nor/sfdp.c
drivers/mtd/ubi/attach.c
drivers/mtd/ubi/build.c

index 00a7948..142c0f9 100644 (file)
@@ -834,7 +834,7 @@ static int chip_ready (struct map_info *map, struct flchip *chip, unsigned long
                        /* Someone else might have been playing with it. */
                        return -EAGAIN;
                }
-               /* Fall through */
+               fallthrough;
        case FL_READY:
        case FL_CFI_QUERY:
        case FL_JEDEC_QUERY:
@@ -907,7 +907,7 @@ static int chip_ready (struct map_info *map, struct flchip *chip, unsigned long
                /* Only if there's no operation suspended... */
                if (mode == FL_READY && chip->oldstate == FL_READY)
                        return 0;
-               /* Fall through */
+               fallthrough;
        default:
        sleep:
                set_current_state(TASK_UNINTERRUPTIBLE);
index 04b383b..a1f3e10 100644 (file)
@@ -966,8 +966,7 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr
                /* Only if there's no operation suspended... */
                if (mode == FL_READY && chip->oldstate == FL_READY)
                        return 0;
-               /* fall through */
-
+               fallthrough;
        default:
        sleep:
                set_current_state(TASK_UNINTERRUPTIBLE);
@@ -2935,7 +2934,7 @@ static void cfi_amdstd_sync (struct mtd_info *mtd)
                         * as the whole point is that nobody can do anything
                         * with the chip now anyway.
                         */
-                       /* fall through */
+                       fallthrough;
                case FL_SYNCING:
                        mutex_unlock(&chip->mutex);
                        break;
index 54edae6..270322b 100644 (file)
@@ -324,8 +324,7 @@ static inline int do_read_onechip(struct map_info *map, struct flchip *chip, lof
        case FL_JEDEC_QUERY:
                map_write(map, CMD(0x70), cmd_addr);
                chip->state = FL_STATUS;
-               /* Fall through */
-
+               fallthrough;
        case FL_STATUS:
                status = map_read(map, cmd_addr);
                if (map_word_andequal(map, status, status_OK, status_OK)) {
@@ -462,8 +461,7 @@ static int do_write_buffer(struct map_info *map, struct flchip *chip,
 #ifdef DEBUG_CFI_FEATURES
        printk("%s: 1 status[%x]\n", __func__, map_read(map, cmd_adr));
 #endif
-               /* Fall through */
-
+               fallthrough;
        case FL_STATUS:
                status = map_read(map, cmd_adr);
                if (map_word_andequal(map, status, status_OK, status_OK))
@@ -756,8 +754,7 @@ retry:
        case FL_READY:
                map_write(map, CMD(0x70), adr);
                chip->state = FL_STATUS;
-               /* Fall through */
-
+               fallthrough;
        case FL_STATUS:
                status = map_read(map, adr);
                if (map_word_andequal(map, status, status_OK, status_OK))
@@ -998,7 +995,7 @@ static void cfi_staa_sync (struct mtd_info *mtd)
                         * as the whole point is that nobody can do anything
                         * with the chip now anyway.
                         */
-                       /* Fall through */
+                       fallthrough;
                case FL_SYNCING:
                        mutex_unlock(&chip->mutex);
                        break;
@@ -1054,8 +1051,7 @@ retry:
        case FL_READY:
                map_write(map, CMD(0x70), adr);
                chip->state = FL_STATUS;
-               /* Fall through */
-
+               fallthrough;
        case FL_STATUS:
                status = map_read(map, adr);
                if (map_word_andequal(map, status, status_OK, status_OK))
@@ -1201,8 +1197,7 @@ retry:
        case FL_READY:
                map_write(map, CMD(0x70), adr);
                chip->state = FL_STATUS;
-               /* Fall through */
-
+               fallthrough;
        case FL_STATUS:
                status = map_read(map, adr);
                if (map_word_andequal(map, status, status_OK, status_OK))
index e2d4db0..99b7986 100644 (file)
@@ -109,13 +109,13 @@ map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cfi_private *cfi
        case 8:
                onecmd |= (onecmd << (chip_mode * 32));
 #endif
-               /* fall through */
+               fallthrough;
        case 4:
                onecmd |= (onecmd << (chip_mode * 16));
-               /* fall through */
+               fallthrough;
        case 2:
                onecmd |= (onecmd << (chip_mode * 8));
-               /* fall through */
+               fallthrough;
        case 1:
                ;
        }
@@ -165,13 +165,13 @@ unsigned long cfi_merge_status(map_word val, struct map_info *map,
        case 8:
                res |= (onestat >> (chip_mode * 32));
 #endif
-               /* fall through */
+               fallthrough;
        case 4:
                res |= (onestat >> (chip_mode * 16));
-               /* fall through */
+               fallthrough;
        case 2:
                res |= (onestat >> (chip_mode * 8));
-               /* fall through */
+               fallthrough;
        case 1:
                ;
        }
index 36aa082..c08721b 100644 (file)
@@ -329,10 +329,10 @@ static int ustrtoul(const char *cp, char **endp, unsigned int base)
        switch (**endp) {
        case 'G' :
                result *= 1024;
-               /* fall through */
+               fallthrough;
        case 'M':
                result *= 1024;
-               /* fall through */
+               fallthrough;
        case 'K':
        case 'k':
                result *= 1024;
index b50ec7e..087b5e8 100644 (file)
@@ -148,10 +148,10 @@ static int parse_num64(uint64_t *num64, char *token)
                        switch (token[len - 2]) {
                        case 'G':
                                shift += 10;
-                               /* fall through */
+                               fallthrough;
                        case 'M':
                                shift += 10;
-                               /* fall through */
+                               fallthrough;
                        case 'k':
                                shift += 10;
                                token[len - 2] = 0;
index 9341a8a..fb1cbc9 100644 (file)
@@ -304,8 +304,7 @@ static int chip_ready(struct map_info *map, struct flchip *chip, int mode)
                /* Only if there's no operation suspended... */
                if (mode == FL_READY && chip->oldstate == FL_READY)
                        return 0;
-               /* fall through */
-
+               fallthrough;
        default:
 sleep:
                set_current_state(TASK_UNINTERRUPTIBLE);
index bb1ef65..d3d4e98 100644 (file)
@@ -81,8 +81,7 @@ static int sa1100_probe_subdev(struct sa_subdev_info *subdev, struct resource *r
        default:
                printk(KERN_WARNING "SA1100 flash: unknown base address "
                       "0x%08lx, assuming CS0\n", phys);
-               /* Fall through */
-
+               fallthrough;
        case SA1100_CS0_PHYS:
                subdev->map.bankwidth = (MSC0 & MSC_RBW) ? 2 : 4;
                break;
index d5326d1..ec18ade 100644 (file)
@@ -3259,7 +3259,7 @@ static void onenand_check_features(struct mtd_info *mtd)
        switch (density) {
        case ONENAND_DEVICE_DENSITY_8Gb:
                this->options |= ONENAND_HAS_NOP_1;
-               /* fall through */
+               fallthrough;
        case ONENAND_DEVICE_DENSITY_4Gb:
                if (ONENAND_IS_DDP(this))
                        this->options |= ONENAND_HAS_2PLANE;
index 2833c49..c2a391a 100644 (file)
@@ -1482,7 +1482,7 @@ static int __init doc_probe(unsigned long physadr)
                        break;
                case DOC_ChipID_DocMilPlus32:
                        pr_err("DiskOnChip Millennium Plus 32MB is not supported, ignoring.\n");
-                       /* fall through */
+                       fallthrough;
                default:
                        ret = -ENODEV;
                        goto notfound;
index 634c550..e1dc675 100644 (file)
@@ -324,8 +324,7 @@ static void fsl_elbc_cmdfunc(struct nand_chip *chip, unsigned int command,
        /* READ0 and READ1 read the entire buffer to use hardware ECC. */
        case NAND_CMD_READ1:
                column += 256;
-
-       /* fall-through */
+               fallthrough;
        case NAND_CMD_READ0:
                dev_dbg(priv->dev,
                        "fsl_elbc_cmdfunc: NAND_CMD_READ0, page_addr:"
index 49afebe..935c490 100644 (file)
@@ -253,7 +253,7 @@ static int ingenic_nand_attach_chip(struct nand_chip *chip)
                chip->ecc.hwctl = ingenic_nand_ecc_hwctl;
                chip->ecc.calculate = ingenic_nand_ecc_calculate;
                chip->ecc.correct = ingenic_nand_ecc_correct;
-               /* fall through */
+               fallthrough;
        case NAND_ECC_SOFT:
                dev_info(nfc->dev, "using %s (strength %d, size %d, bytes %d)\n",
                         (nfc->ecc) ? "hardware ECC" : "software ECC",
index 6c852ea..2d0e0a2 100644 (file)
@@ -145,10 +145,10 @@ static void jz4725b_bch_read_parity(struct ingenic_ecc *bch, u8 *buf,
        switch (size8) {
        case 3:
                dest8[2] = (val >> 16) & 0xff;
-               /* fall-through */
+               fallthrough;
        case 2:
                dest8[1] = (val >> 8) & 0xff;
-               /* fall-through */
+               fallthrough;
        case 1:
                dest8[0] = val & 0xff;
                break;
index 079266a..d67dbff 100644 (file)
@@ -123,10 +123,10 @@ static void jz4780_bch_read_parity(struct ingenic_ecc *bch, void *buf,
        switch (size8) {
        case 3:
                dest8[2] = (val >> 16) & 0xff;
-               /* fall through */
+               fallthrough;
        case 2:
                dest8[1] = (val >> 8) & 0xff;
-               /* fall through */
+               fallthrough;
        case 1:
                dest8[0] = val & 0xff;
                break;
index 985a15a..c24e5e2 100644 (file)
@@ -5637,8 +5637,7 @@ static int nand_scan_tail(struct nand_chip *chip)
                }
                if (!ecc->read_page)
                        ecc->read_page = nand_read_page_hwecc_oob_first;
-               /* fall through */
-
+               fallthrough;
        case NAND_ECC_HW:
                /* Use standard hwecc read page function? */
                if (!ecc->read_page)
@@ -5657,8 +5656,7 @@ static int nand_scan_tail(struct nand_chip *chip)
                        ecc->read_subpage = nand_read_subpage;
                if (!ecc->write_subpage && ecc->hwctl && ecc->calculate)
                        ecc->write_subpage = nand_write_subpage_hwecc;
-               /* fall through */
-
+               fallthrough;
        case NAND_ECC_HW_SYNDROME:
                if ((!ecc->calculate || !ecc->correct || !ecc->hwctl) &&
                    (!ecc->read_page ||
@@ -5695,8 +5693,7 @@ static int nand_scan_tail(struct nand_chip *chip)
                        ecc->size, mtd->writesize);
                ecc->mode = NAND_ECC_SOFT;
                ecc->algo = NAND_ECC_HAMMING;
-               /* fall through */
-
+               fallthrough;
        case NAND_ECC_SOFT:
                ret = nand_set_ecc_soft_ops(chip);
                if (ret) {
index f2526ec..f91e92e 100644 (file)
@@ -331,8 +331,7 @@ static void nand_command(struct nand_chip *chip, unsigned int command,
                 */
                if (column == -1 && page_addr == -1)
                        return;
-               /* fall through */
-
+               fallthrough;
        default:
                /*
                 * If we don't have access to the busy pin, we apply the given
@@ -483,8 +482,7 @@ static void nand_command_lp(struct nand_chip *chip, unsigned int command,
                                      NAND_NCE | NAND_CLE | NAND_CTRL_CHANGE);
                chip->legacy.cmd_ctrl(chip, NAND_CMD_NONE,
                                      NAND_NCE | NAND_CTRL_CHANGE);
-
-               /* fall through - This applies to read commands */
+               fallthrough;    /* This applies to read commands */
        default:
                /*
                 * If we don't have access to the busy pin, we apply the given
index 9a70754..1de03bb 100644 (file)
@@ -2251,10 +2251,10 @@ static int __init ns_init_module(void)
        switch (bbt) {
        case 2:
                chip->bbt_options |= NAND_BBT_NO_OOB;
-               /* fall through */
+               fallthrough;
        case 1:
                chip->bbt_options |= NAND_BBT_USE_FLASH;
-               /* fall through */
+               fallthrough;
        case 0:
                break;
        default:
index 5502ffb..3fa0e2c 100644 (file)
@@ -455,13 +455,13 @@ static int elm_context_save(struct elm_info *info)
                                        ELM_SYNDROME_FRAGMENT_5 + offset);
                        regs->elm_syndrome_fragment_4[i] = elm_read_reg(info,
                                        ELM_SYNDROME_FRAGMENT_4 + offset);
-                       /* fall through */
+                       fallthrough;
                case BCH8_ECC:
                        regs->elm_syndrome_fragment_3[i] = elm_read_reg(info,
                                        ELM_SYNDROME_FRAGMENT_3 + offset);
                        regs->elm_syndrome_fragment_2[i] = elm_read_reg(info,
                                        ELM_SYNDROME_FRAGMENT_2 + offset);
-                       /* fall through */
+                       fallthrough;
                case BCH4_ECC:
                        regs->elm_syndrome_fragment_1[i] = elm_read_reg(info,
                                        ELM_SYNDROME_FRAGMENT_1 + offset);
@@ -503,13 +503,13 @@ static int elm_context_restore(struct elm_info *info)
                                        regs->elm_syndrome_fragment_5[i]);
                        elm_write_reg(info, ELM_SYNDROME_FRAGMENT_4 + offset,
                                        regs->elm_syndrome_fragment_4[i]);
-                       /* fall through */
+                       fallthrough;
                case BCH8_ECC:
                        elm_write_reg(info, ELM_SYNDROME_FRAGMENT_3 + offset,
                                        regs->elm_syndrome_fragment_3[i]);
                        elm_write_reg(info, ELM_SYNDROME_FRAGMENT_2 + offset,
                                        regs->elm_syndrome_fragment_2[i]);
-                       /* fall through */
+                       fallthrough;
                case BCH4_ECC:
                        elm_write_reg(info, ELM_SYNDROME_FRAGMENT_1 + offset,
                                        regs->elm_syndrome_fragment_1[i]);
index e26a189..ae85e4c 100644 (file)
@@ -354,7 +354,7 @@ static void aspeed_smc_send_cmd_addr(struct spi_nor *nor, u8 cmd, u32 addr)
        default:
                WARN_ONCE(1, "Unexpected address width %u, defaulting to 3\n",
                          nor->addr_width);
-               /* FALLTHROUGH */
+               fallthrough;
        case 3:
                cmdaddr = addr & 0xFFFFFF;
                cmdaddr |= cmd << 24;
index df967f1..f6038d3 100644 (file)
@@ -623,7 +623,6 @@ static u8 spi_nor_smpt_addr_width(const struct spi_nor *nor, const u32 settings)
        case SMPT_CMD_ADDRESS_LEN_4:
                return 4;
        case SMPT_CMD_ADDRESS_LEN_USE_CURRENT:
-               /* fall through */
        default:
                return nor->addr_width;
        }
index ea7440a..ae5abe4 100644 (file)
@@ -1059,7 +1059,7 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai,
                         * be a result of power cut during erasure.
                         */
                        ai->maybe_bad_peb_count += 1;
-               /* fall through */
+               fallthrough;
        case UBI_IO_BAD_HDR:
                        /*
                         * If we're facing a bad VID header we have to drop *all*
index 2f93c25..12c0234 100644 (file)
@@ -1342,10 +1342,10 @@ static int bytes_str_to_int(const char *str)
        switch (*endp) {
        case 'G':
                result *= 1024;
-               /* fall through */
+               fallthrough;
        case 'M':
                result *= 1024;
-               /* fall through */
+               fallthrough;
        case 'K':
                result *= 1024;
                if (endp[1] == 'i' && endp[2] == 'B')