git: 373301019f16 - main - xen/intr: remove type argument from xen_intr_alloc_isrc()

From: Roger Pau Monné <royger_at_FreeBSD.org>
Date: Fri, 14 Apr 2023 14:01:03 UTC
The branch main has been updated by royger:

URL: https://cgit.FreeBSD.org/src/commit/?id=373301019f16cbd7be7c92df3f62184e96815b63

commit 373301019f16cbd7be7c92df3f62184e96815b63
Author:     Elliott Mitchell <ehem+freebsd@m5p.com>
AuthorDate: 2021-07-02 15:07:58 +0000
Commit:     Roger Pau Monné <royger@FreeBSD.org>
CommitDate: 2023-04-14 13:58:55 +0000

    xen/intr: remove type argument from xen_intr_alloc_isrc()
    
    This value doesn't need to be set in xen_intr_alloc_isrc().  What is
    needed is simply to ensure the allocated xenisrc won't appear as free,
    even if xi_type is written non-atomically.  Since the type is no longer
    used to indicate free or not, the calling function should take care of
    all non-architecture initialization.
    
    Reviewed by: royger
    Differential Revision: https://reviews.freebsd.org/D31188
---
 sys/x86/xen/xen_intr.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sys/x86/xen/xen_intr.c b/sys/x86/xen/xen_intr.c
index fe4a4b0f4dce..ec5b8b4c6c9b 100644
--- a/sys/x86/xen/xen_intr.c
+++ b/sys/x86/xen/xen_intr.c
@@ -260,7 +260,7 @@ evtchn_cpu_unmask_port(u_int cpu, evtchn_port_t port)
  *          object or NULL.
  */
 static struct xenisrc *
-xen_intr_alloc_isrc(enum evtchn_type type)
+xen_intr_alloc_isrc(void)
 {
 	static int warned;
 	struct xenisrc *isrc;
@@ -279,7 +279,6 @@ xen_intr_alloc_isrc(enum evtchn_type type)
 		KASSERT(isrc->xi_arch.intsrc.is_handlers == 0,
 		    ("Free evtchn still has handlers"));
 
-		isrc->xi_type = type;
 		return (isrc);
 	}
 
@@ -302,7 +301,6 @@ xen_intr_alloc_isrc(enum evtchn_type type)
 	isrc = malloc(sizeof(*isrc), M_XENINTR, M_WAITOK | M_ZERO);
 	isrc->xi_arch.intsrc.is_pic = &xen_intr_pic;
 	isrc->xi_arch.vector = vector;
-	isrc->xi_type = type;
 	error = intr_register_source(&isrc->xi_arch.intsrc);
 	if (error != 0)
 		panic("%s(): failed registering interrupt %u, error=%d\n",
@@ -394,11 +392,12 @@ xen_intr_bind_isrc(struct xenisrc **isrcp, evtchn_port_t local_port,
 	}
 	*port_handlep = NULL;
 
-	isrc = xen_intr_alloc_isrc(type);
+	isrc = xen_intr_alloc_isrc();
 	if (isrc == NULL)
 		return (ENOSPC);
 
 	isrc->xi_cookie = NULL;
+	isrc->xi_type = type;
 	isrc->xi_port = local_port;
 	isrc->xi_close = false;
 	isrc->xi_cpu = 0;