Skip to contentSkip to conversation

iommu/vt-d: Move intel_iommu_ops to header file

PATCH In review Andy Shevchenko 3 participants 4 messages Aug 28, 2020 – Aug 31, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu/vt-d: Move intel_iommu_ops to header file

Compiler is not happy about hidden declaration of intel_iommu_ops.

.../drivers/iommu/intel/iommu.c:414:24: warning: symbol 'intel_iommu_ops' was not declared. Should it be static?

Move declaration to header file to make compiler happy.

---
 drivers/iommu/intel/dmar.c  | 2 --
 include/linux/intel-iommu.h | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/iommu/intel/dmar.c +0 -2
index 93e6345f3414..538ee03a4f4a 100644
@@ -64,8 +64,6 @@ static unsigned long dmar_seq_ids[BITS_TO_LONGS(DMAR_UNITS_SUPPORTED)];
 static int alloc_iommu(struct dmar_drhd_unit *drhd);
 static void free_iommu(struct intel_iommu *iommu);
 
-extern const struct iommu_ops intel_iommu_ops;
-
 static void dmar_register_drhd_unit(struct dmar_drhd_unit *drhd)
 {
 	/*
include/linux/intel-iommu.h +2 -0
index b1ed2f25f7c0..64fa5c56c825 100644
@@ -787,6 +787,8 @@ struct context_entry *iommu_context_addr(struct intel_iommu *iommu, u8 bus,
 					 u8 devfn, int alloc);
 
 #ifdef CONFIG_INTEL_IOMMU
+extern const struct iommu_ops intel_iommu_ops;
+
 extern int iommu_calculate_agaw(struct intel_iommu *iommu);
 extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu);
 extern int dmar_disabled;
Signature · 6 lines
2.28.0

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
#1 lore raw
Quoted 5 lines · Andy Shevchenko

Compiler is not happy about hidden declaration of intel_iommu_ops.

.../drivers/iommu/intel/iommu.c:414:24: warning: symbol 'intel_iommu_ops' was not declared. Should it be static?

Move declaration to header file to make compiler happy.

What about a factoring out a helper that does iommu_device_sysfs_add + iommu_device_set_ops + iommu_device_register and then mark intel_iommu_ops static?
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

#2 lore raw
Quoted 10 lines · Christoph Hellwig
Quoted 5 lines · Andy Shevchenko

Compiler is not happy about hidden declaration of intel_iommu_ops.

.../drivers/iommu/intel/iommu.c:414:24: warning: symbol 'intel_iommu_ops' was not declared. Should it be static?

Move declaration to header file to make compiler happy.

What about a factoring out a helper that does iommu_device_sysfs_add + iommu_device_set_ops + iommu_device_register and then mark intel_iommu_ops static?

I am okay with this proposal, but I think the better if IOMMU folks can answer to this before I'm going to invest time into it.

Signature · 8 lines
With Best Regards,
Andy Shevchenko


_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
maintainer
#3 lore raw

Hi Andy,

Quoted 6 lines · Andy Shevchenko
Quoted 5 lines · Christoph Hellwig
Quoted 4 lines · Andy Shevchenko

Compiler is not happy about hidden declaration of intel_iommu_ops.

.../drivers/iommu/intel/iommu.c:414:24: warning: symbol 'intel_iommu_ops' was not declared. Should it be static?

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Move declaration to header file to make compiler happy.

What about a factoring out a helper that does iommu_device_sysfs_add + iommu_device_set_ops + iommu_device_register and then mark intel_iommu_ops static?

I am okay with this proposal, but I think the better if IOMMU folks can answer to this before I'm going to invest time into it.

Thanks for your patch! I am okay with Christoph's proposal as well.

Best regards,
baolu
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu