Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jan 2017 02:21:29 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r312974 - in head/sys: powerpc/powerpc sys
Message-ID:  <201701300221.v0U2LTvM007474@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhibbits
Date: Mon Jan 30 02:21:29 2017
New Revision: 312974
URL: https://svnweb.freebsd.org/changeset/base/312974

Log:
  Add a INTR_TRIG_INVALID, and use it in the powerpc interrupt code.
  
  Summary:
  Clang throws the following warning in powerpc intr_machdep:
  
  /usr/src/sys/powerpc/powerpc/intr_machdep.c:454:15: warning: comparison of
  constant -1 with expression of type 'enum intr_trigger' is always false
  [-Wtautological-constant-out-of-range-compare]
      if (i->trig == -1)
          ~~~~~~~ ^  ~~
  
  This may lead to legitimate problems with aggressive optimizations, if not now
  then in the future.  To avoid this, add a new enum, INTR_TRIG_INVALID, set to
  -1, and use this new enumeration in these checks.
  
  Test Plan: Compile test.
  
  Reviewed By: jhb, kib
  Differential Revision: https://reviews.freebsd.org/D9300

Modified:
  head/sys/powerpc/powerpc/intr_machdep.c
  head/sys/sys/bus.h

Modified: head/sys/powerpc/powerpc/intr_machdep.c
==============================================================================
--- head/sys/powerpc/powerpc/intr_machdep.c	Mon Jan 30 02:15:54 2017	(r312973)
+++ head/sys/powerpc/powerpc/intr_machdep.c	Mon Jan 30 02:21:29 2017	(r312974)
@@ -451,7 +451,7 @@ powerpc_enable_intr(void)
 		if (error)
 			continue;
 
-		if (i->trig == -1)
+		if (i->trig == INTR_TRIGGER_INVALID)
 			PIC_TRANSLATE_CODE(i->pic, i->intline, i->fwcode,
 			    &i->trig, &i->pol);
 		if (i->trig != INTR_TRIGGER_CONFORM ||
@@ -497,7 +497,7 @@ powerpc_setup_intr(const char *name, u_i
 		error = powerpc_map_irq(i);
 
 		if (!error) {
-			if (i->trig == -1)
+			if (i->trig == INTR_TRIGGER_INVALID)
 				PIC_TRANSLATE_CODE(i->pic, i->intline,
 				    i->fwcode, &i->trig, &i->pol);
 	
@@ -545,7 +545,7 @@ powerpc_fw_config_intr(int irq, int sens
 	if (i == NULL)
 		return (ENOMEM);
 
-	i->trig = -1;
+	i->trig = INTR_TRIGGER_INVALID;
 	i->pol = INTR_POLARITY_CONFORM;
 	i->fwcode = sense_code;
 

Modified: head/sys/sys/bus.h
==============================================================================
--- head/sys/sys/bus.h	Mon Jan 30 02:15:54 2017	(r312973)
+++ head/sys/sys/bus.h	Mon Jan 30 02:21:29 2017	(r312974)
@@ -265,6 +265,7 @@ enum intr_type {
 };
 
 enum intr_trigger {
+	INTR_TRIGGER_INVALID = -1,
 	INTR_TRIGGER_CONFORM = 0,
 	INTR_TRIGGER_EDGE = 1,
 	INTR_TRIGGER_LEVEL = 2



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701300221.v0U2LTvM007474>