iommu/of: mark an unused function as __maybe_unused

Message ID 20230209010359.23831-1-rdunlap@infradead.org
State New
Headers
Series iommu/of: mark an unused function as __maybe_unused |

Commit Message

Randy Dunlap Feb. 9, 2023, 1:03 a.m. UTC
  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()")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Thierry Reding <treding@nvidia.com>
Cc: Joerg Roedel <jroedel@suse.de>
Cc: Will Deacon <will@kernel.org>
Cc: iommu@lists.linux.dev
---
 drivers/iommu/of_iommu.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

Thierry Reding Feb. 9, 2023, 10:45 a.m. UTC | #1
On Wed, Feb 08, 2023 at 05:03:59PM -0800, Randy Dunlap wrote:
> 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()")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Thierry Reding <treding@nvidia.com>
> Cc: Joerg Roedel <jroedel@suse.de>
> Cc: Will Deacon <will@kernel.org>
> Cc: iommu@lists.linux.dev
> ---
>  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
> --- 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)

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

Either way:

Reviewed-by: Thierry Reding <treding@nvidia.com>
  
Joerg Roedel Feb. 16, 2023, 9:19 a.m. UTC | #2
On Thu, Feb 09, 2023 at 11:45:39AM +0100, Thierry Reding wrote:
> Maybe this is one of those cases where we should wrap after the return
> type/attributes to keep this somewhat readable?
> 
> Either way:
> 
> Reviewed-by: Thierry Reding <treding@nvidia.com>

Wrapped it around and applied the patch, thanks.

Regards,
  

Patch

diff -- a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
--- 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;