[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] xen/iommu: smmu: Rework how the SMMU version is detected
From: Julien Grall <jgrall@xxxxxxxxxx> Clang 11 will throw the following error: smmu.c:2284:18: error: cast to smaller integer type 'enum arm_smmu_arch_version' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] smmu->version = (enum arm_smmu_arch_version)of_id->data; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The error can be prevented by introduce static variable for each SMMU version and store a pointer for each of them. Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx> --- Only build tested --- xen/drivers/passthrough/arm/smmu.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c index ed04d85e05e9..4a507d7aff64 100644 --- a/xen/drivers/passthrough/arm/smmu.c +++ b/xen/drivers/passthrough/arm/smmu.c @@ -2249,12 +2249,15 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu) return 0; } +static const enum arm_smmu_arch_version smmu_v1_version = ARM_SMMU_V1; +static const enum arm_smmu_arch_version smmu_v2_version = ARM_SMMU_V2; + static const struct of_device_id arm_smmu_of_match[] = { - { .compatible = "arm,smmu-v1", .data = (void *)ARM_SMMU_V1 }, - { .compatible = "arm,smmu-v2", .data = (void *)ARM_SMMU_V2 }, - { .compatible = "arm,mmu-400", .data = (void *)ARM_SMMU_V1 }, - { .compatible = "arm,mmu-401", .data = (void *)ARM_SMMU_V1 }, - { .compatible = "arm,mmu-500", .data = (void *)ARM_SMMU_V2 }, + { .compatible = "arm,smmu-v1", .data = &smmu_v1_version }, + { .compatible = "arm,smmu-v2", .data = &smmu_v2_version }, + { .compatible = "arm,mmu-400", .data = &smmu_v1_version }, + { .compatible = "arm,mmu-401", .data = &smmu_v1_version }, + { .compatible = "arm,mmu-500", .data = &smmu_v2_version }, { }, }; MODULE_DEVICE_TABLE(of, arm_smmu_of_match); @@ -2281,7 +2284,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) smmu->dev = dev; of_id = of_match_node(arm_smmu_of_match, dev->of_node); - smmu->version = (enum arm_smmu_arch_version)of_id->data; + smmu->version = *(enum arm_smmu_arch_version *)of_id->data; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); smmu->base = devm_ioremap_resource(dev, res); -- 2.17.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |