diff options
author | Johannes Berg <johannes.berg@intel.com> | 2020-12-02 12:59:54 +0100 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2020-12-13 22:22:23 +0100 |
commit | 0737402f42d3cdc7b7ef27e8cc7caf1e9ba2a2bc (patch) | |
tree | 980d03d11fec208016c0b3745bf12e06f4efc75a /arch/um/kernel | |
parent | 458e1f7da004ec264cf2a9252822955ba4f7e9a0 (diff) |
um: irq: Reduce irq_reg allocation
We don't need an array of 4 entries to capture three and the
name 'MAX_IRQ_TYPE' really gets confusing as well. Remove it
and add a correct NUM_IRQ_TYPES, and use that correctly.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um/kernel')
-rw-r--r-- | arch/um/kernel/irq.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c index 923a80c9808a..93eb742ecafe 100644 --- a/arch/um/kernel/irq.c +++ b/arch/um/kernel/irq.c @@ -43,7 +43,7 @@ struct irq_reg { struct irq_entry { struct irq_entry *next; int fd; - struct irq_reg *irq_array[MAX_IRQ_TYPE + 1]; + struct irq_reg *irq_array[NUM_IRQ_TYPES]; }; static struct irq_entry *active_fds; @@ -101,7 +101,7 @@ void sigio_handler(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs) */ irq_entry = (struct irq_entry *) os_epoll_get_data_pointer(i); - for (j = 0; j < MAX_IRQ_TYPE ; j++) { + for (j = 0; j < NUM_IRQ_TYPES ; j++) { irq = irq_entry->irq_array[j]; if (irq == NULL) continue; @@ -124,7 +124,7 @@ static int assign_epoll_events_to_irq(struct irq_entry *irq_entry) int events = 0; struct irq_reg *irq; - for (i = 0; i < MAX_IRQ_TYPE ; i++) { + for (i = 0; i < NUM_IRQ_TYPES ; i++) { irq = irq_entry->irq_array[i]; if (irq != NULL) events = irq->events | events; @@ -172,7 +172,7 @@ static int activate_fd(int irq, int fd, int type, void *dev_id) goto out_unlock; } irq_entry->fd = fd; - for (i = 0; i < MAX_IRQ_TYPE; i++) + for (i = 0; i < NUM_IRQ_TYPES; i++) irq_entry->irq_array[i] = NULL; irq_entry->next = active_fds; active_fds = irq_entry; @@ -244,7 +244,7 @@ static void garbage_collect_irq_entries(void) walk = active_fds; while (walk != NULL) { reap = true; - for (i = 0; i < MAX_IRQ_TYPE ; i++) { + for (i = 0; i < NUM_IRQ_TYPES ; i++) { if (walk->irq_array[i] != NULL) { reap = false; break; @@ -301,7 +301,7 @@ static void do_free_by_irq_and_dev( int i; struct irq_reg *to_free; - for (i = 0; i < MAX_IRQ_TYPE ; i++) { + for (i = 0; i < NUM_IRQ_TYPES ; i++) { if (irq_entry->irq_array[i] != NULL) { if ( ((flags & IGNORE_IRQ) || |