pinctrl: adi2: Convert to devm_ioremap_resource
PATCH 1/2 pinctrl: adi2: Convert to devm_ioremap_resource
--- drivers/pinctrl/pinctrl-adi2.c | 38 ++++++-------------------------------- 1 file changed, 6 insertions(+), 32 deletions(-)
drivers/pinctrl/pinctrl-adi2.c +6 -32
@@ -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)
Signature · 1 line
1.8.1.2
PATCH 2/2 pinctrl: adi2: Fix dead lock in adi_gpio_direction_output
Current code hold port->lock spinlock and then try to grab the lock again in adi_gpio_set_value(). Fix it.
--- drivers/pinctrl/pinctrl-adi2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pinctrl/pinctrl-adi2.c +2 -1
@@ -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 (®s->inen) & ~(1 << offset), ®s->inen); -adi_gpio_set_value (chip, offset, value);writew (1 << offset, ®s->dir_set);spin_unlock_irqrestore (&port->lock, flags);
Signature · 1 line
1.8.1.2
Re: [PATCH 2/2] pinctrl: adi2: Fix dead lock in adi_gpio_direction_output
Quoted 4 lines · Axel Lin
Current code hold
port->lockspinlock and then try to grab the lock again inadi_gpio_set_value(). Fix it.Signed-off-by Axel Lin <[email protected]>
Patch applied, thanks Axel.
Sonic, when you see patches like this please look at and ACK them.
Yours,
Linus Walleij
Re: [PATCH 2/2] pinctrl: adi2: Fix dead lock in adi_gpio_direction_output
Hi Linus,
Quoted 11 lines · Linus Walleij
Quoted 4 lines · Axel Lin
Current code hold
port->lockspinlock and then try to grab the lock again inadi_gpio_set_value(). Fix it.Signed-off-by Axel Lin <[email protected]>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
Quoted 1 line · Axel Lin
Signed-off-by Axel Lin <[email protected]>
Patch applied, thanks Axel.
I should have caught this in review :-(
Yours,
Linus Walleij