From 0102e4efda76d0721bc744dd80258eb6cfa25fc3 Mon Sep 17 00:00:00 2001 From: Yan Yankovskyi Date: Mon, 23 Mar 2020 18:15:11 +0200 Subject: xen: Use evtchn_type_t as a type for event channels Make event channel functions pass event channel port using evtchn_port_t type. It eliminates signed <-> unsigned conversion. Signed-off-by: Yan Yankovskyi Reviewed-by: Boris Ostrovsky Link: https://lore.kernel.org/r/20200323152343.GA28422@kbp1-lhp-F74019 Signed-off-by: Juergen Gross --- include/xen/events.h | 22 +++++++++++----------- include/xen/interface/event_channel.h | 2 +- include/xen/xenbus.h | 5 +++-- 3 files changed, 15 insertions(+), 14 deletions(-) (limited to 'include/xen') diff --git a/include/xen/events.h b/include/xen/events.h index c0e6a0598397..12b0dcb6a120 100644 --- a/include/xen/events.h +++ b/include/xen/events.h @@ -14,8 +14,8 @@ unsigned xen_evtchn_nr_channels(void); -int bind_evtchn_to_irq(unsigned int evtchn); -int bind_evtchn_to_irqhandler(unsigned int evtchn, +int bind_evtchn_to_irq(evtchn_port_t evtchn); +int bind_evtchn_to_irqhandler(evtchn_port_t evtchn, irq_handler_t handler, unsigned long irqflags, const char *devname, void *dev_id); @@ -31,9 +31,9 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi, const char *devname, void *dev_id); int bind_interdomain_evtchn_to_irq(unsigned int remote_domain, - unsigned int remote_port); + evtchn_port_t remote_port); int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain, - unsigned int remote_port, + evtchn_port_t remote_port, irq_handler_t handler, unsigned long irqflags, const char *devname, @@ -54,15 +54,15 @@ int xen_set_irq_priority(unsigned irq, unsigned priority); /* * Allow extra references to event channels exposed to userspace by evtchn */ -int evtchn_make_refcounted(unsigned int evtchn); -int evtchn_get(unsigned int evtchn); -void evtchn_put(unsigned int evtchn); +int evtchn_make_refcounted(evtchn_port_t evtchn); +int evtchn_get(evtchn_port_t evtchn); +void evtchn_put(evtchn_port_t evtchn); void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector); -void rebind_evtchn_irq(int evtchn, int irq); +void rebind_evtchn_irq(evtchn_port_t evtchn, int irq); int xen_set_affinity_evtchn(struct irq_desc *desc, unsigned int tcpu); -static inline void notify_remote_via_evtchn(int port) +static inline void notify_remote_via_evtchn(evtchn_port_t port) { struct evtchn_send send = { .port = port }; (void)HYPERVISOR_event_channel_op(EVTCHNOP_send, &send); @@ -86,9 +86,9 @@ void xen_poll_irq(int irq); void xen_poll_irq_timeout(int irq, u64 timeout); /* Determine the IRQ which is bound to an event channel */ -unsigned irq_from_evtchn(unsigned int evtchn); +unsigned int irq_from_evtchn(evtchn_port_t evtchn); int irq_from_virq(unsigned int cpu, unsigned int virq); -unsigned int evtchn_from_irq(unsigned irq); +evtchn_port_t evtchn_from_irq(unsigned irq); #ifdef CONFIG_XEN_PVHVM /* Xen HVM evtchn vector callback */ diff --git a/include/xen/interface/event_channel.h b/include/xen/interface/event_channel.h index 45650c9a06d5..cf80e338fbb0 100644 --- a/include/xen/interface/event_channel.h +++ b/include/xen/interface/event_channel.h @@ -220,7 +220,7 @@ struct evtchn_expand_array { #define EVTCHNOP_set_priority 13 struct evtchn_set_priority { /* IN parameters. */ - uint32_t port; + evtchn_port_t port; uint32_t priority; }; diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h index 8c0d1edc121c..5a8315e6d8a6 100644 --- a/include/xen/xenbus.h +++ b/include/xen/xenbus.h @@ -47,6 +47,7 @@ #include #include #include +#include #define XENBUS_MAX_RING_GRANT_ORDER 4 #define XENBUS_MAX_RING_GRANTS (1U << XENBUS_MAX_RING_GRANT_ORDER) @@ -212,8 +213,8 @@ int xenbus_map_ring_valloc(struct xenbus_device *dev, grant_ref_t *gnt_refs, int xenbus_unmap_ring_vfree(struct xenbus_device *dev, void *vaddr); -int xenbus_alloc_evtchn(struct xenbus_device *dev, int *port); -int xenbus_free_evtchn(struct xenbus_device *dev, int port); +int xenbus_alloc_evtchn(struct xenbus_device *dev, evtchn_port_t *port); +int xenbus_free_evtchn(struct xenbus_device *dev, evtchn_port_t port); enum xenbus_state xenbus_read_driver_state(const char *path); -- cgit v1.2.3