Commit 9fa29a67 authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva

scsi: imm: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Notice that, in this particular case, I placed all the "Phase N - ..."
comments on the same line as its corresponding switch case. The same
way in which similar comments appear in drivers/scsi/ppa.c. This makes
it possible to place the "fall through" annotations at the bottom of
each switch case, which is what GCC is expecting to find.
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
parent 1f771637
...@@ -796,21 +796,21 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd) ...@@ -796,21 +796,21 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
return 0; return 0;
} }
return 1; /* wait until imm_wakeup claims parport */ return 1; /* wait until imm_wakeup claims parport */
/* Phase 1 - Connected */
case 1: case 1: /* Phase 1 - Connected */
imm_connect(dev, CONNECT_EPP_MAYBE); imm_connect(dev, CONNECT_EPP_MAYBE);
cmd->SCp.phase++; cmd->SCp.phase++;
/* fall through */
/* Phase 2 - We are now talking to the scsi bus */ case 2: /* Phase 2 - We are now talking to the scsi bus */
case 2:
if (!imm_select(dev, scmd_id(cmd))) { if (!imm_select(dev, scmd_id(cmd))) {
imm_fail(dev, DID_NO_CONNECT); imm_fail(dev, DID_NO_CONNECT);
return 0; return 0;
} }
cmd->SCp.phase++; cmd->SCp.phase++;
/* fall through */
/* Phase 3 - Ready to accept a command */ case 3: /* Phase 3 - Ready to accept a command */
case 3:
w_ctr(ppb, 0x0c); w_ctr(ppb, 0x0c);
if (!(r_str(ppb) & 0x80)) if (!(r_str(ppb) & 0x80))
return 1; return 1;
...@@ -818,9 +818,9 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd) ...@@ -818,9 +818,9 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
if (!imm_send_command(cmd)) if (!imm_send_command(cmd))
return 0; return 0;
cmd->SCp.phase++; cmd->SCp.phase++;
/* fall through */
/* Phase 4 - Setup scatter/gather buffers */ case 4: /* Phase 4 - Setup scatter/gather buffers */
case 4:
if (scsi_bufflen(cmd)) { if (scsi_bufflen(cmd)) {
cmd->SCp.buffer = scsi_sglist(cmd); cmd->SCp.buffer = scsi_sglist(cmd);
cmd->SCp.this_residual = cmd->SCp.buffer->length; cmd->SCp.this_residual = cmd->SCp.buffer->length;
...@@ -834,8 +834,9 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd) ...@@ -834,8 +834,9 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
cmd->SCp.phase++; cmd->SCp.phase++;
if (cmd->SCp.this_residual & 0x01) if (cmd->SCp.this_residual & 0x01)
cmd->SCp.this_residual++; cmd->SCp.this_residual++;
/* Phase 5 - Pre-Data transfer stage */ /* fall through */
case 5:
case 5: /* Phase 5 - Pre-Data transfer stage */
/* Spin lock for BUSY */ /* Spin lock for BUSY */
w_ctr(ppb, 0x0c); w_ctr(ppb, 0x0c);
if (!(r_str(ppb) & 0x80)) if (!(r_str(ppb) & 0x80))
...@@ -850,9 +851,9 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd) ...@@ -850,9 +851,9 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
if (imm_negotiate(dev)) if (imm_negotiate(dev))
return 0; return 0;
cmd->SCp.phase++; cmd->SCp.phase++;
/* fall through */
/* Phase 6 - Data transfer stage */ case 6: /* Phase 6 - Data transfer stage */
case 6:
/* Spin lock for BUSY */ /* Spin lock for BUSY */
w_ctr(ppb, 0x0c); w_ctr(ppb, 0x0c);
if (!(r_str(ppb) & 0x80)) if (!(r_str(ppb) & 0x80))
...@@ -866,9 +867,9 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd) ...@@ -866,9 +867,9 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
return 1; return 1;
} }
cmd->SCp.phase++; cmd->SCp.phase++;
/* fall through */
/* Phase 7 - Post data transfer stage */ case 7: /* Phase 7 - Post data transfer stage */
case 7:
if ((dev->dp) && (dev->rd)) { if ((dev->dp) && (dev->rd)) {
if ((dev->mode == IMM_NIBBLE) || (dev->mode == IMM_PS2)) { if ((dev->mode == IMM_NIBBLE) || (dev->mode == IMM_PS2)) {
w_ctr(ppb, 0x4); w_ctr(ppb, 0x4);
...@@ -878,9 +879,9 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd) ...@@ -878,9 +879,9 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
} }
} }
cmd->SCp.phase++; cmd->SCp.phase++;
/* fall through */
/* Phase 8 - Read status/message */ case 8: /* Phase 8 - Read status/message */
case 8:
/* Check for data overrun */ /* Check for data overrun */
if (imm_wait(dev) != (unsigned char) 0xb8) { if (imm_wait(dev) != (unsigned char) 0xb8) {
imm_fail(dev, DID_ERROR); imm_fail(dev, DID_ERROR);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment