Commit e226e3c3 authored by Linus Walleij's avatar Linus Walleij

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

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: default avatarLinus Walleij <linus.walleij@linaro.org>
parent c0162a49
...@@ -39,8 +39,8 @@ struct amd_fch_gpio_priv { ...@@ -39,8 +39,8 @@ struct amd_fch_gpio_priv {
spinlock_t lock; spinlock_t lock;
}; };
static void *amd_fch_gpio_addr(struct amd_fch_gpio_priv *priv, static void __iomem *amd_fch_gpio_addr(struct amd_fch_gpio_priv *priv,
unsigned int gpio) unsigned int gpio)
{ {
return priv->base + priv->pdata->gpio_reg[gpio]*sizeof(u32); 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, ...@@ -50,7 +50,7 @@ static int amd_fch_gpio_direction_input(struct gpio_chip *gc,
{ {
unsigned long flags; unsigned long flags;
struct amd_fch_gpio_priv *priv = gpiochip_get_data(gc); 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); spin_lock_irqsave(&priv->lock, flags);
writel_relaxed(readl_relaxed(ptr) & ~AMD_FCH_GPIO_FLAG_DIRECTION, ptr); 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, ...@@ -64,7 +64,7 @@ static int amd_fch_gpio_direction_output(struct gpio_chip *gc,
{ {
unsigned long flags; unsigned long flags;
struct amd_fch_gpio_priv *priv = gpiochip_get_data(gc); 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); spin_lock_irqsave(&priv->lock, flags);
writel_relaxed(readl_relaxed(ptr) | AMD_FCH_GPIO_FLAG_DIRECTION, ptr); 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) ...@@ -78,7 +78,7 @@ static int amd_fch_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio)
int ret; int ret;
unsigned long flags; unsigned long flags;
struct amd_fch_gpio_priv *priv = gpiochip_get_data(gc); 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); spin_lock_irqsave(&priv->lock, flags);
ret = (readl_relaxed(ptr) & AMD_FCH_GPIO_FLAG_DIRECTION); ret = (readl_relaxed(ptr) & AMD_FCH_GPIO_FLAG_DIRECTION);
...@@ -92,7 +92,7 @@ static void amd_fch_gpio_set(struct gpio_chip *gc, ...@@ -92,7 +92,7 @@ static void amd_fch_gpio_set(struct gpio_chip *gc,
{ {
unsigned long flags; unsigned long flags;
struct amd_fch_gpio_priv *priv = gpiochip_get_data(gc); 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; u32 mask;
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->lock, flags);
...@@ -113,7 +113,7 @@ static int amd_fch_gpio_get(struct gpio_chip *gc, ...@@ -113,7 +113,7 @@ static int amd_fch_gpio_get(struct gpio_chip *gc,
unsigned long flags; unsigned long flags;
int ret; int ret;
struct amd_fch_gpio_priv *priv = gpiochip_get_data(gc); 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); spin_lock_irqsave(&priv->lock, flags);
ret = (readl_relaxed(ptr) & AMD_FCH_GPIO_FLAG_READ); ret = (readl_relaxed(ptr) & AMD_FCH_GPIO_FLAG_READ);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment