dmaengine: Use fallthrough pseudo-keyword
Subsystems (6)
PATCH 1/1 dmaengine: 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.
--- drivers/dma/amba-pl08x.c | 10 +++++----- drivers/dma/fsldma.c | 2 +- drivers/dma/imx-dma.c | 2 +- drivers/dma/iop-adma.h | 12 ++++++------ drivers/dma/nbpfaxi.c | 2 +- drivers/dma/pl330.c | 10 +++------- drivers/dma/sh/shdma-base.c | 2 +- 7 files changed, 18 insertions(+), 22 deletions(-)
drivers/dma/amba-pl08x.c +5 -5
@@ -1767,7 +1767,7 @@ static u32 pl08x_memcpy_cctl(struct pl08x_driver_data *pl08x)default :dev_err (&pl08x->adev->dev,"illegal burst size for memcpy, set to 1\n" ); -/* Fall through */ + fallthrough;case PL08X_BURST_SZ_1 : cctl |=PL080_BSIZE_1 <<PL080_CONTROL_SB_SIZE_SHIFT |PL080_BSIZE_1 <<PL080_CONTROL_DB_SIZE_SHIFT ;
@@ -1806,7 +1806,7 @@ static u32 pl08x_memcpy_cctl(struct pl08x_driver_data *pl08x)default :dev_err (&pl08x->adev->dev,"illegal bus width for memcpy, set to 8 bits\n" ); -/* Fall through */ + fallthrough;case PL08X_BUS_WIDTH_8_BITS : cctl |=PL080_WIDTH_8BIT <<PL080_CONTROL_SWIDTH_SHIFT |PL080_WIDTH_8BIT <<PL080_CONTROL_DWIDTH_SHIFT ;
@@ -1850,7 +1850,7 @@ static u32 pl08x_ftdmac020_memcpy_cctl(struct pl08x_driver_data *pl08x)default :dev_err (&pl08x->adev->dev,"illegal bus width for memcpy, set to 8 bits\n" ); -/* Fall through */ + fallthrough;case PL08X_BUS_WIDTH_8_BITS : cctl |=PL080_WIDTH_8BIT <<FTDMAC020_LLI_SRC_WIDTH_SHIFT |PL080_WIDTH_8BIT <<FTDMAC020_LLI_DST_WIDTH_SHIFT ;
@@ -2612,7 +2612,7 @@ static int pl08x_of_probe(struct amba_device *adev,switch (val) {default :dev_err (&adev->dev,"illegal burst size for memcpy, set to 1\n" ); -/* Fall through */ + fallthrough;case 1 : pd->memcpy_burst_size =PL08X_BURST_SZ_1 ;break ;
@@ -2647,7 +2647,7 @@ static int pl08x_of_probe(struct amba_device *adev,switch (val) {default :dev_err (&adev->dev,"illegal bus width for memcpy, set to 8 bits\n" ); -/* Fall through */ + fallthrough;case 8 : pd->memcpy_bus_width =PL08X_BUS_WIDTH_8_BITS ;break ;
drivers/dma/fsldma.c +1 -1
@@ -1163,7 +1163,7 @@ static int fsl_dma_chan_probe(struct fsldma_device *fdev,switch (chan->feature &FSL_DMA_IP_MASK ) {case FSL_DMA_IP_85XX : chan->toggle_ext_pause = fsl_chan_toggle_ext_pause; -/* Fall through */ + fallthrough;case FSL_DMA_IP_83XX : chan->toggle_ext_start = fsl_chan_toggle_ext_start; chan->set_src_loop_size = fsl_chan_set_src_loop_size;
drivers/dma/imx-dma.c +1 -1
@@ -556,7 +556,7 @@ static int imxdma_xfer_desc(struct imxdma_desc *d)* We fall-through here intentionally, since a 2D transfer is * similar to MEMCPY just adding the 2D slot configuration. */ -/* Fall through */ + fallthrough;case IMXDMA_DESC_MEMCPY :imx_dmav1_writel (imxdma, d->src,DMA_SAR (imxdmac->channel));imx_dmav1_writel (imxdma, d->dest,DMA_DAR (imxdmac->channel));
drivers/dma/iop-adma.h +6 -6
@@ -496,7 +496,7 @@ iop3xx_desc_init_xor(struct iop3xx_desc_aau *hw_desc, int src_cnt, } hw_desc->src_edc[AAU_EDCR2_IDX ].e_desc_ctrl = edcr; src_cnt =24 ; -/* fall through */ + fallthrough; case 17 ... 24:if (!u_desc_ctrl.field.blk_ctrl) { hw_desc->src_edc[AAU_EDCR2_IDX ].e_desc_ctrl =0 ;
@@ -510,7 +510,7 @@ iop3xx_desc_init_xor(struct iop3xx_desc_aau *hw_desc, int src_cnt, } hw_desc->src_edc[AAU_EDCR1_IDX ].e_desc_ctrl = edcr; src_cnt =16 ; -/* fall through */ + fallthrough; case 9 ... 16:if (!u_desc_ctrl.field.blk_ctrl) u_desc_ctrl.field.blk_ctrl =0x2 ;/* use EDCR0 */
@@ -522,7 +522,7 @@ iop3xx_desc_init_xor(struct iop3xx_desc_aau *hw_desc, int src_cnt, } hw_desc->src_edc[AAU_EDCR0_IDX ].e_desc_ctrl = edcr; src_cnt =8 ; -/* fall through */ + fallthrough; case 2 ... 8: shift =1 ;for (i =0 ; i < src_cnt; i++) {
@@ -602,19 +602,19 @@ iop_desc_init_null_xor(struct iop_adma_desc_slot *desc, int src_cnt, case 25 ... 32: u_desc_ctrl.field.blk_ctrl =0x3 ;/* use EDCR[2:0] */ hw_desc->src_edc[AAU_EDCR2_IDX ].e_desc_ctrl =0 ; -/* fall through */ + fallthrough; case 17 ... 24:if (!u_desc_ctrl.field.blk_ctrl) { hw_desc->src_edc[AAU_EDCR2_IDX ].e_desc_ctrl =0 ; u_desc_ctrl.field.blk_ctrl =0x3 ;/* use EDCR[2:0] */ } hw_desc->src_edc[AAU_EDCR1_IDX ].e_desc_ctrl =0 ; -/* fall through */ + fallthrough; case 9 ... 16:if (!u_desc_ctrl.field.blk_ctrl) u_desc_ctrl.field.blk_ctrl =0x2 ;/* use EDCR0 */ hw_desc->src_edc[AAU_EDCR0_IDX ].e_desc_ctrl =0 ; -/* fall through */ + fallthrough; case 1 ... 8:if (!u_desc_ctrl.field.blk_ctrl && src_cnt >4 ) u_desc_ctrl.field.blk_ctrl =0x1 ;/* use mini-desc */
drivers/dma/nbpfaxi.c +1 -1
@@ -483,7 +483,7 @@ static size_t nbpf_xfer_size(struct nbpf_device *nbpf,default :pr_warn ("%s(): invalid bus width %u\n" , __func__, width); -/* fall through */ + fallthrough;case DMA_SLAVE_BUSWIDTH_1_BYTE : size = burst; }
drivers/dma/pl330.c +3 -7
@@ -1061,16 +1061,16 @@ static bool _start(struct pl330_thread *thrd)if (_state (thrd) ==PL330_STATE_KILLING ) UNTIL(thrd, PL330_STATE_STOPPED) - /* fall through */ + fallthrough;case PL330_STATE_FAULTING :_stop (thrd); -/* fall through */ + fallthrough;case PL330_STATE_KILLING :case PL330_STATE_COMPLETING : UNTIL(thrd, PL330_STATE_STOPPED) - /* fall through */ + fallthrough;case PL330_STATE_STOPPED :return _trigger (thrd);
@@ -1121,7 +1121,6 @@ static u32 _emit_load(unsigned int dry_run, u8 buf[],switch (direction) {case DMA_MEM_TO_MEM : -/* fall through */ case DMA_MEM_TO_DEV : off +=_emit_LD (dry_run, &buf[off], cond);break ;
@@ -1155,7 +1154,6 @@ static inline u32 _emit_store(unsigned int dry_run, u8 buf[],switch (direction) {case DMA_MEM_TO_MEM : -/* fall through */ case DMA_DEV_TO_MEM : off +=_emit_ST (dry_run, &buf[off], cond);break ;
@@ -1216,7 +1214,6 @@ static int _bursts(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[],switch (pxs->desc->rqtype) {case DMA_MEM_TO_DEV : -/* fall through */ case DMA_DEV_TO_MEM : off +=_ldst_peripheral (pl330, dry_run, &buf[off], pxs, cyc, cond);
@@ -1266,7 +1263,6 @@ static int _dregs(struct pl330_dmac *pl330, unsigned int dry_run, u8 buf[],switch (pxs->desc->rqtype) {case DMA_MEM_TO_DEV : -/* fall through */ case DMA_DEV_TO_MEM : off +=_emit_MOV (dry_run, &buf[off],CCR , dregs_ccr); off += _ldst_peripheral(pl330, dry_run, &buf[off], pxs, 1,
drivers/dma/sh/shdma-base.c +1 -1
@@ -383,7 +383,7 @@ static dma_async_tx_callback __ld_cleanup(struct shdma_chan *schan, bool all)switch (desc->mark) {case DESC_COMPLETED : desc->mark =DESC_WAITING ; -/* Fall through */ + fallthrough;case DESC_WAITING :if (head_acked)async_tx_ack (&desc->async_tx);
Signature · 1 line
2.27.0
Vinod Koul
maintainerQuoted 49 lines · Gustavo A. R. Silva
drivers/dma/pl330.c +3
-6@@ -1061,16 +1061,16 @@ static bool _start(struct pl330_thread *thrd)if (_state (thrd) ==PL330_STATE_KILLING ) UNTIL(thrd, PL330_STATE_STOPPED) - /* fall through */ + fallthrough;case PL330_STATE_FAULTING :_stop (thrd); -/* fall through */ + fallthrough;case PL330_STATE_KILLING :case PL330_STATE_COMPLETING : UNTIL(thrd, PL330_STATE_STOPPED) - /* fall through */ + fallthrough;case PL330_STATE_STOPPED :return _trigger (thrd);@@ -1121,7 +1121,6 @@ static u32 _emit_load(unsigned int dry_run, u8 buf[],switch (direction) {case DMA_MEM_TO_MEM : -/* fall through */ case DMA_MEM_TO_DEV : off +=_emit_LD (dry_run, &buf[off], cond);break ;@@ -1155,7 +1154,6 @@ static inline u32 _emit_store(unsigned int dry_run, u8 buf[],switch (direction) {case DMA_MEM_TO_MEM : -/* fall through */ case DMA_DEV_TO_MEM : off +=_emit_ST (dry_run, &buf[off], cond);break ;@@ -1216,7 +1214,6 @@ static int _bursts(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[],switch (pxs->desc->rqtype) {case DMA_MEM_TO_DEV : -/* fall through */ case DMA_DEV_TO_MEM : off +=_ldst_peripheral (pl330, dry_run, &buf[off], pxs, cyc, cond);
drivers/dma/pl330.c static int _dregs(struct pl330_dmac *pl330, unsigned int dry_run, u8 buf[], · line 1269
Quoted 4 lines
drivers/dma/pl330.c +0
-1@@ -1266,7 +1263,6 @@ static int _dregs(struct pl330_dmac *pl330, unsigned int dry_run, u8 buf[],switch (pxs->desc->rqtype) {case DMA_MEM_TO_DEV : -/* fall through */
replacement missed here and above few
Signature · 6 lines
~Vinod _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 52 lines · Vinod Koul
Quoted 50 lines · Gustavo A. R. Silva
drivers/dma/pl330.c +3
-6@@ -1061,16 +1061,16 @@ static bool _start(struct pl330_thread *thrd)if (_state (thrd) ==PL330_STATE_KILLING ) UNTIL(thrd, PL330_STATE_STOPPED) - /* fall through */ + fallthrough;case PL330_STATE_FAULTING :_stop (thrd); -/* fall through */ + fallthrough;case PL330_STATE_KILLING :case PL330_STATE_COMPLETING : UNTIL(thrd, PL330_STATE_STOPPED) - /* fall through */ + fallthrough;case PL330_STATE_STOPPED :return _trigger (thrd);@@ -1121,7 +1121,6 @@ static u32 _emit_load(unsigned int dry_run, u8 buf[],switch (direction) {case DMA_MEM_TO_MEM : -/* fall through */ case DMA_MEM_TO_DEV : off +=_emit_LD (dry_run, &buf[off], cond);break ;@@ -1155,7 +1154,6 @@ static inline u32 _emit_store(unsigned int dry_run, u8 buf[],switch (direction) {case DMA_MEM_TO_MEM : -/* fall through */ case DMA_DEV_TO_MEM : off +=_emit_ST (dry_run, &buf[off], cond);break ;@@ -1216,7 +1214,6 @@ static int _bursts(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[],switch (pxs->desc->rqtype) {case DMA_MEM_TO_DEV : -/* fall through */ case DMA_DEV_TO_MEM : off +=_ldst_peripheral (pl330, dry_run, &buf[off], pxs, cyc, cond);@@ -1266,7 +1263,6 @@ static int _dregs(struct pl330_dmac *pl330, unsigned int dry_run, u8 buf[],
Quoted 6 lines
drivers/dma/pl330.c static int _bursts(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[], · line 1219
Quoted 3 lines
drivers/dma/pl330.c +0
-1switch (pxs->desc->rqtype) {case DMA_MEM_TO_DEV : -/* fall through */ replacement missed here and above few
Its not obvious via most of the documentation, but a case label followed immediately by another case label is the only allowed implicit fall through as it is obvious to the eye that there is no postceding statement.
For example the following is legal:
case FOO:
/* fallthrough */ (or fallthrough;)
case BAR:is converted to:
case FOO:
case BAR:
I would assume the justification is that it is common to have a switch statement where several case statements fall directly through to a single code block and annotating each case label seems like overkill.
switch (vhost->state) {
case IBMVFC_LINK_DEAD:
case IBMVFC_HOST_OFFLINE:
result = DID_NO_CONNECT << 16;
break;
case IBMVFC_NO_CRQ:
case IBMVFC_INITIALIZING:
case IBMVFC_HALTED:
case IBMVFC_LINK_DOWN:
result = DID_REQUEUE << 16;
break;
case IBMVFC_ACTIVE:
result = 0;
break;
}Regards,
Tyrel