diff mbox series

[-next,006/491] ARM/RISCPC ARCHITECTURE: Use fallthrough;

Message ID fb956ff22b89ac7a7f97489b29ecf13a32de8d06.1583896348.git.joe@perches.com (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Joe Perches March 11, 2020, 4:51 a.m. UTC
Convert the various uses of fallthrough comments to fallthrough;

Done via script
Link: https://lore.kernel.org/lkml/b56602fcf79f849e733e7b521bb0e17895d390fa.1582230379.git.joe.com/

Signed-off-by: Joe Perches <joe@perches.com>
---
 arch/arm/mach-rpc/riscpc.c |  2 +-
 drivers/scsi/arm/fas216.c  | 17 ++++++-----------
 2 files changed, 7 insertions(+), 12 deletions(-)

Comments

Russell King (Oracle) March 12, 2020, 10:11 a.m. UTC | #1
On Tue, Mar 10, 2020 at 09:51:20PM -0700, Joe Perches wrote:
> Convert the various uses of fallthrough comments to fallthrough;

And the point of what on the face of it seems to be useless churn is?

What compilers support this?

I'd check the gcc manual, but debian doesn't provide it.

> 
> Done via script
> Link: https://lore.kernel.org/lkml/b56602fcf79f849e733e7b521bb0e17895d390fa.1582230379.git.joe.com/
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  arch/arm/mach-rpc/riscpc.c |  2 +-
>  drivers/scsi/arm/fas216.c  | 17 ++++++-----------
>  2 files changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/arm/mach-rpc/riscpc.c b/arch/arm/mach-rpc/riscpc.c
> index ea2c842..d23970b 100644
> --- a/arch/arm/mach-rpc/riscpc.c
> +++ b/arch/arm/mach-rpc/riscpc.c
> @@ -46,7 +46,7 @@ static int __init parse_tag_acorn(const struct tag *tag)
>  	switch (tag->u.acorn.vram_pages) {
>  	case 512:
>  		vram_size += PAGE_SIZE * 256;
> -		/* Fall through - ??? */
> +		fallthrough;	/* ??? */
>  	case 256:
>  		vram_size += PAGE_SIZE * 256;
>  	default:
> diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c
> index 6c68c230..bb18be 100644
> --- a/drivers/scsi/arm/fas216.c
> +++ b/drivers/scsi/arm/fas216.c
> @@ -603,8 +603,7 @@ static void fas216_handlesync(FAS216_Info *info, char *msg)
>  		msgqueue_flush(&info->scsi.msgs);
>  		msgqueue_addmsg(&info->scsi.msgs, 1, MESSAGE_REJECT);
>  		info->scsi.phase = PHASE_MSGOUT_EXPECT;
> -		/* fall through */
> -
> +		fallthrough;
>  	case async:
>  		dev->period = info->ifcfg.asyncperiod / 4;
>  		dev->sof    = 0;
> @@ -916,8 +915,7 @@ static void fas216_disconnect_intr(FAS216_Info *info)
>  			fas216_done(info, DID_ABORT);
>  			break;
>  		}
> -		/* else, fall through */
> -
> +		fallthrough;
>  	default:				/* huh?					*/
>  		printk(KERN_ERR "scsi%d.%c: unexpected disconnect in phase %s\n",
>  			info->host->host_no, fas216_target(info), fas216_drv_phase(info));
> @@ -1413,8 +1411,7 @@ static void fas216_busservice_intr(FAS216_Info *info, unsigned int stat, unsigne
>  	case STATE(STAT_STATUS, PHASE_DATAOUT): /* Data Out     -> Status       */
>  	case STATE(STAT_STATUS, PHASE_DATAIN):  /* Data In      -> Status       */
>  		fas216_stoptransfer(info);
> -		/* fall through */
> -
> +		fallthrough;
>  	case STATE(STAT_STATUS, PHASE_SELSTEPS):/* Sel w/ steps -> Status       */
>  	case STATE(STAT_STATUS, PHASE_MSGOUT):  /* Message Out  -> Status       */
>  	case STATE(STAT_STATUS, PHASE_COMMAND): /* Command      -> Status       */
> @@ -1426,8 +1423,7 @@ static void fas216_busservice_intr(FAS216_Info *info, unsigned int stat, unsigne
>  	case STATE(STAT_MESGIN, PHASE_DATAOUT): /* Data Out     -> Message In   */
>  	case STATE(STAT_MESGIN, PHASE_DATAIN):  /* Data In      -> Message In   */
>  		fas216_stoptransfer(info);
> -		/* fall through */
> -
> +		fallthrough;
>  	case STATE(STAT_MESGIN, PHASE_COMMAND):	/* Command	-> Message In	*/
>  	case STATE(STAT_MESGIN, PHASE_SELSTEPS):/* Sel w/ steps -> Message In   */
>  	case STATE(STAT_MESGIN, PHASE_MSGOUT):  /* Message Out  -> Message In   */
> @@ -1581,8 +1577,7 @@ static void fas216_funcdone_intr(FAS216_Info *info, unsigned int stat, unsigned
>  			fas216_message(info);
>  			break;
>  		}
> -		/* else, fall through */
> -
> +		fallthrough;
>  	default:
>  		fas216_log(info, 0, "internal phase %s for function done?"
>  			"  What do I do with this?",
> @@ -1964,7 +1959,7 @@ static void fas216_kick(FAS216_Info *info)
>  	switch (where_from) {
>  	case TYPE_QUEUE:
>  		fas216_allocate_tag(info, SCpnt);
> -		/* fall through */
> +		fallthrough;
>  	case TYPE_OTHER:
>  		fas216_start_command(info, SCpnt);
>  		break;
> -- 
> 2.24.0
> 
>
Joe Perches March 12, 2020, 10:19 a.m. UTC | #2
On Thu, 2020-03-12 at 10:11 +0000, Russell King - ARM Linux admin wrote:
> On Tue, Mar 10, 2020 at 09:51:20PM -0700, Joe Perches wrote:
> > Convert the various uses of fallthrough comments to fallthrough;
> 
> And the point of what on the face of it seems to be useless churn is?
> 
> What compilers support this?

gcc 7.1, clang 9

clang does not support the /* fallthrough */ comment styles.

clang does support the __attribute__((__fallthrough__))
and the c++17 [[fallthrough]] weirdness.

see:

commit 294f69e662d1 ("compiler_attributes.h: Add 'fallthrough' pseudo
keyword for switch/case use")
diff mbox series

Patch

diff --git a/arch/arm/mach-rpc/riscpc.c b/arch/arm/mach-rpc/riscpc.c
index ea2c842..d23970b 100644
--- a/arch/arm/mach-rpc/riscpc.c
+++ b/arch/arm/mach-rpc/riscpc.c
@@ -46,7 +46,7 @@  static int __init parse_tag_acorn(const struct tag *tag)
 	switch (tag->u.acorn.vram_pages) {
 	case 512:
 		vram_size += PAGE_SIZE * 256;
-		/* Fall through - ??? */
+		fallthrough;	/* ??? */
 	case 256:
 		vram_size += PAGE_SIZE * 256;
 	default:
diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c
index 6c68c230..bb18be 100644
--- a/drivers/scsi/arm/fas216.c
+++ b/drivers/scsi/arm/fas216.c
@@ -603,8 +603,7 @@  static void fas216_handlesync(FAS216_Info *info, char *msg)
 		msgqueue_flush(&info->scsi.msgs);
 		msgqueue_addmsg(&info->scsi.msgs, 1, MESSAGE_REJECT);
 		info->scsi.phase = PHASE_MSGOUT_EXPECT;
-		/* fall through */
-
+		fallthrough;
 	case async:
 		dev->period = info->ifcfg.asyncperiod / 4;
 		dev->sof    = 0;
@@ -916,8 +915,7 @@  static void fas216_disconnect_intr(FAS216_Info *info)
 			fas216_done(info, DID_ABORT);
 			break;
 		}
-		/* else, fall through */
-
+		fallthrough;
 	default:				/* huh?					*/
 		printk(KERN_ERR "scsi%d.%c: unexpected disconnect in phase %s\n",
 			info->host->host_no, fas216_target(info), fas216_drv_phase(info));
@@ -1413,8 +1411,7 @@  static void fas216_busservice_intr(FAS216_Info *info, unsigned int stat, unsigne
 	case STATE(STAT_STATUS, PHASE_DATAOUT): /* Data Out     -> Status       */
 	case STATE(STAT_STATUS, PHASE_DATAIN):  /* Data In      -> Status       */
 		fas216_stoptransfer(info);
-		/* fall through */
-
+		fallthrough;
 	case STATE(STAT_STATUS, PHASE_SELSTEPS):/* Sel w/ steps -> Status       */
 	case STATE(STAT_STATUS, PHASE_MSGOUT):  /* Message Out  -> Status       */
 	case STATE(STAT_STATUS, PHASE_COMMAND): /* Command      -> Status       */
@@ -1426,8 +1423,7 @@  static void fas216_busservice_intr(FAS216_Info *info, unsigned int stat, unsigne
 	case STATE(STAT_MESGIN, PHASE_DATAOUT): /* Data Out     -> Message In   */
 	case STATE(STAT_MESGIN, PHASE_DATAIN):  /* Data In      -> Message In   */
 		fas216_stoptransfer(info);
-		/* fall through */
-
+		fallthrough;
 	case STATE(STAT_MESGIN, PHASE_COMMAND):	/* Command	-> Message In	*/
 	case STATE(STAT_MESGIN, PHASE_SELSTEPS):/* Sel w/ steps -> Message In   */
 	case STATE(STAT_MESGIN, PHASE_MSGOUT):  /* Message Out  -> Message In   */
@@ -1581,8 +1577,7 @@  static void fas216_funcdone_intr(FAS216_Info *info, unsigned int stat, unsigned
 			fas216_message(info);
 			break;
 		}
-		/* else, fall through */
-
+		fallthrough;
 	default:
 		fas216_log(info, 0, "internal phase %s for function done?"
 			"  What do I do with this?",
@@ -1964,7 +1959,7 @@  static void fas216_kick(FAS216_Info *info)
 	switch (where_from) {
 	case TYPE_QUEUE:
 		fas216_allocate_tag(info, SCpnt);
-		/* fall through */
+		fallthrough;
 	case TYPE_OTHER:
 		fas216_start_command(info, SCpnt);
 		break;