Commit fd975a7b authored by Axel Lin's avatar Axel Lin Committed by Linus Walleij

gpio: menz127: Drop lock field from struct men_z127_gpio

Current code uses a uninitialized spin lock.
bgpio_init() already initialized a spin lock, so let's switch to use
&gc->bgpio_lock instead and remove the lock from struct men_z127_gpio.

Fixes: f436bc27 "gpio: add driver for MEN 16Z127 GPIO controller"
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent f55532a0
...@@ -37,7 +37,6 @@ struct men_z127_gpio { ...@@ -37,7 +37,6 @@ struct men_z127_gpio {
void __iomem *reg_base; void __iomem *reg_base;
struct mcb_device *mdev; struct mcb_device *mdev;
struct resource *mem; struct resource *mem;
spinlock_t lock;
}; };
static int men_z127_debounce(struct gpio_chip *gc, unsigned gpio, static int men_z127_debounce(struct gpio_chip *gc, unsigned gpio,
...@@ -69,7 +68,7 @@ static int men_z127_debounce(struct gpio_chip *gc, unsigned gpio, ...@@ -69,7 +68,7 @@ static int men_z127_debounce(struct gpio_chip *gc, unsigned gpio,
debounce /= 50; debounce /= 50;
} }
spin_lock(&priv->lock); spin_lock(&gc->bgpio_lock);
db_en = readl(priv->reg_base + MEN_Z127_DBER); db_en = readl(priv->reg_base + MEN_Z127_DBER);
...@@ -84,7 +83,7 @@ static int men_z127_debounce(struct gpio_chip *gc, unsigned gpio, ...@@ -84,7 +83,7 @@ static int men_z127_debounce(struct gpio_chip *gc, unsigned gpio,
writel(db_en, priv->reg_base + MEN_Z127_DBER); writel(db_en, priv->reg_base + MEN_Z127_DBER);
writel(db_cnt, priv->reg_base + GPIO_TO_DBCNT_REG(gpio)); writel(db_cnt, priv->reg_base + GPIO_TO_DBCNT_REG(gpio));
spin_unlock(&priv->lock); spin_unlock(&gc->bgpio_lock);
return 0; return 0;
} }
...@@ -97,7 +96,7 @@ static int men_z127_request(struct gpio_chip *gc, unsigned gpio_pin) ...@@ -97,7 +96,7 @@ static int men_z127_request(struct gpio_chip *gc, unsigned gpio_pin)
if (gpio_pin >= gc->ngpio) if (gpio_pin >= gc->ngpio)
return -EINVAL; return -EINVAL;
spin_lock(&priv->lock); spin_lock(&gc->bgpio_lock);
od_en = readl(priv->reg_base + MEN_Z127_ODER); od_en = readl(priv->reg_base + MEN_Z127_ODER);
if (gpiochip_line_is_open_drain(gc, gpio_pin)) if (gpiochip_line_is_open_drain(gc, gpio_pin))
...@@ -106,7 +105,7 @@ static int men_z127_request(struct gpio_chip *gc, unsigned gpio_pin) ...@@ -106,7 +105,7 @@ static int men_z127_request(struct gpio_chip *gc, unsigned gpio_pin)
od_en &= ~BIT(gpio_pin); od_en &= ~BIT(gpio_pin);
writel(od_en, priv->reg_base + MEN_Z127_ODER); writel(od_en, priv->reg_base + MEN_Z127_ODER);
spin_unlock(&priv->lock); spin_unlock(&gc->bgpio_lock);
return 0; return 0;
} }
......
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