mtd: Convert fallthrough comments into statements

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
This commit is contained in:
Miquel Raynal 2020-03-25 22:21:15 +01:00
parent 699274b1a1
commit 025a06c110
22 changed files with 45 additions and 60 deletions

View 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. */ /* Someone else might have been playing with it. */
return -EAGAIN; return -EAGAIN;
} }
/* Fall through */ fallthrough;
case FL_READY: case FL_READY:
case FL_CFI_QUERY: case FL_CFI_QUERY:
case FL_JEDEC_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... */ /* Only if there's no operation suspended... */
if (mode == FL_READY && chip->oldstate == FL_READY) if (mode == FL_READY && chip->oldstate == FL_READY)
return 0; return 0;
/* Fall through */ fallthrough;
default: default:
sleep: sleep:
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);

View 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... */ /* Only if there's no operation suspended... */
if (mode == FL_READY && chip->oldstate == FL_READY) if (mode == FL_READY && chip->oldstate == FL_READY)
return 0; return 0;
/* fall through */ fallthrough;
default: default:
sleep: sleep:
set_current_state(TASK_UNINTERRUPTIBLE); 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 * as the whole point is that nobody can do anything
* with the chip now anyway. * with the chip now anyway.
*/ */
/* fall through */ fallthrough;
case FL_SYNCING: case FL_SYNCING:
mutex_unlock(&chip->mutex); mutex_unlock(&chip->mutex);
break; break;

View File

@ -324,8 +324,7 @@ static inline int do_read_onechip(struct map_info *map, struct flchip *chip, lof
case FL_JEDEC_QUERY: case FL_JEDEC_QUERY:
map_write(map, CMD(0x70), cmd_addr); map_write(map, CMD(0x70), cmd_addr);
chip->state = FL_STATUS; chip->state = FL_STATUS;
/* Fall through */ fallthrough;
case FL_STATUS: case FL_STATUS:
status = map_read(map, cmd_addr); status = map_read(map, cmd_addr);
if (map_word_andequal(map, status, status_OK, status_OK)) { 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 #ifdef DEBUG_CFI_FEATURES
printk("%s: 1 status[%x]\n", __func__, map_read(map, cmd_adr)); printk("%s: 1 status[%x]\n", __func__, map_read(map, cmd_adr));
#endif #endif
/* Fall through */ fallthrough;
case FL_STATUS: case FL_STATUS:
status = map_read(map, cmd_adr); status = map_read(map, cmd_adr);
if (map_word_andequal(map, status, status_OK, status_OK)) if (map_word_andequal(map, status, status_OK, status_OK))
@ -756,8 +754,7 @@ retry:
case FL_READY: case FL_READY:
map_write(map, CMD(0x70), adr); map_write(map, CMD(0x70), adr);
chip->state = FL_STATUS; chip->state = FL_STATUS;
/* Fall through */ fallthrough;
case FL_STATUS: case FL_STATUS:
status = map_read(map, adr); status = map_read(map, adr);
if (map_word_andequal(map, status, status_OK, status_OK)) 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 * as the whole point is that nobody can do anything
* with the chip now anyway. * with the chip now anyway.
*/ */
/* Fall through */ fallthrough;
case FL_SYNCING: case FL_SYNCING:
mutex_unlock(&chip->mutex); mutex_unlock(&chip->mutex);
break; break;
@ -1054,8 +1051,7 @@ retry:
case FL_READY: case FL_READY:
map_write(map, CMD(0x70), adr); map_write(map, CMD(0x70), adr);
chip->state = FL_STATUS; chip->state = FL_STATUS;
/* Fall through */ fallthrough;
case FL_STATUS: case FL_STATUS:
status = map_read(map, adr); status = map_read(map, adr);
if (map_word_andequal(map, status, status_OK, status_OK)) if (map_word_andequal(map, status, status_OK, status_OK))
@ -1201,8 +1197,7 @@ retry:
case FL_READY: case FL_READY:
map_write(map, CMD(0x70), adr); map_write(map, CMD(0x70), adr);
chip->state = FL_STATUS; chip->state = FL_STATUS;
/* Fall through */ fallthrough;
case FL_STATUS: case FL_STATUS:
status = map_read(map, adr); status = map_read(map, adr);
if (map_word_andequal(map, status, status_OK, status_OK)) if (map_word_andequal(map, status, status_OK, status_OK))

View File

@ -109,13 +109,13 @@ map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cfi_private *cfi
case 8: case 8:
onecmd |= (onecmd << (chip_mode * 32)); onecmd |= (onecmd << (chip_mode * 32));
#endif #endif
/* fall through */ fallthrough;
case 4: case 4:
onecmd |= (onecmd << (chip_mode * 16)); onecmd |= (onecmd << (chip_mode * 16));
/* fall through */ fallthrough;
case 2: case 2:
onecmd |= (onecmd << (chip_mode * 8)); onecmd |= (onecmd << (chip_mode * 8));
/* fall through */ fallthrough;
case 1: case 1:
; ;
} }
@ -165,13 +165,13 @@ unsigned long cfi_merge_status(map_word val, struct map_info *map,
case 8: case 8:
res |= (onestat >> (chip_mode * 32)); res |= (onestat >> (chip_mode * 32));
#endif #endif
/* fall through */ fallthrough;
case 4: case 4:
res |= (onestat >> (chip_mode * 16)); res |= (onestat >> (chip_mode * 16));
/* fall through */ fallthrough;
case 2: case 2:
res |= (onestat >> (chip_mode * 8)); res |= (onestat >> (chip_mode * 8));
/* fall through */ fallthrough;
case 1: case 1:
; ;
} }

View File

@ -329,10 +329,10 @@ static int ustrtoul(const char *cp, char **endp, unsigned int base)
switch (**endp) { switch (**endp) {
case 'G' : case 'G' :
result *= 1024; result *= 1024;
/* fall through */ fallthrough;
case 'M': case 'M':
result *= 1024; result *= 1024;
/* fall through */ fallthrough;
case 'K': case 'K':
case 'k': case 'k':
result *= 1024; result *= 1024;

View File

@ -148,10 +148,10 @@ static int parse_num64(uint64_t *num64, char *token)
switch (token[len - 2]) { switch (token[len - 2]) {
case 'G': case 'G':
shift += 10; shift += 10;
/* fall through */ fallthrough;
case 'M': case 'M':
shift += 10; shift += 10;
/* fall through */ fallthrough;
case 'k': case 'k':
shift += 10; shift += 10;
token[len - 2] = 0; token[len - 2] = 0;

View 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... */ /* Only if there's no operation suspended... */
if (mode == FL_READY && chip->oldstate == FL_READY) if (mode == FL_READY && chip->oldstate == FL_READY)
return 0; return 0;
/* fall through */ fallthrough;
default: default:
sleep: sleep:
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);

View File

@ -81,8 +81,7 @@ static int sa1100_probe_subdev(struct sa_subdev_info *subdev, struct resource *r
default: default:
printk(KERN_WARNING "SA1100 flash: unknown base address " printk(KERN_WARNING "SA1100 flash: unknown base address "
"0x%08lx, assuming CS0\n", phys); "0x%08lx, assuming CS0\n", phys);
/* Fall through */ fallthrough;
case SA1100_CS0_PHYS: case SA1100_CS0_PHYS:
subdev->map.bankwidth = (MSC0 & MSC_RBW) ? 2 : 4; subdev->map.bankwidth = (MSC0 & MSC_RBW) ? 2 : 4;
break; break;

View File

@ -3259,7 +3259,7 @@ static void onenand_check_features(struct mtd_info *mtd)
switch (density) { switch (density) {
case ONENAND_DEVICE_DENSITY_8Gb: case ONENAND_DEVICE_DENSITY_8Gb:
this->options |= ONENAND_HAS_NOP_1; this->options |= ONENAND_HAS_NOP_1;
/* fall through */ fallthrough;
case ONENAND_DEVICE_DENSITY_4Gb: case ONENAND_DEVICE_DENSITY_4Gb:
if (ONENAND_IS_DDP(this)) if (ONENAND_IS_DDP(this))
this->options |= ONENAND_HAS_2PLANE; this->options |= ONENAND_HAS_2PLANE;

View File

@ -1482,7 +1482,7 @@ static int __init doc_probe(unsigned long physadr)
break; break;
case DOC_ChipID_DocMilPlus32: case DOC_ChipID_DocMilPlus32:
pr_err("DiskOnChip Millennium Plus 32MB is not supported, ignoring.\n"); pr_err("DiskOnChip Millennium Plus 32MB is not supported, ignoring.\n");
/* fall through */ fallthrough;
default: default:
ret = -ENODEV; ret = -ENODEV;
goto notfound; goto notfound;

View 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. */ /* READ0 and READ1 read the entire buffer to use hardware ECC. */
case NAND_CMD_READ1: case NAND_CMD_READ1:
column += 256; column += 256;
fallthrough;
/* fall-through */
case NAND_CMD_READ0: case NAND_CMD_READ0:
dev_dbg(priv->dev, dev_dbg(priv->dev,
"fsl_elbc_cmdfunc: NAND_CMD_READ0, page_addr:" "fsl_elbc_cmdfunc: NAND_CMD_READ0, page_addr:"

View File

@ -253,7 +253,7 @@ static int ingenic_nand_attach_chip(struct nand_chip *chip)
chip->ecc.hwctl = ingenic_nand_ecc_hwctl; chip->ecc.hwctl = ingenic_nand_ecc_hwctl;
chip->ecc.calculate = ingenic_nand_ecc_calculate; chip->ecc.calculate = ingenic_nand_ecc_calculate;
chip->ecc.correct = ingenic_nand_ecc_correct; chip->ecc.correct = ingenic_nand_ecc_correct;
/* fall through */ fallthrough;
case NAND_ECC_SOFT: case NAND_ECC_SOFT:
dev_info(nfc->dev, "using %s (strength %d, size %d, bytes %d)\n", dev_info(nfc->dev, "using %s (strength %d, size %d, bytes %d)\n",
(nfc->ecc) ? "hardware ECC" : "software ECC", (nfc->ecc) ? "hardware ECC" : "software ECC",

View File

@ -145,10 +145,10 @@ static void jz4725b_bch_read_parity(struct ingenic_ecc *bch, u8 *buf,
switch (size8) { switch (size8) {
case 3: case 3:
dest8[2] = (val >> 16) & 0xff; dest8[2] = (val >> 16) & 0xff;
/* fall-through */ fallthrough;
case 2: case 2:
dest8[1] = (val >> 8) & 0xff; dest8[1] = (val >> 8) & 0xff;
/* fall-through */ fallthrough;
case 1: case 1:
dest8[0] = val & 0xff; dest8[0] = val & 0xff;
break; break;

View File

@ -123,10 +123,10 @@ static void jz4780_bch_read_parity(struct ingenic_ecc *bch, void *buf,
switch (size8) { switch (size8) {
case 3: case 3:
dest8[2] = (val >> 16) & 0xff; dest8[2] = (val >> 16) & 0xff;
/* fall through */ fallthrough;
case 2: case 2:
dest8[1] = (val >> 8) & 0xff; dest8[1] = (val >> 8) & 0xff;
/* fall through */ fallthrough;
case 1: case 1:
dest8[0] = val & 0xff; dest8[0] = val & 0xff;
break; break;

View File

@ -5637,8 +5637,7 @@ static int nand_scan_tail(struct nand_chip *chip)
} }
if (!ecc->read_page) if (!ecc->read_page)
ecc->read_page = nand_read_page_hwecc_oob_first; ecc->read_page = nand_read_page_hwecc_oob_first;
/* fall through */ fallthrough;
case NAND_ECC_HW: case NAND_ECC_HW:
/* Use standard hwecc read page function? */ /* Use standard hwecc read page function? */
if (!ecc->read_page) if (!ecc->read_page)
@ -5657,8 +5656,7 @@ static int nand_scan_tail(struct nand_chip *chip)
ecc->read_subpage = nand_read_subpage; ecc->read_subpage = nand_read_subpage;
if (!ecc->write_subpage && ecc->hwctl && ecc->calculate) if (!ecc->write_subpage && ecc->hwctl && ecc->calculate)
ecc->write_subpage = nand_write_subpage_hwecc; ecc->write_subpage = nand_write_subpage_hwecc;
/* fall through */ fallthrough;
case NAND_ECC_HW_SYNDROME: case NAND_ECC_HW_SYNDROME:
if ((!ecc->calculate || !ecc->correct || !ecc->hwctl) && if ((!ecc->calculate || !ecc->correct || !ecc->hwctl) &&
(!ecc->read_page || (!ecc->read_page ||
@ -5695,8 +5693,7 @@ static int nand_scan_tail(struct nand_chip *chip)
ecc->size, mtd->writesize); ecc->size, mtd->writesize);
ecc->mode = NAND_ECC_SOFT; ecc->mode = NAND_ECC_SOFT;
ecc->algo = NAND_ECC_HAMMING; ecc->algo = NAND_ECC_HAMMING;
/* fall through */ fallthrough;
case NAND_ECC_SOFT: case NAND_ECC_SOFT:
ret = nand_set_ecc_soft_ops(chip); ret = nand_set_ecc_soft_ops(chip);
if (ret) { if (ret) {

View File

@ -331,8 +331,7 @@ static void nand_command(struct nand_chip *chip, unsigned int command,
*/ */
if (column == -1 && page_addr == -1) if (column == -1 && page_addr == -1)
return; return;
/* fall through */ fallthrough;
default: default:
/* /*
* If we don't have access to the busy pin, we apply the given * 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); NAND_NCE | NAND_CLE | NAND_CTRL_CHANGE);
chip->legacy.cmd_ctrl(chip, NAND_CMD_NONE, chip->legacy.cmd_ctrl(chip, NAND_CMD_NONE,
NAND_NCE | NAND_CTRL_CHANGE); NAND_NCE | NAND_CTRL_CHANGE);
fallthrough; /* This applies to read commands */
/* fall through - This applies to read commands */
default: default:
/* /*
* If we don't have access to the busy pin, we apply the given * If we don't have access to the busy pin, we apply the given

View File

@ -2251,10 +2251,10 @@ static int __init ns_init_module(void)
switch (bbt) { switch (bbt) {
case 2: case 2:
chip->bbt_options |= NAND_BBT_NO_OOB; chip->bbt_options |= NAND_BBT_NO_OOB;
/* fall through */ fallthrough;
case 1: case 1:
chip->bbt_options |= NAND_BBT_USE_FLASH; chip->bbt_options |= NAND_BBT_USE_FLASH;
/* fall through */ fallthrough;
case 0: case 0:
break; break;
default: default:

View File

@ -455,13 +455,13 @@ static int elm_context_save(struct elm_info *info)
ELM_SYNDROME_FRAGMENT_5 + offset); ELM_SYNDROME_FRAGMENT_5 + offset);
regs->elm_syndrome_fragment_4[i] = elm_read_reg(info, regs->elm_syndrome_fragment_4[i] = elm_read_reg(info,
ELM_SYNDROME_FRAGMENT_4 + offset); ELM_SYNDROME_FRAGMENT_4 + offset);
/* fall through */ fallthrough;
case BCH8_ECC: case BCH8_ECC:
regs->elm_syndrome_fragment_3[i] = elm_read_reg(info, regs->elm_syndrome_fragment_3[i] = elm_read_reg(info,
ELM_SYNDROME_FRAGMENT_3 + offset); ELM_SYNDROME_FRAGMENT_3 + offset);
regs->elm_syndrome_fragment_2[i] = elm_read_reg(info, regs->elm_syndrome_fragment_2[i] = elm_read_reg(info,
ELM_SYNDROME_FRAGMENT_2 + offset); ELM_SYNDROME_FRAGMENT_2 + offset);
/* fall through */ fallthrough;
case BCH4_ECC: case BCH4_ECC:
regs->elm_syndrome_fragment_1[i] = elm_read_reg(info, regs->elm_syndrome_fragment_1[i] = elm_read_reg(info,
ELM_SYNDROME_FRAGMENT_1 + offset); ELM_SYNDROME_FRAGMENT_1 + offset);
@ -503,13 +503,13 @@ static int elm_context_restore(struct elm_info *info)
regs->elm_syndrome_fragment_5[i]); regs->elm_syndrome_fragment_5[i]);
elm_write_reg(info, ELM_SYNDROME_FRAGMENT_4 + offset, elm_write_reg(info, ELM_SYNDROME_FRAGMENT_4 + offset,
regs->elm_syndrome_fragment_4[i]); regs->elm_syndrome_fragment_4[i]);
/* fall through */ fallthrough;
case BCH8_ECC: case BCH8_ECC:
elm_write_reg(info, ELM_SYNDROME_FRAGMENT_3 + offset, elm_write_reg(info, ELM_SYNDROME_FRAGMENT_3 + offset,
regs->elm_syndrome_fragment_3[i]); regs->elm_syndrome_fragment_3[i]);
elm_write_reg(info, ELM_SYNDROME_FRAGMENT_2 + offset, elm_write_reg(info, ELM_SYNDROME_FRAGMENT_2 + offset,
regs->elm_syndrome_fragment_2[i]); regs->elm_syndrome_fragment_2[i]);
/* fall through */ fallthrough;
case BCH4_ECC: case BCH4_ECC:
elm_write_reg(info, ELM_SYNDROME_FRAGMENT_1 + offset, elm_write_reg(info, ELM_SYNDROME_FRAGMENT_1 + offset,
regs->elm_syndrome_fragment_1[i]); regs->elm_syndrome_fragment_1[i]);

View File

@ -354,7 +354,7 @@ static void aspeed_smc_send_cmd_addr(struct spi_nor *nor, u8 cmd, u32 addr)
default: default:
WARN_ONCE(1, "Unexpected address width %u, defaulting to 3\n", WARN_ONCE(1, "Unexpected address width %u, defaulting to 3\n",
nor->addr_width); nor->addr_width);
/* FALLTHROUGH */ fallthrough;
case 3: case 3:
cmdaddr = addr & 0xFFFFFF; cmdaddr = addr & 0xFFFFFF;
cmdaddr |= cmd << 24; cmdaddr |= cmd << 24;

View 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: case SMPT_CMD_ADDRESS_LEN_4:
return 4; return 4;
case SMPT_CMD_ADDRESS_LEN_USE_CURRENT: case SMPT_CMD_ADDRESS_LEN_USE_CURRENT:
/* fall through */
default: default:
return nor->addr_width; return nor->addr_width;
} }

View 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. * be a result of power cut during erasure.
*/ */
ai->maybe_bad_peb_count += 1; ai->maybe_bad_peb_count += 1;
/* fall through */ fallthrough;
case UBI_IO_BAD_HDR: case UBI_IO_BAD_HDR:
/* /*
* If we're facing a bad VID header we have to drop *all* * If we're facing a bad VID header we have to drop *all*

View File

@ -1342,10 +1342,10 @@ static int bytes_str_to_int(const char *str)
switch (*endp) { switch (*endp) {
case 'G': case 'G':
result *= 1024; result *= 1024;
/* fall through */ fallthrough;
case 'M': case 'M':
result *= 1024; result *= 1024;
/* fall through */ fallthrough;
case 'K': case 'K':
result *= 1024; result *= 1024;
if (endp[1] == 'i' && endp[2] == 'B') if (endp[1] == 'i' && endp[2] == 'B')