All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: linux-um@lists.infradead.org
Cc: Johannes Berg <johannes.berg@intel.com>
Subject: [PATCH 5/7] um: irq: reduce irq_reg allocation
Date: Mon, 23 Nov 2020 20:56:19 +0100	[thread overview]
Message-ID: <20201123205446.b6bc2722c4d1.I3351860a05d7ec403e2abc5337660c9d9726f095@changeid> (raw)
In-Reply-To: <20201123195621.275470-1-johannes@sipsolutions.net>

From: Johannes Berg <johannes.berg@intel.com>

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>
---
 arch/um/include/shared/irq_user.h |  2 +-
 arch/um/kernel/irq.c              | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/um/include/shared/irq_user.h b/arch/um/include/shared/irq_user.h
index 2dd5fd7d9443..5e975a9e8354 100644
--- a/arch/um/include/shared/irq_user.h
+++ b/arch/um/include/shared/irq_user.h
@@ -12,7 +12,7 @@
 #define IRQ_READ  0
 #define IRQ_WRITE 1
 #define IRQ_NONE 2
-#define MAX_IRQ_TYPE (IRQ_NONE + 1)
+#define NUM_IRQ_TYPES (IRQ_NONE + 1)
 
 struct siginfo;
 extern void sigio_handler(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs);
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) ||
-- 
2.26.2


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


  parent reply	other threads:[~2020-11-23 19:56 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-23 19:56 [PATCH 0/7 um: IRQ handling cleanups Johannes Berg
2020-11-23 19:56 ` [PATCH 1/7] um: support dynamic IRQ allocation Johannes Berg
2020-11-30 11:26   ` Anton Ivanov
2020-11-23 19:56 ` [PATCH 2/7] um: virtio: use " Johannes Berg
2020-11-30 13:45   ` Anton Ivanov
2020-11-23 19:56 ` [PATCH 3/7] um: clean up alarm IRQ chip name Johannes Berg
2020-11-30 13:54   ` Anton Ivanov
2020-11-23 19:56 ` [PATCH 4/7] um: irq: clean up and rename struct irq_fd Johannes Berg
2020-11-30 14:01   ` Anton Ivanov
2020-11-23 19:56 ` Johannes Berg [this message]
2020-11-23 19:56 ` [PATCH 6/7] um: remove IRQ_NONE type Johannes Berg
2020-11-30 14:31   ` Anton Ivanov
2020-11-23 19:56 ` [PATCH 7/7] um: simplify IRQ handling code Johannes Berg
2020-11-24 21:50   ` Anton Ivanov
2020-11-24 21:58     ` Johannes Berg
2020-11-24 22:36       ` Anton Ivanov
2020-11-30 12:00         ` Johannes Berg
2020-11-30 13:40           ` Anton Ivanov
2020-11-30 16:30   ` Anton Ivanov
2020-12-01 20:15     ` Johannes Berg
2020-12-02  9:03       ` Anton Ivanov
2020-12-02 11:29         ` Johannes Berg
2020-12-02 11:31           ` Anton Ivanov
2020-12-02 11:32             ` Johannes Berg
2020-12-02 11:56               ` Anton Ivanov
2020-12-02 11:58                 ` Johannes Berg
2020-12-02 11:43           ` Johannes Berg
2020-12-02 11:49     ` Johannes Berg
2020-12-02 11:54   ` Johannes Berg
2020-12-02 11:58     ` Anton Ivanov
2020-11-24  8:14 ` [PATCH 0/7 um: IRQ handling cleanups Anton Ivanov
2020-11-24  8:55   ` Johannes Berg
2020-11-24  8:58     ` Johannes Berg
2020-11-24  9:06       ` Anton Ivanov
2020-11-24 16:34         ` Anton Ivanov
2020-11-24 16:39           ` Johannes Berg
2020-11-24 16:42             ` Anton Ivanov
2020-11-24 16:45             ` Anton Ivanov
2020-11-24 16:46               ` Johannes Berg
2020-11-24 17:07                 ` Anton Ivanov
2020-11-24 18:32                   ` Johannes Berg
2020-11-24 21:11 ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201123205446.b6bc2722c4d1.I3351860a05d7ec403e2abc5337660c9d9726f095@changeid \
    --to=johannes@sipsolutions.net \
    --cc=johannes.berg@intel.com \
    --cc=linux-um@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.