diff mbox series

gpio: amd-fch: Fix type error found by sparse

Message ID 20190301080914.19059-1-linus.walleij@linaro.org
State Accepted
Commit e226e3c33ab0562784a22870858eb5551d780ce7
Headers show
Series gpio: amd-fch: Fix type error found by sparse | expand

Commit Message

Linus Walleij March 1, 2019, 8:09 a.m. UTC
Sparse complains:

gpio-amd-fch.c:45:27: sparse: expected void *
gpio-amd-fch.c:45:27: sparse: got void [noderef] <asn:2> *
gpio-amd-fch.c:45:27: sparse: warning: incorrect type in return
		              expression (different address spaces)
gpio-amd-fch.c:56:9: sparse:  expected void const volatile [noderef]
		              <asn:2> *addr
gpio-amd-fch.c:56:9: sparse:  expected void volatile [noderef] <asn:2> *addr
gpio-amd-fch.c:56:9: sparse:  got void *ptr
gpio-amd-fch.c:56:9: sparse:  warning: incorrect type in argument 1 (different address spaces)

I think it is because void * is returned rather than void __iomem *,
so fix it up.

Cc: Enrico Weigelt <info@metux.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

---
 drivers/gpio/gpio-amd-fch.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

-- 
2.20.1
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-amd-fch.c b/drivers/gpio/gpio-amd-fch.c
index 4fd66444ea33..4c585d4e7e74 100644
--- a/drivers/gpio/gpio-amd-fch.c
+++ b/drivers/gpio/gpio-amd-fch.c
@@ -39,8 +39,8 @@  struct amd_fch_gpio_priv {
 	spinlock_t			lock;
 };
 
-static void *amd_fch_gpio_addr(struct amd_fch_gpio_priv *priv,
-			       unsigned int gpio)
+static void __iomem *amd_fch_gpio_addr(struct amd_fch_gpio_priv *priv,
+				       unsigned int gpio)
 {
 	return priv->base + priv->pdata->gpio_reg[gpio]*sizeof(u32);
 }
@@ -50,7 +50,7 @@  static int amd_fch_gpio_direction_input(struct gpio_chip *gc,
 {
 	unsigned long flags;
 	struct amd_fch_gpio_priv *priv = gpiochip_get_data(gc);
-	void *ptr = amd_fch_gpio_addr(priv, offset);
+	void __iomem *ptr = amd_fch_gpio_addr(priv, offset);
 
 	spin_lock_irqsave(&priv->lock, flags);
 	writel_relaxed(readl_relaxed(ptr) & ~AMD_FCH_GPIO_FLAG_DIRECTION, ptr);
@@ -64,7 +64,7 @@  static int amd_fch_gpio_direction_output(struct gpio_chip *gc,
 {
 	unsigned long flags;
 	struct amd_fch_gpio_priv *priv = gpiochip_get_data(gc);
-	void *ptr = amd_fch_gpio_addr(priv, gpio);
+	void __iomem *ptr = amd_fch_gpio_addr(priv, gpio);
 
 	spin_lock_irqsave(&priv->lock, flags);
 	writel_relaxed(readl_relaxed(ptr) | AMD_FCH_GPIO_FLAG_DIRECTION, ptr);
@@ -78,7 +78,7 @@  static int amd_fch_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio)
 	int ret;
 	unsigned long flags;
 	struct amd_fch_gpio_priv *priv = gpiochip_get_data(gc);
-	void *ptr = amd_fch_gpio_addr(priv, gpio);
+	void __iomem *ptr = amd_fch_gpio_addr(priv, gpio);
 
 	spin_lock_irqsave(&priv->lock, flags);
 	ret = (readl_relaxed(ptr) & AMD_FCH_GPIO_FLAG_DIRECTION);
@@ -92,7 +92,7 @@  static void amd_fch_gpio_set(struct gpio_chip *gc,
 {
 	unsigned long flags;
 	struct amd_fch_gpio_priv *priv = gpiochip_get_data(gc);
-	void *ptr = amd_fch_gpio_addr(priv, gpio);
+	void __iomem *ptr = amd_fch_gpio_addr(priv, gpio);
 	u32 mask;
 
 	spin_lock_irqsave(&priv->lock, flags);
@@ -113,7 +113,7 @@  static int amd_fch_gpio_get(struct gpio_chip *gc,
 	unsigned long flags;
 	int ret;
 	struct amd_fch_gpio_priv *priv = gpiochip_get_data(gc);
-	void *ptr = amd_fch_gpio_addr(priv, offset);
+	void __iomem *ptr = amd_fch_gpio_addr(priv, offset);
 
 	spin_lock_irqsave(&priv->lock, flags);
 	ret = (readl_relaxed(ptr) & AMD_FCH_GPIO_FLAG_READ);