linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: linux-kernel@vger.kernel.org
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Subject: [PATCH 16/41] scsi: imm: mark expected switch fall-throughs
Date: Tue, 27 Nov 2018 22:29:48 -0600	[thread overview]
Message-ID: <42e3f9f751b662b7f0e4e763aa880bd752511c60.1543374820.git.gustavo@embeddedor.com> (raw)
In-Reply-To: <cover.1543374820.git.gustavo@embeddedor.com>

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.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/scsi/imm.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c
index 8c6627bc8a39..629e0bc70d3e 100644
--- a/drivers/scsi/imm.c
+++ b/drivers/scsi/imm.c
@@ -796,21 +796,21 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
 			return 0;
 		}
 		return 1;	/* wait until imm_wakeup claims parport */
-		/* Phase 1 - Connected */
-	case 1:
+
+	case 1:		/* Phase 1 - Connected */
 		imm_connect(dev, CONNECT_EPP_MAYBE);
 		cmd->SCp.phase++;
+		/* fall through */
 
-		/* Phase 2 - We are now talking to the scsi bus */
-	case 2:
+	case 2:		/* Phase 2 - We are now talking to the scsi bus */
 		if (!imm_select(dev, scmd_id(cmd))) {
 			imm_fail(dev, DID_NO_CONNECT);
 			return 0;
 		}
 		cmd->SCp.phase++;
+		/* fall through */
 
-		/* Phase 3 - Ready to accept a command */
-	case 3:
+	case 3:		/* Phase 3 - Ready to accept a command */
 		w_ctr(ppb, 0x0c);
 		if (!(r_str(ppb) & 0x80))
 			return 1;
@@ -818,9 +818,9 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
 		if (!imm_send_command(cmd))
 			return 0;
 		cmd->SCp.phase++;
+		/* fall through */
 
-		/* Phase 4 - Setup scatter/gather buffers */
-	case 4:
+	case 4:		/* Phase 4 - Setup scatter/gather buffers */
 		if (scsi_bufflen(cmd)) {
 			cmd->SCp.buffer = scsi_sglist(cmd);
 			cmd->SCp.this_residual = cmd->SCp.buffer->length;
@@ -834,8 +834,9 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
 		cmd->SCp.phase++;
 		if (cmd->SCp.this_residual & 0x01)
 			cmd->SCp.this_residual++;
-		/* Phase 5 - Pre-Data transfer stage */
-	case 5:
+		/* fall through */
+
+	case 5:		/* Phase 5 - Pre-Data transfer stage */
 		/* Spin lock for BUSY */
 		w_ctr(ppb, 0x0c);
 		if (!(r_str(ppb) & 0x80))
@@ -850,9 +851,9 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
 			if (imm_negotiate(dev))
 				return 0;
 		cmd->SCp.phase++;
+		/* fall through */
 
-		/* Phase 6 - Data transfer stage */
-	case 6:
+	case 6:		/* Phase 6 - Data transfer stage */
 		/* Spin lock for BUSY */
 		w_ctr(ppb, 0x0c);
 		if (!(r_str(ppb) & 0x80))
@@ -866,9 +867,9 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
 				return 1;
 		}
 		cmd->SCp.phase++;
+		/* fall through */
 
-		/* Phase 7 - Post data transfer stage */
-	case 7:
+	case 7:		/* Phase 7 - Post data transfer stage */
 		if ((dev->dp) && (dev->rd)) {
 			if ((dev->mode == IMM_NIBBLE) || (dev->mode == IMM_PS2)) {
 				w_ctr(ppb, 0x4);
@@ -878,9 +879,9 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
 			}
 		}
 		cmd->SCp.phase++;
+		/* fall through */
 
-		/* Phase 8 - Read status/message */
-	case 8:
+	case 8:		/* Phase 8 - Read status/message */
 		/* Check for data overrun */
 		if (imm_wait(dev) != (unsigned char) 0xb8) {
 			imm_fail(dev, DID_ERROR);
-- 
2.17.1


  parent reply	other threads:[~2018-11-28  4:29 UTC|newest]

Thread overview: 138+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28  4:18 [PATCH 00/41] scsi: Mark " Gustavo A. R. Silva
2018-11-28  4:21 ` [PATCH 01/41] scsi: BusLogic: mark expected switch fall-through Gustavo A. R. Silva
2018-12-03 18:33   ` Khalid Aziz
2018-12-08  2:35   ` Martin K. Petersen
2018-11-28  4:24 ` [PATCH 02/41] scsi: NCR5380: Mark " Gustavo A. R. Silva
2018-11-28  8:22   ` Michael Schmitz
2018-11-28 13:47     ` Gustavo A. R. Silva
2018-11-28  4:25 ` [PATCH 03/41] scsi: aacraid: aachba: Mark expected switch fall-throughs Gustavo A. R. Silva
2018-11-28 19:21   ` Dave.Carroll
2018-11-29  2:50   ` Martin K. Petersen
2018-11-28  4:26 ` [PATCH 04/41] scsi: aacraid: linit: Mark expected switch fall-through Gustavo A. R. Silva
2018-11-28 19:24   ` Dave.Carroll
2018-11-29  2:51   ` Martin K. Petersen
2018-11-28  4:26 ` [PATCH 05/41] scsi: aic7xxx: aic79xx: mark " Gustavo A. R. Silva
2018-12-19 15:36   ` Gustavo A. R. Silva
2019-01-10 20:15     ` Gustavo A. R. Silva
2019-01-11  7:42       ` Hannes Reinecke
2019-01-12  2:52         ` Martin K. Petersen
2018-11-28  4:26 ` [PATCH 06/41] scsi: aic7xxx: mark expected switch fall-throughs Gustavo A. R. Silva
2018-12-19 15:37   ` Gustavo A. R. Silva
2019-01-10 20:14     ` Gustavo A. R. Silva
2018-11-28  4:26 ` [PATCH 07/41] scsi: be2iscsi: be_iscsi: Mark expected switch fall-through Gustavo A. R. Silva
2018-12-19 15:37   ` Gustavo A. R. Silva
2019-01-10 20:13     ` Gustavo A. R. Silva
2018-11-28  4:27 ` [PATCH 08/41] scsi: be2iscsi: be_main: " Gustavo A. R. Silva
2018-12-19 15:38   ` Gustavo A. R. Silva
2019-01-10 20:12     ` Gustavo A. R. Silva
2018-11-28  4:27 ` [PATCH 09/41] scsi: bfa: bfa_fcpim: Mark expected switch fall-throughs Gustavo A. R. Silva
2018-12-19 15:38   ` Gustavo A. R. Silva
2019-01-10 20:12     ` Gustavo A. R. Silva
2018-11-28  4:27 ` [PATCH 10/41] scsi: bfa: bfa_fcs_lport: " Gustavo A. R. Silva
2018-12-19 15:39   ` Gustavo A. R. Silva
2019-01-10 20:12     ` Gustavo A. R. Silva
2019-01-11  6:33       ` Sudarsana Reddy Kalluru
2019-01-12  2:48   ` Martin K. Petersen
2018-11-28  4:27 ` [PATCH 11/41] scsi: bfa: bfa_fcs_rport: " Gustavo A. R. Silva
2018-12-19 15:39   ` Gustavo A. R. Silva
2019-01-10 20:12     ` Gustavo A. R. Silva
2019-01-11  6:33       ` Sudarsana Reddy Kalluru
2018-11-28  4:27 ` [PATCH 12/41] scsi: bfa: bfa_ioc: " Gustavo A. R. Silva
2018-12-19 15:39   ` Gustavo A. R. Silva
2019-01-10 20:11     ` Gustavo A. R. Silva
2019-01-11  6:33       ` Sudarsana Reddy Kalluru
2018-11-28  4:28 ` [PATCH 13/41] scsi: csiostor: csio_wr: mark expected switch fall-through Gustavo A. R. Silva
2018-12-19 15:39   ` Gustavo A. R. Silva
2019-01-10 20:10     ` Gustavo A. R. Silva
2018-11-28  4:28 ` [PATCH 14/41] scsi: esas2r: esas2r_init: mark expected switch fall-throughs Gustavo A. R. Silva
2018-12-19 15:39   ` Gustavo A. R. Silva
2019-01-10 20:08     ` Gustavo A. R. Silva
2019-01-10 22:11       ` Grove, Bradley
2019-01-12  2:45   ` Martin K. Petersen
2018-11-28  4:29 ` [PATCH 15/41] scsi: hpsa: " Gustavo A. R. Silva
2018-11-28 15:14   ` Don.Brace
2018-11-29  2:51   ` Martin K. Petersen
2018-11-28  4:29 ` Gustavo A. R. Silva [this message]
2018-12-19 22:26   ` [PATCH 16/41] scsi: imm: " Gustavo A. R. Silva
2019-01-10 20:07   ` Gustavo A. R. Silva
2018-11-28  4:29 ` [PATCH 17/41] scsi: isci: phy: Mark expected switch fall-through Gustavo A. R. Silva
2018-12-19 22:26   ` Gustavo A. R. Silva
2018-11-28  4:30 ` [PATCH 18/41] scsi: isci: remote_device: Mark expected switch fall-throughs Gustavo A. R. Silva
2018-12-19 22:26   ` Gustavo A. R. Silva
2018-11-28  4:30 ` [PATCH 19/41] scsi: isci: remote_node_context: mark " Gustavo A. R. Silva
2018-12-19 22:26   ` Gustavo A. R. Silva
2018-11-28  4:30 ` [PATCH 20/41] scsi: isci: request: mark expected switch fall-through Gustavo A. R. Silva
2018-12-19 22:27   ` Gustavo A. R. Silva
2018-11-28  4:30 ` [PATCH 21/41] scsi: libfc: fc_rport: Mark " Gustavo A. R. Silva
2018-11-28  9:04   ` Johannes Thumshirn
2018-11-29  2:51   ` Martin K. Petersen
2018-11-28  4:31 ` [PATCH 22/41] scsi: lpfc: lpfc_ct: Mark expected switch fall-throughs Gustavo A. R. Silva
2018-12-19 22:27   ` Gustavo A. R. Silva
2019-01-10 20:03   ` Gustavo A. R. Silva
2018-11-28  4:31 ` [PATCH 23/41] scsi: lpfc: lpfc_els: " Gustavo A. R. Silva
2018-12-19 22:27   ` Gustavo A. R. Silva
2019-01-10 20:03   ` Gustavo A. R. Silva
2018-11-28  4:31 ` [PATCH 24/41] scsi: lpfc: lpfc_hbadisc: " Gustavo A. R. Silva
2018-12-19 22:27   ` Gustavo A. R. Silva
2019-01-10 20:03   ` Gustavo A. R. Silva
2018-11-28  4:31 ` [PATCH 25/41] scsi: lpfc: lpfc_nportdisc: Mark expected switch fall-through Gustavo A. R. Silva
2018-12-19 22:27   ` Gustavo A. R. Silva
2018-11-28  4:31 ` [PATCH 26/41] scsi: lpfc: lpfc_nvme: " Gustavo A. R. Silva
2018-12-19 22:27   ` Gustavo A. R. Silva
2019-01-10 20:02   ` Gustavo A. R. Silva
2018-11-28  4:32 ` [PATCH 27/41] scsi: lpfc: lpfc_scsi: Mark expected switch fall-throughs Gustavo A. R. Silva
2018-12-19 22:28   ` Gustavo A. R. Silva
2019-01-10 20:01   ` Gustavo A. R. Silva
2018-11-28  4:32 ` [PATCH 28/41] scsi: lpfc: lpfc_sli: " Gustavo A. R. Silva
2018-12-19 22:28   ` Gustavo A. R. Silva
     [not found]     ` <CAGx+d6e+rCLjFEFCThgQwewod9Ni_wroV0cE_bceTXTFcsbe9A@mail.gmail.com>
2019-01-04  6:06       ` Martin K. Petersen
2018-11-28  4:32 ` [PATCH 29/41] scsi: megaraid: megaraid_sas_base: Mark expected switch fall-through Gustavo A. R. Silva
2018-11-28  6:40   ` Sumit Saxena
2018-11-29  2:51   ` Martin K. Petersen
2018-11-28  4:32 ` [PATCH 30/41] scsi: megaraid_sas_fusion: " Gustavo A. R. Silva
2018-11-28  6:41   ` Sumit Saxena
2018-11-29  2:51   ` Martin K. Petersen
2018-11-28  4:32 ` [PATCH 31/41] scsi: mpt3sas: mpt3sas_scsih: " Gustavo A. R. Silva
2018-12-20  0:07   ` Gustavo A. R. Silva
2018-12-20  4:19     ` Suganath Prabu Subramani
2018-12-20 15:35       ` Gustavo A. R. Silva
2018-11-28  4:32 ` [PATCH 32/41] scsi: myrb: Mark expected switch fall-throughs Gustavo A. R. Silva
2018-12-20  0:07   ` Gustavo A. R. Silva
2018-12-20  6:49     ` Hannes Reinecke
2018-12-21  0:52   ` Martin K. Petersen
2018-11-28  4:32 ` [PATCH 33/41] scsi: osd: osd_initiator: mark " Gustavo A. R. Silva
2018-12-18 17:13   ` Boaz Harrosh
2018-12-18 17:19     ` Gustavo A. R. Silva
2018-12-20  0:07   ` Gustavo A. R. Silva
2019-01-10 19:58     ` Gustavo A. R. Silva
2018-11-28  4:33 ` [PATCH 34/41] scsi: osst: " Gustavo A. R. Silva
2018-12-20  0:07   ` Gustavo A. R. Silva
2019-01-10 19:58     ` Gustavo A. R. Silva
2018-11-28  4:33 ` [PATCH 35/41] scsi: ppa: mark expected switch fall-through Gustavo A. R. Silva
2018-12-20  0:07   ` Gustavo A. R. Silva
2019-01-10 19:57     ` Gustavo A. R. Silva
2018-11-28  4:33 ` [PATCH 36/41] scsi: qla4xxx: ql4_os: " Gustavo A. R. Silva
2018-12-20  0:07   ` Gustavo A. R. Silva
2018-12-24  9:01   ` Nilesh Javali
2019-01-12  2:05     ` Martin K. Petersen
2018-11-28  4:33 ` [PATCH 37/41] scsi: st: mark expected switch fall-throughs Gustavo A. R. Silva
2018-12-20  0:08   ` Gustavo A. R. Silva
2019-01-10 19:56     ` Gustavo A. R. Silva
2018-11-28  4:34 ` [PATCH 38/41] scsi: sym53c8xx_2: sym_hipd: " Gustavo A. R. Silva
2018-12-20  0:08   ` Gustavo A. R. Silva
2019-01-10 19:55     ` Gustavo A. R. Silva
2018-11-28  4:34 ` [PATCH 39/41] scsi: sym53c8xx_2: sym_nvram: Mark expected switch fall-through Gustavo A. R. Silva
2018-12-20  0:08   ` Gustavo A. R. Silva
2019-01-10 19:54     ` Gustavo A. R. Silva
2018-11-28  4:34 ` [PATCH 40/41] scsi: ufs: ufshcd: mark expected switch fall-throughs Gustavo A. R. Silva
2018-11-28  6:15   ` Avri Altman
2018-11-28  4:34 ` [PATCH 41/41] scsi: xen-scsifront: mark expected switch fall-through Gustavo A. R. Silva
2018-11-28  6:03   ` Juergen Gross
2018-11-29  2:52   ` Martin K. Petersen
2018-12-18 15:23 ` [PATCH 00/41] scsi: Mark expected switch fall-throughs Gustavo A. R. Silva
     [not found]   ` <yq1mup2i3h1.fsf@oracle.com>
2018-12-19  3:53     ` Gustavo A. R. Silva
     [not found] ` <ceff1b50e91a4c13b49423b08ec9447b@fmsmsx108.amr.corp.intel.com>
2018-12-20  8:51   ` [PATCH 17/41] scsi: isci: phy: Mark expected switch fall-through Artur Paszkiewicz
2018-12-21  0:56     ` Martin K. Petersen
     [not found] ` <318fe89a188e4783b7d4cf982d365160@fmsmsx105.amr.corp.intel.com>
2018-12-20  8:51   ` [PATCH 20/41] scsi: isci: request: mark " Artur Paszkiewicz
     [not found] ` <fa4237900de64b349b3e8592de364ada@fmsmsx114.amr.corp.intel.com>
2018-12-20  8:51   ` [PATCH 19/41] scsi: isci: remote_node_context: mark expected switch fall-throughs Artur Paszkiewicz
     [not found] ` <5636e6aa6c0c42089949391b04d2529b@fmsmsx155.amr.corp.intel.com>
2018-12-20  8:51   ` [PATCH 18/41] scsi: isci: remote_device: Mark " Artur Paszkiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42e3f9f751b662b7f0e4e763aa880bd752511c60.1543374820.git.gustavo@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --subject='Re: [PATCH 16/41] scsi: imm: mark expected switch fall-throughs' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).