gpio: menz127: Drop lock field from struct men_z127_gpio
PATCH 1/2 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.
--- drivers/gpio/gpio-menz127.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/gpio/gpio-menz127.c +4 -5
@@ -37,7 +37,6 @@ struct men_z127_gpio {void __iomem *reg_base;struct mcb_device *mdev;struct resource *mem; -spinlock_t lock; }; 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 ; } -spin_lock (&priv->lock); +spin_lock (&gc->bgpio_lock); db_en =readl (priv->reg_base +MEN_Z127_DBER );
@@ -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_cnt, priv->reg_base +GPIO_TO_DBCNT_REG (gpio)); -spin_unlock (&priv->lock); +spin_unlock (&gc->bgpio_lock);return 0 ; }
@@ -97,7 +96,7 @@ static int men_z127_request(struct gpio_chip *gc, unsigned gpio_pin)if (gpio_pin >= gc->ngpio)return -EINVAL ; -spin_lock (&priv->lock); +spin_lock (&gc->bgpio_lock); od_en =readl (priv->reg_base +MEN_Z127_ODER );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) od_en &= ~BIT (gpio_pin);writel (od_en, priv->reg_base +MEN_Z127_ODER ); -spin_unlock (&priv->lock); +spin_unlock (&gc->bgpio_lock);return 0 ; }
Signature · 1 line
2.1.4
PATCH 2/2 gpio: menz127: Drop *mdev field from struct men_z127_gpio
No need to store *medv in struct men_z127_gpio.
--- drivers/gpio/gpio-menz127.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-menz127.c +1 -3
@@ -35,7 +35,6 @@struct men_z127_gpio {struct gpio_chip gc;void __iomem *reg_base; -struct mcb_device *mdev;struct resource *mem; };
@@ -43,7 +42,7 @@ static int men_z127_debounce(struct gpio_chip *gc, unsigned gpio, unsigned debounce) {struct men_z127_gpio *priv =gpiochip_get_data (gc); -struct device *dev = &priv->mdev->dev; +struct device *dev = gc->parent;unsigned int rnd;u32 db_en, db_cnt;
@@ -135,7 +134,6 @@ static int men_z127_probe(struct mcb_device *mdev, goto err_release; } - men_z127_gpio->mdev = mdev;mcb_set_drvdata (mdev, men_z127_gpio); ret = bgpio_init(&men_z127_gpio->gc, &mdev->dev, 4,
Signature · 1 line
2.1.4
Re: [PATCH 2/2] gpio: menz127: Drop *mdev field from struct men_z127_gpio
Quoted 3 lines · Axel Lin
No need to store *medv in struct
men_z127_gpio.Signed-off-by Axel Lin <[email protected]>
Patch applied for v4.7.
Yours,
Linus Walleij
Quoted 5 lines · Axel Lin
Current code uses a uninitialized spin lock.
bgpio_init()already initialized a spin lock, so let's switch to use&gc->bgpio_lockinstead and remove the lock from structmen_z127_gpio.Signed-off-by Axel Lin <[email protected]>
Patch applied for the v4.7 cycle. Will not appear in -next until after -rc1.
Yours,
Linus Walleij
2016-03-22 18:31 GMT+08:00 Linus Walleij <[email protected]>:
Quoted 10 lines · Axel Lin
Quoted 6 lines
Current code uses a uninitialized spin lock.
bgpio_init()already initialized a spin lock, so let's switch to use&gc->bgpio_lockinstead and remove the lock from structmen_z127_gpio.Signed-off-by Axel Lin <[email protected]>Patch applied for the v4.7 cycle. Will not appear in -next until after -rc1.
Is it fine to use uninitialized spinlock?
If not, this one should be for 4.6.
Regards,
Axel
Quoted 7 lines · Axel Lin
2016-03-22 18:31 GMT+08:00 Linus Walleij <[email protected]>:
Quoted 6 lines · Axel Lin
Quoted 5 lines
Current code uses a uninitialized spin lock.
bgpio_init()already initialized a spin lock, so let's switch to use&gc->bgpio_lockinstead and remove the lock from structmen_z127_gpio.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Axel Lin <[email protected]>Patch applied for the v4.7 cycle. Will not appear in -next until after -rc1.
Is it fine to use uninitialized spinlock?
If not, this one should be for 4.6.
Ah, I see, moving it to fixes, tagging for stable.
When you find stuff like this, put in Cc: [email protected] please, then I know immediately what to do with it :)
Yours,
Linus Walleij