Skip to contentSkip to conversation

iommu/of: mark an unused function as __maybe_unused

PATCH In review Randy Dunlap 3 participants 3 messages Feb 9, 2023 – Feb 16, 2023 IOMMU

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu/of: mark an unused function as __maybe_unused

When CONFIG_OF_ADDRESS is not set, there is a build warning/error about an unused function.
Annotate the function to quieten the warning/error.

../drivers/iommu/of_iommu.c:176:29: warning: 'iommu_resv_region_get_type' defined but not used [-Wunused-function]
176 | static enum iommu_resv_type iommu_resv_region_get_type(struct device *dev, struct resource *phys,

      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
Fixes a5bf3cfce8cb ("iommu: Implement of_iommu_get_resv_regions()")
Cc Thierry Reding <[email protected]>
Cc Joerg Roedel <[email protected]>
Cc Will Deacon <[email protected]>
---
 drivers/iommu/of_iommu.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iommu/of_iommu.c +3 -2
diff -- a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
@@ -173,8 +173,9 @@ const struct iommu_ops *of_iommu_configu
 	return ops;
 }
 
-static enum iommu_resv_type iommu_resv_region_get_type(struct device *dev, struct resource *phys,
-						       phys_addr_t start, size_t length)
+static enum iommu_resv_type __maybe_unused iommu_resv_region_get_type(struct device *dev,
+						struct resource *phys,
+						phys_addr_t start, size_t length)
 {
 	phys_addr_t end = start + length - 1;
 
Reviewed-by on v1 1/1
#1 lore raw
Quoted 22 lines · Randy Dunlap

When CONFIG_OF_ADDRESS is not set, there is a build warning/error about an unused function.
Annotate the function to quieten the warning/error.

../drivers/iommu/of_iommu.c:176:29: warning: 'iommu_resv_region_get_type' defined but not used [-Wunused-function]
176 | static enum iommu_resv_type iommu_resv_region_get_type(struct device *dev, struct resource *phys,

      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
Fixes a5bf3cfce8cb ("iommu: Implement of_iommu_get_resv_regions()")
Cc Thierry Reding <[email protected]>
Cc Joerg Roedel <[email protected]>
Cc Will Deacon <[email protected]>
---
 drivers/iommu/of_iommu.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff -- a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c

drivers/iommu/of_iommu.c const struct iommu_ops *of_iommu_configu · line 178

Quoted 8 lines
drivers/iommu/of_iommu.c +3 -2
@@ -173,8 +173,9 @@ const struct iommu_ops *of_iommu_configu
 	return ops;
 }
 
-static enum iommu_resv_type iommu_resv_region_get_type(struct device *dev, struct resource *phys,
-						       phys_addr_t start, size_t length)
+static enum iommu_resv_type __maybe_unused iommu_resv_region_get_type(struct device *dev,
+						struct resource *phys,
+						phys_addr_t start, size_t length)

Maybe this is one of those cases where we should wrap after the return type/attributes to keep this somewhat readable?

Either way:

#2 lore raw
Quoted 6 lines · Thierry Reding

Maybe this is one of those cases where we should wrap after the return type/attributes to keep this somewhat readable?

Either way:

Wrapped it around and applied the patch, thanks.

Regards,

Signature · 10 lines
Jörg Rödel
[email protected]

SUSE Software Solutions Germany GmbH
Frankenstraße 146
90461 Nürnberg
Germany

(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman