From patchwork Mon Nov 23 19:56:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 1405030 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sipsolutions.net Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=xmd/WvCN; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CfybH6BKBz9sSs for ; Tue, 24 Nov 2020 06:56:43 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ofFf1dacXs7xgAZ0o9IhOfK3NpjRkvT39k6BolixBkE=; b=xmd/WvCN/pYEwZr8daC5BNhAA Ad0XKbHOvnewrAd9qY7qWc67wHO4metfkfUmRA0gwHPriPOMUFgt9JSdtt6eey/uYNtVsh5RfMaf2 MexO7FbnTOqwzFmluHrLKXYIDNKbxMM0Op+9dYgaekvHdQbYu9JSPuV9iWV2IsXYQXm0Xjg6gQj8Y lumBJLQoG8Q9jqLwtpzEskChSmzcaEJ9rFVXf/nj5PSXXwwJMH4eeb2MVBb9NZOkUiZeOSizoROny Qn4SIrZpZwHvaV093VljeoNOgUR3TnGQWwF81kBUiJfFaLCmSiEVrZlPF/TurjDyoci/D3TLTGs75 4vsVkeo8w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1khHx0-0006j0-P1; Mon, 23 Nov 2020 19:56:38 +0000 Received: from s3.sipsolutions.net ([2a01:4f8:191:4433::2] helo=sipsolutions.net) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1khHwu-0006fC-Sz for linux-um@lists.infradead.org; Mon, 23 Nov 2020 19:56:35 +0000 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94) (envelope-from ) id 1khHws-00DNEj-IE; Mon, 23 Nov 2020 20:56:30 +0100 From: Johannes Berg To: linux-um@lists.infradead.org Subject: [PATCH 4/7] um: irq: clean up and rename struct irq_fd Date: Mon, 23 Nov 2020 20:56:18 +0100 Message-Id: <20201123205446.f81b278d54b0.I24e33736cb579395f3005b9500b0b8c111983b03@changeid> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201123195621.275470-1-johannes@sipsolutions.net> References: <20201123195621.275470-1-johannes@sipsolutions.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201123_145633_004431_336A4A4A X-CRM114-Status: GOOD ( 20.80 ) X-Spam-Score: 0.4 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.4 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Johannes Berg Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Johannes Berg This really shouldn't be called "irq_fd" since it doesn't carry an fd. Well, it used to, apparently, but that struct member is unused. Rename it to "irq_reg" since it more accurately reflects a registered interrupt, and remove the unused 'next' and 'fd' members from the struct as well. While at it, also move it to the implementation, it's not used anywhere else, and the header file is shared with the userspace components. Signed-off-by: Johannes Berg Acked-By: Anton Ivanov --- arch/um/include/shared/irq_user.h | 14 ------------- arch/um/kernel/irq.c | 34 ++++++++++++++++++++----------- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/arch/um/include/shared/irq_user.h b/arch/um/include/shared/irq_user.h index 107751dce153..2dd5fd7d9443 100644 --- a/arch/um/include/shared/irq_user.h +++ b/arch/um/include/shared/irq_user.h @@ -9,25 +9,11 @@ #include #include -struct irq_fd { - struct irq_fd *next; - void *id; - int fd; - int type; - int irq; - int events; - bool active; - bool pending; - bool purge; -}; - #define IRQ_READ 0 #define IRQ_WRITE 1 #define IRQ_NONE 2 #define MAX_IRQ_TYPE (IRQ_NONE + 1) - - struct siginfo; extern void sigio_handler(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs); extern void free_irq_by_fd(int fd); diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c index 97ff77c297c8..923a80c9808a 100644 --- a/arch/um/kernel/irq.c +++ b/arch/um/kernel/irq.c @@ -26,14 +26,24 @@ extern void free_irqs(void); /* When epoll triggers we do not know why it did so * we can also have different IRQs for read and write. - * This is why we keep a small irq_fd array for each fd - + * This is why we keep a small irq_reg array for each fd - * one entry per IRQ type */ +struct irq_reg { + void *id; + int type; + int irq; + int events; + bool active; + bool pending; + bool purge; +}; + struct irq_entry { struct irq_entry *next; int fd; - struct irq_fd *irq_array[MAX_IRQ_TYPE + 1]; + struct irq_reg *irq_array[MAX_IRQ_TYPE + 1]; }; static struct irq_entry *active_fds; @@ -41,7 +51,7 @@ static struct irq_entry *active_fds; static DEFINE_SPINLOCK(irq_lock); static DECLARE_BITMAP(irqs_allocated, NR_IRQS); -static void irq_io_loop(struct irq_fd *irq, struct uml_pt_regs *regs) +static void irq_io_loop(struct irq_reg *irq, struct uml_pt_regs *regs) { /* * irq->active guards against reentry @@ -65,7 +75,7 @@ static void irq_io_loop(struct irq_fd *irq, struct uml_pt_regs *regs) void sigio_handler(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs) { struct irq_entry *irq_entry; - struct irq_fd *irq; + struct irq_reg *irq; int n, i, j; @@ -86,7 +96,7 @@ void sigio_handler(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs) } for (i = 0; i < n ; i++) { - /* Epoll back reference is the entry with 3 irq_fd + /* Epoll back reference is the entry with 3 irq_reg * leaves - one for each irq type. */ irq_entry = (struct irq_entry *) @@ -112,7 +122,7 @@ static int assign_epoll_events_to_irq(struct irq_entry *irq_entry) { int i; int events = 0; - struct irq_fd *irq; + struct irq_reg *irq; for (i = 0; i < MAX_IRQ_TYPE ; i++) { irq = irq_entry->irq_array[i]; @@ -131,7 +141,7 @@ static int assign_epoll_events_to_irq(struct irq_entry *irq_entry) static int activate_fd(int irq, int fd, int type, void *dev_id) { - struct irq_fd *new_fd; + struct irq_reg *new_fd; struct irq_entry *irq_entry; int i, err, events; unsigned long flags; @@ -182,13 +192,13 @@ static int activate_fd(int irq, int fd, int type, void *dev_id) /* New entry for this fd */ err = -ENOMEM; - new_fd = kmalloc(sizeof(struct irq_fd), GFP_ATOMIC); + new_fd = kmalloc(sizeof(struct irq_reg), GFP_ATOMIC); if (new_fd == NULL) goto out_unlock; events = os_event_mask(type); - *new_fd = ((struct irq_fd) { + *new_fd = ((struct irq_reg) { .id = dev_id, .irq = irq, .type = type, @@ -273,8 +283,8 @@ static struct irq_entry *get_irq_entry_by_fd(int fd) /* * Walk the IRQ list and dispose of an entry for a specific - * device, fd and number. Note - if sharing an IRQ for read - * and writefor the same FD it will be disposed in either case. + * device and number. Note - if sharing an IRQ for read + * and write for the same FD it will be disposed in either case. * If this behaviour is undesirable use different IRQ ids. */ @@ -289,7 +299,7 @@ static void do_free_by_irq_and_dev( ) { int i; - struct irq_fd *to_free; + struct irq_reg *to_free; for (i = 0; i < MAX_IRQ_TYPE ; i++) { if (irq_entry->irq_array[i] != NULL) {