aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJustin Hibbits <jhibbits@FreeBSD.org>2017-01-30 02:21:29 +0000
committerJustin Hibbits <jhibbits@FreeBSD.org>2017-01-30 02:21:29 +0000
commit0624255394b250006ba568052c25581336bc772c (patch)
treef454fd90b3aac7b1a25e71aeeb23378432666cb9 /sys
parent02f151d4129c60744b9f59666683ba7c664deaf5 (diff)
downloadsrc-0624255394b250006ba568052c25581336bc772c.tar.gz
src-0624255394b250006ba568052c25581336bc772c.zip
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
Notes
Notes: svn path=/head/; revision=312974
Diffstat (limited to 'sys')
-rw-r--r--sys/powerpc/powerpc/intr_machdep.c6
-rw-r--r--sys/sys/bus.h1
2 files changed, 4 insertions, 3 deletions
diff --git a/sys/powerpc/powerpc/intr_machdep.c b/sys/powerpc/powerpc/intr_machdep.c
index 74dc4f548a22..743c8a62b080 100644
--- a/sys/powerpc/powerpc/intr_machdep.c
+++ b/sys/powerpc/powerpc/intr_machdep.c
@@ -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_int irq, driver_filter_t filter,
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 sense_code)
if (i == NULL)
return (ENOMEM);
- i->trig = -1;
+ i->trig = INTR_TRIGGER_INVALID;
i->pol = INTR_POLARITY_CONFORM;
i->fwcode = sense_code;
diff --git a/sys/sys/bus.h b/sys/sys/bus.h
index e9fca9b70cc8..03912978c512 100644
--- a/sys/sys/bus.h
+++ b/sys/sys/bus.h
@@ -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