Skip to content

Commit be280ea

Browse files
committed
iommu/amd: Fix compile warning in init code
A recent commit introduced these compile warnings: CC drivers/iommu/amd/init.o drivers/iommu/amd/init.c:938:12: error: ‘iommu_init_ga_log’ defined but not used [-Werror=unused-function] 938 | static int iommu_init_ga_log(struct amd_iommu *iommu) | ^~~~~~~~~~~~~~~~~ drivers/iommu/amd/init.c:902:12: error: ‘iommu_ga_log_enable’ defined but not used [-Werror=unused-function] 902 | static int iommu_ga_log_enable(struct amd_iommu *iommu) | ^~~~~~~~~~~~~~~~~~~ The warnings appear because both functions are defined when IRQ remapping is not enabled, but only used when IRQ remapping is enabled. Fix it by only defining the functions when IRQ remapping is enabled. Fixes: c5e1a1e ("iommu/amd: Simplify and Consolidate Virtual APIC (AVIC) Enablement") Signed-off-by: Joerg Roedel <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 432e5df commit be280ea

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

drivers/iommu/amd/init.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -899,9 +899,9 @@ static void free_ga_log(struct amd_iommu *iommu)
899899
#endif
900900
}
901901

902+
#ifdef CONFIG_IRQ_REMAP
902903
static int iommu_ga_log_enable(struct amd_iommu *iommu)
903904
{
904-
#ifdef CONFIG_IRQ_REMAP
905905
u32 status, i;
906906
u64 entry;
907907

@@ -931,13 +931,12 @@ static int iommu_ga_log_enable(struct amd_iommu *iommu)
931931

932932
if (WARN_ON(i >= LOOP_TIMEOUT))
933933
return -EINVAL;
934-
#endif /* CONFIG_IRQ_REMAP */
934+
935935
return 0;
936936
}
937937

938938
static int iommu_init_ga_log(struct amd_iommu *iommu)
939939
{
940-
#ifdef CONFIG_IRQ_REMAP
941940
if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir))
942941
return 0;
943942

@@ -955,10 +954,8 @@ static int iommu_init_ga_log(struct amd_iommu *iommu)
955954
err_out:
956955
free_ga_log(iommu);
957956
return -EINVAL;
958-
#else
959-
return 0;
960-
#endif /* CONFIG_IRQ_REMAP */
961957
}
958+
#endif /* CONFIG_IRQ_REMAP */
962959

963960
static int __init alloc_cwwb_sem(struct amd_iommu *iommu)
964961
{

0 commit comments

Comments
 (0)