[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 06/19] xen: Clean up asm-generic/device.h
There's some pretense this header may be used without CONFIG_HAS_DEVICE_TREE, but that's just wishful thinking. Only x86 lacks that option, and it fully overrides this header, typedeffing struct pci_dev to be device_t. Furthermore there's an include for xen/device_tree.h halfway through the header, but that header already includes asm/device.h, creating a cycle. Clean up the header removing ifdef guards, merging the typedef onto the struct definition for device_t and removing the spurious include. The only affected file is aplic.c, in riscv, which is forced now to include device_tree.h directly. Not a functional change. Signed-off-by: Alejandro Vallejo <agarciav@xxxxxxx> --- xen/arch/riscv/aplic.c | 3 ++- xen/include/asm-generic/device.h | 18 ++---------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/xen/arch/riscv/aplic.c b/xen/arch/riscv/aplic.c index caba8f8993..90bf222eeb 100644 --- a/xen/arch/riscv/aplic.c +++ b/xen/arch/riscv/aplic.c @@ -9,12 +9,13 @@ * Copyright (c) 2024-2025 Vates */ +#include <xen/device_tree.h> #include <xen/errno.h> #include <xen/init.h> +#include <xen/lib.h> #include <xen/sections.h> #include <xen/types.h> -#include <asm/device.h> #include <asm/intc.h> static struct intc_info __ro_after_init aplic_info = { diff --git a/xen/include/asm-generic/device.h b/xen/include/asm-generic/device.h index 1acd1ba1d8..d485fb97dc 100644 --- a/xen/include/asm-generic/device.h +++ b/xen/include/asm-generic/device.h @@ -6,9 +6,7 @@ enum device_type { -#ifdef CONFIG_HAS_DEVICE_TREE DEV_DT, -#endif DEV_PCI }; @@ -23,23 +21,15 @@ enum device_class }; /* struct device - The basic device structure */ -struct device +typedef struct device { enum device_type type; -#ifdef CONFIG_HAS_DEVICE_TREE struct dt_device_node *of_node; /* Used by drivers imported from Linux */ -#endif #ifdef CONFIG_HAS_PASSTHROUGH void *iommu; /* IOMMU private data */; struct iommu_fwspec *iommu_fwspec; /* per-device IOMMU instance data */ #endif -}; - -typedef struct device device_t; - -#ifdef CONFIG_HAS_DEVICE_TREE - -#include <xen/device_tree.h> +} device_t; #define dev_is_dt(dev) ((dev)->type == DEV_DT) @@ -87,10 +77,6 @@ struct device_desc { int (*init)(struct dt_device_node *dev, const void *data); }; -#else /* !CONFIG_HAS_DEVICE_TREE */ -#define dev_is_dt(dev) ((void)(dev), false) -#endif /* CONFIG_HAS_DEVICE_TREE */ - #define dev_is_pci(dev) ((dev)->type == DEV_PCI) #ifdef CONFIG_ACPI -- 2.43.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |