irq: convert irq/vector numbers to unsigned

Currently irq and vector numbers are used inconsistently.

    * Sometimes vector or irq ids is used in bit operations, indicating
      that they should be unsigned (which is required by MISRA C).

    * At the same time we use -1 to indicate an unknown irq (in
      common_register_handler()) or unavailable irq (in
      alloc_irq()). Also (irq < 0) or (vector < 0) are used for error
      checking. These indicate that irq or vector ids should be signed.

This patch converts irq and vector numbers to unsigned 32-bit integers, and
replace the previous -1 with IRQ_INVALID or VECTOR_INVALID. The branch
conditions are updated accordingly.

Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Junjie Mao
2018-06-08 20:53:59 +08:00
committed by lijinxia
parent 5e2c83f395
commit 8c4a5987e3
17 changed files with 186 additions and 185 deletions

View File

@@ -22,13 +22,13 @@
void setup_ioapic_irq(void);
int get_ioapic_info(char *str, int str_max_len);
bool irq_is_gsi(int irq);
int irq_gsi_num(void);
int irq_to_pin(int irq);
int pin_to_irq(int pin);
void irq_gsi_mask_unmask(int irq, bool mask);
void ioapic_set_rte(int irq, uint64_t rte);
void ioapic_get_rte(int irq, uint64_t *rte);
bool irq_is_gsi(uint32_t irq);
uint32_t irq_gsi_num(void);
int irq_to_pin(uint32_t irq);
uint32_t pin_to_irq(int pin);
void irq_gsi_mask_unmask(uint32_t irq, bool mask);
void ioapic_set_rte(uint32_t irq, uint64_t rte);
void ioapic_get_rte(uint32_t irq, uint64_t *rte);
extern uint16_t legacy_irq_to_pin[];
extern uint16_t pic_ioapic_pin_map[];