linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] pinctrl: adi2: Convert to devm_ioremap_resource
@ 2013-09-24  7:46 Axel Lin
  2013-09-24  7:47 ` [PATCH 2/2] pinctrl: adi2: Fix dead lock in adi_gpio_direction_output Axel Lin
  2013-09-27 12:19 ` [PATCH 1/2] pinctrl: adi2: Convert to devm_ioremap_resource Linus Walleij
  0 siblings, 2 replies; 5+ messages in thread
From: Axel Lin @ 2013-09-24  7:46 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Sonic Zhang, linux-kernel

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/pinctrl/pinctrl-adi2.c | 38 ++++++--------------------------------
 1 file changed, 6 insertions(+), 32 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-adi2.c b/drivers/pinctrl/pinctrl-adi2.c
index 7a24e59..f2aa877 100644
--- a/drivers/pinctrl/pinctrl-adi2.c
+++ b/drivers/pinctrl/pinctrl-adi2.c
@@ -855,22 +855,9 @@ static int adi_gpio_pint_probe(struct platform_device *pdev)
 	}
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(dev, "Invalid mem resource\n");
-		return -ENODEV;
-	}
-
-	if (!devm_request_mem_region(dev, res->start, resource_size(res),
-				     pdev->name)) {
-		dev_err(dev, "Region already claimed\n");
-		return -EBUSY;
-	}
-
-	pint->base = devm_ioremap(dev, res->start, resource_size(res));
-	if (!pint->base) {
-		dev_err(dev, "Could not ioremap\n");
-		return -ENOMEM;
-	}
+	pint->base = devm_ioremap_resource(dev, res);
+	if (IS_ERR(pint->base))
+		return PTR_ERR(pint->base);
 
 	pint->regs = (struct gpio_pint_regs *)pint->base;
 
@@ -984,22 +971,9 @@ static int adi_gpio_probe(struct platform_device *pdev)
 	}
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(dev, "Invalid mem resource\n");
-		return -ENODEV;
-	}
-
-	if (!devm_request_mem_region(dev, res->start, resource_size(res),
-				     pdev->name)) {
-		dev_err(dev, "Region already claimed\n");
-		return -EBUSY;
-	}
-
-	port->base = devm_ioremap(dev, res->start, resource_size(res));
-	if (!port->base) {
-		dev_err(dev, "Could not ioremap\n");
-		return -ENOMEM;
-	}
+	port->base = devm_ioremap_resource(dev, res);
+	if (IS_ERR(port->base))
+		return PTR_ERR(port->base);
 
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (!res)
-- 
1.8.1.2




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

* [PATCH 2/2] pinctrl: adi2: Fix dead lock in adi_gpio_direction_output
  2013-09-24  7:46 [PATCH 1/2] pinctrl: adi2: Convert to devm_ioremap_resource Axel Lin
@ 2013-09-24  7:47 ` Axel Lin
  2013-09-27 12:20   ` Linus Walleij
  2013-09-27 12:19 ` [PATCH 1/2] pinctrl: adi2: Convert to devm_ioremap_resource Linus Walleij
  1 sibling, 1 reply; 5+ messages in thread
From: Axel Lin @ 2013-09-24  7:47 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Sonic Zhang, linux-kernel

Current code hold port->lock spinlock and then try to grab the lock again
in adi_gpio_set_value(). Fix it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/pinctrl/pinctrl-adi2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-adi2.c b/drivers/pinctrl/pinctrl-adi2.c
index f2aa877..8089fda 100644
--- a/drivers/pinctrl/pinctrl-adi2.c
+++ b/drivers/pinctrl/pinctrl-adi2.c
@@ -776,10 +776,11 @@ static int adi_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
 	struct gpio_port_t *regs = port->regs;
 	unsigned long flags;
 
+	adi_gpio_set_value(chip, offset, value);
+
 	spin_lock_irqsave(&port->lock, flags);
 
 	writew(readw(&regs->inen) & ~(1 << offset), &regs->inen);
-	adi_gpio_set_value(chip, offset, value);
 	writew(1 << offset, &regs->dir_set);
 
 	spin_unlock_irqrestore(&port->lock, flags);
-- 
1.8.1.2




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

* Re: [PATCH 1/2] pinctrl: adi2: Convert to devm_ioremap_resource
  2013-09-24  7:46 [PATCH 1/2] pinctrl: adi2: Convert to devm_ioremap_resource Axel Lin
  2013-09-24  7:47 ` [PATCH 2/2] pinctrl: adi2: Fix dead lock in adi_gpio_direction_output Axel Lin
@ 2013-09-27 12:19 ` Linus Walleij
  1 sibling, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2013-09-27 12:19 UTC (permalink / raw)
  To: Axel Lin; +Cc: Sonic Zhang, linux-kernel@vger.kernel.org

On Tue, Sep 24, 2013 at 9:46 AM, Axel Lin <axel.lin@ingics.com> wrote:

> Signed-off-by: Axel Lin <axel.lin@ingics.com>

Patch applied, thanks Axel.

I should have caught this in review :-(

Yours,
Linus Walleij

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

* Re: [PATCH 2/2] pinctrl: adi2: Fix dead lock in adi_gpio_direction_output
  2013-09-24  7:47 ` [PATCH 2/2] pinctrl: adi2: Fix dead lock in adi_gpio_direction_output Axel Lin
@ 2013-09-27 12:20   ` Linus Walleij
  2013-10-08  2:59     ` Sonic Zhang
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2013-09-27 12:20 UTC (permalink / raw)
  To: Axel Lin; +Cc: Sonic Zhang, linux-kernel@vger.kernel.org

On Tue, Sep 24, 2013 at 9:47 AM, Axel Lin <axel.lin@ingics.com> wrote:

> Current code hold port->lock spinlock and then try to grab the lock again
> in adi_gpio_set_value(). Fix it.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

Patch applied, thanks Axel.

Sonic, when you see patches like this please look at and ACK
them.

Yours,
Linus Walleij

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

* Re: [PATCH 2/2] pinctrl: adi2: Fix dead lock in adi_gpio_direction_output
  2013-09-27 12:20   ` Linus Walleij
@ 2013-10-08  2:59     ` Sonic Zhang
  0 siblings, 0 replies; 5+ messages in thread
From: Sonic Zhang @ 2013-10-08  2:59 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Axel Lin, Sonic Zhang, linux-kernel@vger.kernel.org

Hi Linus,

On Fri, Sep 27, 2013 at 8:20 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Tue, Sep 24, 2013 at 9:47 AM, Axel Lin <axel.lin@ingics.com> wrote:
>
>> Current code hold port->lock spinlock and then try to grab the lock again
>> in adi_gpio_set_value(). Fix it.
>>
>> Signed-off-by: Axel Lin <axel.lin@ingics.com>
>
> Patch applied, thanks Axel.
>
> Sonic, when you see patches like this please look at and ACK
> them.

Sorry, I am on vacation since Sep. 24.
I will do it in future.

Regards,

Sonic

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

end of thread, other threads:[~2013-10-08  2:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-24  7:46 [PATCH 1/2] pinctrl: adi2: Convert to devm_ioremap_resource Axel Lin
2013-09-24  7:47 ` [PATCH 2/2] pinctrl: adi2: Fix dead lock in adi_gpio_direction_output Axel Lin
2013-09-27 12:20   ` Linus Walleij
2013-10-08  2:59     ` Sonic Zhang
2013-09-27 12:19 ` [PATCH 1/2] pinctrl: adi2: Convert to devm_ioremap_resource 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).