Skip to content

Commit fd975a7

Browse files
AxelLinlinusw
authored andcommitted
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: f436bc2 "gpio: add driver for MEN 16Z127 GPIO controller" Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent f55532a commit fd975a7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

drivers/gpio/gpio-menz127.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ struct men_z127_gpio {
3737
void __iomem *reg_base;
3838
struct mcb_device *mdev;
3939
struct resource *mem;
40-
spinlock_t lock;
4140
};
4241

4342
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,
6968
debounce /= 50;
7069
}
7170

72-
spin_lock(&priv->lock);
71+
spin_lock(&gc->bgpio_lock);
7372

7473
db_en = readl(priv->reg_base + MEN_Z127_DBER);
7574

@@ -84,7 +83,7 @@ static int men_z127_debounce(struct gpio_chip *gc, unsigned gpio,
8483
writel(db_en, priv->reg_base + MEN_Z127_DBER);
8584
writel(db_cnt, priv->reg_base + GPIO_TO_DBCNT_REG(gpio));
8685

87-
spin_unlock(&priv->lock);
86+
spin_unlock(&gc->bgpio_lock);
8887

8988
return 0;
9089
}
@@ -97,7 +96,7 @@ static int men_z127_request(struct gpio_chip *gc, unsigned gpio_pin)
9796
if (gpio_pin >= gc->ngpio)
9897
return -EINVAL;
9998

100-
spin_lock(&priv->lock);
99+
spin_lock(&gc->bgpio_lock);
101100
od_en = readl(priv->reg_base + MEN_Z127_ODER);
102101

103102
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)
106105
od_en &= ~BIT(gpio_pin);
107106

108107
writel(od_en, priv->reg_base + MEN_Z127_ODER);
109-
spin_unlock(&priv->lock);
108+
spin_unlock(&gc->bgpio_lock);
110109

111110
return 0;
112111
}

0 commit comments

Comments
 (0)