2019-09-08 12:47:55

by Adam Zerella

[permalink] [raw]
Subject: [PATCH] iommu/amd: Fix sparse warnings

There was some simple Sparse warnings related to making some
signatures static.

Signed-off-by: Adam Zerella <[email protected]>
---
drivers/iommu/amd_iommu.c | 4 ++--
drivers/iommu/amd_iommu_init.c | 12 ++++++------
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index b607a92791d3..a9e40001720a 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -84,7 +84,7 @@ LIST_HEAD(acpihid_map);
* Domain for untranslated devices - only allocated
* if iommu=pt passed on kernel cmd line.
*/
-const struct iommu_ops amd_iommu_ops;
+static const struct iommu_ops amd_iommu_ops;

static ATOMIC_NOTIFIER_HEAD(ppr_notifier);
int amd_iommu_max_glx_val = -1;
@@ -3201,7 +3201,7 @@ static void amd_iommu_iotlb_range_add(struct iommu_domain *domain,
{
}

-const struct iommu_ops amd_iommu_ops = {
+static const struct iommu_ops amd_iommu_ops = {
.capable = amd_iommu_capable,
.domain_alloc = amd_iommu_domain_alloc,
.domain_free = amd_iommu_domain_free,
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 4413aa67000e..f32627cadfd7 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -3050,7 +3050,7 @@ bool amd_iommu_v2_supported(void)
}
EXPORT_SYMBOL(amd_iommu_v2_supported);

-struct amd_iommu *get_amd_iommu(unsigned int idx)
+static struct amd_iommu *get_amd_iommu(unsigned int idx)
{
unsigned int i = 0;
struct amd_iommu *iommu;
@@ -3069,7 +3069,7 @@ EXPORT_SYMBOL(get_amd_iommu);
*
****************************************************************************/

-u8 amd_iommu_pc_get_max_banks(unsigned int idx)
+static u8 amd_iommu_pc_get_max_banks(unsigned int idx)
{
struct amd_iommu *iommu = get_amd_iommu(idx);

@@ -3080,13 +3080,13 @@ u8 amd_iommu_pc_get_max_banks(unsigned int idx)
}
EXPORT_SYMBOL(amd_iommu_pc_get_max_banks);

-bool amd_iommu_pc_supported(void)
+static bool amd_iommu_pc_supported(void)
{
return amd_iommu_pc_present;
}
EXPORT_SYMBOL(amd_iommu_pc_supported);

-u8 amd_iommu_pc_get_max_counters(unsigned int idx)
+static u8 amd_iommu_pc_get_max_counters(unsigned int idx)
{
struct amd_iommu *iommu = get_amd_iommu(idx);

@@ -3135,7 +3135,7 @@ static int iommu_pc_get_set_reg(struct amd_iommu *iommu, u8 bank, u8 cntr,
return 0;
}

-int amd_iommu_pc_get_reg(struct amd_iommu *iommu, u8 bank, u8 cntr, u8 fxn, u64 *value)
+static int amd_iommu_pc_get_reg(struct amd_iommu *iommu, u8 bank, u8 cntr, u8 fxn, u64 *value)
{
if (!iommu)
return -EINVAL;
@@ -3144,7 +3144,7 @@ int amd_iommu_pc_get_reg(struct amd_iommu *iommu, u8 bank, u8 cntr, u8 fxn, u64
}
EXPORT_SYMBOL(amd_iommu_pc_get_reg);

-int amd_iommu_pc_set_reg(struct amd_iommu *iommu, u8 bank, u8 cntr, u8 fxn, u64 *value)
+static int amd_iommu_pc_set_reg(struct amd_iommu *iommu, u8 bank, u8 cntr, u8 fxn, u64 *value)
{
if (!iommu)
return -EINVAL;
--
2.21.0


2019-09-10 11:59:33

by Joerg Roedel

[permalink] [raw]
Subject: Re: [PATCH] iommu/amd: Fix sparse warnings

On Sat, Sep 07, 2019 at 04:58:12PM +1000, Adam Zerella wrote:
> There was some simple Sparse warnings related to making some
> signatures static.

And unapplied both of your patches as they causes build failures:

arch/x86/events/amd/iommu.o: In function `perf_iommu_read':
iommu.c:(.text+0xba): undefined reference to `amd_iommu_pc_get_reg'
arch/x86/events/amd/iommu.o: In function `perf_iommu_start':
iommu.c:(.text+0x2df): undefined reference to `amd_iommu_pc_set_reg'
iommu.c:(.text+0x324): undefined reference to `amd_iommu_pc_set_reg'
iommu.c:(.text+0x36b): undefined reference to `amd_iommu_pc_set_reg'
iommu.c:(.text+0x3b0): undefined reference to `amd_iommu_pc_set_reg'
iommu.c:(.text+0x424): undefined reference to `amd_iommu_pc_set_reg'
arch/x86/events/amd/iommu.o:iommu.c:(.text+0x4e4): more undefined references to `amd_iommu_pc_set_reg' follow
arch/x86/events/amd/iommu.o: In function `amd_iommu_pc_init':
iommu.c:(.init.text+0xc): undefined reference to `amd_iommu_pc_supported'
iommu.c:(.init.text+0x131): undefined reference to `get_amd_iommu'
iommu.c:(.init.text+0x140): undefined reference to `amd_iommu_pc_get_max_banks'
iommu.c:(.init.text+0x14f): undefined reference to `amd_iommu_pc_get_max_counters'
drivers/char/agp/intel-gtt.o: In function `intel_gmch_probe':
intel-gtt.c:(.text+0x135d): undefined reference to `intel_iommu_gfx_mapped'
drivers/iommu/amd_iommu_init.o: In function `state_next':
amd_iommu_init.c:(.init.text+0x1ace): undefined reference to `amd_iommu_ops'
drivers/iommu/dmar.o: In function `dmar_parse_one_drhd':
dmar.c:(.text+0x125c): undefined reference to `intel_iommu_ops'
drivers/gpu/drm/i915/intel_device_info.o: In function `intel_device_info_runtime_init':
intel_device_info.c:(.text+0xd89): undefined reference to `intel_iommu_gfx_mapped'
drivers/gpu/drm/i915/gem/i915_gem_stolen.o: In function `i915_gem_init_stolen':
i915_gem_stolen.c:(.text+0x33a): undefined reference to `intel_iommu_gfx_mapped'
drivers/gpu/drm/i915/i915_gem_gtt.o: In function `i915_ggtt_probe_hw':
i915_gem_gtt.c:(.text+0x4f61): undefined reference to `intel_iommu_gfx_mapped'
i915_gem_gtt.c:(.text+0x5127): undefined reference to `intel_iommu_gfx_mapped'
i915_gem_gtt.c:(.text+0x52d1): undefined reference to `intel_iommu_gfx_mapped'
drivers/gpu/drm/i915/i915_gem_gtt.o:i915_gem_gtt.c:(.text+0x53b3): more undefined references to `intel_iommu_gfx_mapped' follow

Please compile-test your patches next time.

2019-09-10 18:50:57

by Joerg Roedel

[permalink] [raw]
Subject: Re: [PATCH] iommu/amd: Fix sparse warnings

On Sat, Sep 07, 2019 at 04:58:12PM +1000, Adam Zerella wrote:
> drivers/iommu/amd_iommu.c | 4 ++--
> drivers/iommu/amd_iommu_init.c | 12 ++++++------
> 2 files changed, 8 insertions(+), 8 deletions(-)

Applied, thanks.