diff mbox series

[2/4] drm/i915/uncore: cast iomem to avoid sparse warning

Message ID 20230207124026.2105442-2-jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/4] drm/i915/gt: add sparse lock annotation to avoid warnings | expand

Commit Message

Jani Nikula Feb. 7, 2023, 12:40 p.m. UTC
drmm_add_action_or_reset() is unaware of __iomem and the pointer needs
to be a plain void *. Cast __iomem away and back while the pointer goes
through drmm.

drivers/gpu/drm/i915/intel_uncore.c:2463:17: warning: incorrect type in argument 1 (different address spaces)
drivers/gpu/drm/i915/intel_uncore.c:2463:17:    expected void volatile [noderef] __iomem *addr
drivers/gpu/drm/i915/intel_uncore.c:2463:17:    got void *regs
drivers/gpu/drm/i915/intel_uncore.c:2494:16: warning: incorrect type in argument 3 (different address spaces)
drivers/gpu/drm/i915/intel_uncore.c:2494:16:    expected void *data
drivers/gpu/drm/i915/intel_uncore.c:2494:16:    got void [noderef] __iomem *regs

Cc: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_uncore.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Matt Roper Feb. 7, 2023, 7:05 p.m. UTC | #1
On Tue, Feb 07, 2023 at 02:40:24PM +0200, Jani Nikula wrote:
> drmm_add_action_or_reset() is unaware of __iomem and the pointer needs
> to be a plain void *. Cast __iomem away and back while the pointer goes
> through drmm.
> 
> drivers/gpu/drm/i915/intel_uncore.c:2463:17: warning: incorrect type in argument 1 (different address spaces)
> drivers/gpu/drm/i915/intel_uncore.c:2463:17:    expected void volatile [noderef] __iomem *addr
> drivers/gpu/drm/i915/intel_uncore.c:2463:17:    got void *regs
> drivers/gpu/drm/i915/intel_uncore.c:2494:16: warning: incorrect type in argument 3 (different address spaces)
> drivers/gpu/drm/i915/intel_uncore.c:2494:16:    expected void *data
> drivers/gpu/drm/i915/intel_uncore.c:2494:16:    got void [noderef] __iomem *regs
> 
> Cc: Matt Roper <matthew.d.roper@intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Matt Roper <matthew.d.roper@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_uncore.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
> index 8dee9e62a73e..f018da7ebaac 100644
> --- a/drivers/gpu/drm/i915/intel_uncore.c
> +++ b/drivers/gpu/drm/i915/intel_uncore.c
> @@ -2460,7 +2460,7 @@ static int i915_pmic_bus_access_notifier(struct notifier_block *nb,
>  
>  static void uncore_unmap_mmio(struct drm_device *drm, void *regs)
>  {
> -	iounmap(regs);
> +	iounmap((void __iomem *)regs);
>  }
>  
>  int intel_uncore_setup_mmio(struct intel_uncore *uncore, phys_addr_t phys_addr)
> @@ -2491,7 +2491,8 @@ int intel_uncore_setup_mmio(struct intel_uncore *uncore, phys_addr_t phys_addr)
>  		return -EIO;
>  	}
>  
> -	return drmm_add_action_or_reset(&i915->drm, uncore_unmap_mmio, uncore->regs);
> +	return drmm_add_action_or_reset(&i915->drm, uncore_unmap_mmio,
> +					(void __force *)uncore->regs);
>  }
>  
>  void intel_uncore_init_early(struct intel_uncore *uncore,
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
index 8dee9e62a73e..f018da7ebaac 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -2460,7 +2460,7 @@  static int i915_pmic_bus_access_notifier(struct notifier_block *nb,
 
 static void uncore_unmap_mmio(struct drm_device *drm, void *regs)
 {
-	iounmap(regs);
+	iounmap((void __iomem *)regs);
 }
 
 int intel_uncore_setup_mmio(struct intel_uncore *uncore, phys_addr_t phys_addr)
@@ -2491,7 +2491,8 @@  int intel_uncore_setup_mmio(struct intel_uncore *uncore, phys_addr_t phys_addr)
 		return -EIO;
 	}
 
-	return drmm_add_action_or_reset(&i915->drm, uncore_unmap_mmio, uncore->regs);
+	return drmm_add_action_or_reset(&i915->drm, uncore_unmap_mmio,
+					(void __force *)uncore->regs);
 }
 
 void intel_uncore_init_early(struct intel_uncore *uncore,