Skip to content

Commit 803f6c4

Browse files
joergroedelmehmetb0
authored andcommitted
iommu/amd: Fix compile warning in init code
BugLink: https://bugs.launchpad.net/bugs/2080378 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] (backported from commit be280ea) [ghadi-rahme: Had to adjust the context due to missing commits] Signed-off-by: Ghadi Elie Rahme <[email protected]> Acked-by: Guoqing Jiang <[email protected]> Acked-by: Ivan Hu <[email protected]> Signed-off-by: Roxana Nicolescu <[email protected]>
1 parent 36e6afc commit 803f6c4

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
@@ -816,9 +816,9 @@ static void free_ga_log(struct amd_iommu *iommu)
816816
#endif
817817
}
818818

819+
#ifdef CONFIG_IRQ_REMAP
819820
static int iommu_ga_log_enable(struct amd_iommu *iommu)
820821
{
821-
#ifdef CONFIG_IRQ_REMAP
822822
u32 status, i;
823823
u64 entry;
824824

@@ -848,13 +848,12 @@ static int iommu_ga_log_enable(struct amd_iommu *iommu)
848848

849849
if (WARN_ON(i >= LOOP_TIMEOUT))
850850
return -EINVAL;
851-
#endif /* CONFIG_IRQ_REMAP */
851+
852852
return 0;
853853
}
854854

855855
static int iommu_init_ga_log(struct amd_iommu *iommu)
856856
{
857-
#ifdef CONFIG_IRQ_REMAP
858857
if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir))
859858
return 0;
860859

@@ -872,10 +871,8 @@ static int iommu_init_ga_log(struct amd_iommu *iommu)
872871
err_out:
873872
free_ga_log(iommu);
874873
return -EINVAL;
875-
#else
876-
return 0;
877-
#endif /* CONFIG_IRQ_REMAP */
878874
}
875+
#endif /* CONFIG_IRQ_REMAP */
879876

880877
static int __init alloc_cwwb_sem(struct amd_iommu *iommu)
881878
{

0 commit comments

Comments
 (0)