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
This commit is contained in:
Justin Hibbits 2017-01-30 02:21:29 +00:00
parent 02f151d412
commit 0624255394
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=312974
2 changed files with 4 additions and 3 deletions

View File

@ -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;

View File

@ -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