linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] gpio: menz127: Drop lock field from struct men_z127_gpio
@ 2016-03-09 12:38 Axel Lin
  2016-03-09 12:39 ` [PATCH 2/2] gpio: menz127: Drop *mdev " Axel Lin
  2016-03-22 10:31 ` [PATCH 1/2] gpio: menz127: Drop lock " Linus Walleij
  0 siblings, 2 replies; 6+ messages in thread
From: Axel Lin @ 2016-03-09 12:38 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Andreas Werner, Alexandre Courbot, linux-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.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/gpio/gpio-menz127.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpio-menz127.c b/drivers/gpio/gpio-menz127.c
index a68e199..c5c9599 100644
--- a/drivers/gpio/gpio-menz127.c
+++ b/drivers/gpio/gpio-menz127.c
@@ -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;
 }
-- 
2.1.4




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] gpio: menz127: Drop *mdev field from struct men_z127_gpio
  2016-03-09 12:38 [PATCH 1/2] gpio: menz127: Drop lock field from struct men_z127_gpio Axel Lin
@ 2016-03-09 12:39 ` Axel Lin
  2016-03-22 10:32   ` Linus Walleij
  2016-03-22 10:31 ` [PATCH 1/2] gpio: menz127: Drop lock " Linus Walleij
  1 sibling, 1 reply; 6+ messages in thread
From: Axel Lin @ 2016-03-09 12:39 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Andreas Werner, Alexandre Courbot, linux-gpio

No need to store *medv in struct men_z127_gpio.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/gpio/gpio-menz127.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-menz127.c b/drivers/gpio/gpio-menz127.c
index c5c9599..d979f4b 100644
--- a/drivers/gpio/gpio-menz127.c
+++ b/drivers/gpio/gpio-menz127.c
@@ -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,
-- 
2.1.4




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] gpio: menz127: Drop lock field from struct men_z127_gpio
  2016-03-09 12:38 [PATCH 1/2] gpio: menz127: Drop lock field from struct men_z127_gpio Axel Lin
  2016-03-09 12:39 ` [PATCH 2/2] gpio: menz127: Drop *mdev " Axel Lin
@ 2016-03-22 10:31 ` Linus Walleij
  2016-03-22 10:53   ` Axel Lin
  1 sibling, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2016-03-22 10:31 UTC (permalink / raw)
  To: Axel Lin; +Cc: Andreas Werner, Alexandre Courbot, linux-gpio@vger.kernel.org

On Wed, Mar 9, 2016 at 1:38 PM, Axel Lin <axel.lin@ingics.com> wrote:

> 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.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

Patch applied for the v4.7 cycle. Will not appear in -next until
after -rc1.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] gpio: menz127: Drop *mdev field from struct men_z127_gpio
  2016-03-09 12:39 ` [PATCH 2/2] gpio: menz127: Drop *mdev " Axel Lin
@ 2016-03-22 10:32   ` Linus Walleij
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2016-03-22 10:32 UTC (permalink / raw)
  To: Axel Lin; +Cc: Andreas Werner, Alexandre Courbot, linux-gpio@vger.kernel.org

On Wed, Mar 9, 2016 at 1:39 PM, Axel Lin <axel.lin@ingics.com> wrote:

> No need to store *medv in struct men_z127_gpio.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

Patch applied for v4.7.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] gpio: menz127: Drop lock field from struct men_z127_gpio
  2016-03-22 10:31 ` [PATCH 1/2] gpio: menz127: Drop lock " Linus Walleij
@ 2016-03-22 10:53   ` Axel Lin
  2016-03-22 13:43     ` Linus Walleij
  0 siblings, 1 reply; 6+ messages in thread
From: Axel Lin @ 2016-03-22 10:53 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Andreas Werner, Alexandre Courbot, linux-gpio@vger.kernel.org

2016-03-22 18:31 GMT+08:00 Linus Walleij <linus.walleij@linaro.org>:
> On Wed, Mar 9, 2016 at 1:38 PM, Axel Lin <axel.lin@ingics.com> wrote:
>
>> 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.
>>
>> Signed-off-by: Axel Lin <axel.lin@ingics.com>
>
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] gpio: menz127: Drop lock field from struct men_z127_gpio
  2016-03-22 10:53   ` Axel Lin
@ 2016-03-22 13:43     ` Linus Walleij
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2016-03-22 13:43 UTC (permalink / raw)
  To: Axel Lin; +Cc: Andreas Werner, Alexandre Courbot, linux-gpio@vger.kernel.org

On Tue, Mar 22, 2016 at 11:53 AM, Axel Lin <axel.lin@ingics.com> wrote:
> 2016-03-22 18:31 GMT+08:00 Linus Walleij <linus.walleij@linaro.org>:
>> On Wed, Mar 9, 2016 at 1:38 PM, Axel Lin <axel.lin@ingics.com> wrote:
>>
>>> 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.
>>>
>>> Signed-off-by: Axel Lin <axel.lin@ingics.com>
>>
>> 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: stable@vger.kernel.org
please, then I know immediately what to do with it :)

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-03-22 13:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-09 12:38 [PATCH 1/2] gpio: menz127: Drop lock field from struct men_z127_gpio Axel Lin
2016-03-09 12:39 ` [PATCH 2/2] gpio: menz127: Drop *mdev " Axel Lin
2016-03-22 10:32   ` Linus Walleij
2016-03-22 10:31 ` [PATCH 1/2] gpio: menz127: Drop lock " Linus Walleij
2016-03-22 10:53   ` Axel Lin
2016-03-22 13:43     ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).