From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] ARM: common/locomo: remove NO_IRQ check
Date: Tue, 06 Sep 2016 17:20:47 +0200 [thread overview]
Message-ID: <4429009.oMpylzDcbd@wuerfel> (raw)
In-Reply-To: <4485846.n2NSoAbukL@wuerfel>
The locomo driver uses two irq numbers, its own IRQ as passed
in the platform resources, and the base number for the interupts
of its child devices, passed in platform_data.
Since commit 489447380a29 ("[PATCH] handle errors returned by
platform_get_irq*()") ten years ago, the locomo driver refuses to
work without an interrupt line passed in its resources, so the
check comparing lchip->irq to NO_IRQ is unnecessary.
We still check the irq_base provided in the platform_data for
NO_IRQ, but as both platforms that use locomo (poodle and collie)
provide an irq_base, this can be done more consistently
by just checking that both are valid in the probe function
and otherwise returning an error.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v2: add back NULL pointer check, clarify changelog
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index 0e97b4b871f9..38ca2db0cf12 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -253,8 +253,7 @@ locomo_init_one_child(struct locomo *lchip, struct locomo_dev_info *info)
dev->mapbase = 0;
dev->length = info->length;
- dev->irq[0] = (lchip->irq_base == NO_IRQ) ?
- NO_IRQ : lchip->irq_base + info->irq[0];
+ dev->irq[0] = lchip->irq_base + info->irq[0];
ret = device_register(&dev->dev);
if (ret) {
@@ -376,6 +375,9 @@ __locomo_probe(struct device *me, struct resource *mem, int irq)
unsigned long r;
int i, ret = -ENODEV;
+ if (!pdata || !pdata->irq_base)
+ return ret;
+
lchip = kzalloc(sizeof(struct locomo), GFP_KERNEL);
if (!lchip)
return -ENOMEM;
@@ -387,7 +389,7 @@ __locomo_probe(struct device *me, struct resource *mem, int irq)
lchip->phys = mem->start;
lchip->irq = irq;
- lchip->irq_base = (pdata) ? pdata->irq_base : NO_IRQ;
+ lchip->irq_base = pdata->irq_base;
/*
* Map the whole region. This also maps the
@@ -454,8 +456,7 @@ __locomo_probe(struct device *me, struct resource *mem, int irq)
* The interrupt controller must be initialised before any
* other device to ensure that the interrupts are available.
*/
- if (lchip->irq != NO_IRQ && lchip->irq_base != NO_IRQ)
- locomo_setup_irq(lchip);
+ locomo_setup_irq(lchip);
for (i = 0; i < ARRAY_SIZE(locomo_devices); i++)
locomo_init_one_child(lchip, &locomo_devices[i]);
@@ -476,9 +477,7 @@ static void __locomo_remove(struct locomo *lchip)
{
device_for_each_child(lchip->dev, NULL, locomo_remove_child);
- if (lchip->irq != NO_IRQ) {
- irq_set_chained_handler_and_data(lchip->irq, NULL, NULL);
- }
+ irq_set_chained_handler_and_data(lchip->irq, NULL, NULL);
iounmap(lchip->base);
kfree(lchip);
WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: linux-arm-kernel@lists.infradead.org
Cc: Russell King - ARM Linux <linux@armlinux.org.uk>,
linux-kernel@vger.kernel.org
Subject: [PATCH v2] ARM: common/locomo: remove NO_IRQ check
Date: Tue, 06 Sep 2016 17:20:47 +0200 [thread overview]
Message-ID: <4429009.oMpylzDcbd@wuerfel> (raw)
In-Reply-To: <4485846.n2NSoAbukL@wuerfel>
The locomo driver uses two irq numbers, its own IRQ as passed
in the platform resources, and the base number for the interupts
of its child devices, passed in platform_data.
Since commit 489447380a29 ("[PATCH] handle errors returned by
platform_get_irq*()") ten years ago, the locomo driver refuses to
work without an interrupt line passed in its resources, so the
check comparing lchip->irq to NO_IRQ is unnecessary.
We still check the irq_base provided in the platform_data for
NO_IRQ, but as both platforms that use locomo (poodle and collie)
provide an irq_base, this can be done more consistently
by just checking that both are valid in the probe function
and otherwise returning an error.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v2: add back NULL pointer check, clarify changelog
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index 0e97b4b871f9..38ca2db0cf12 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -253,8 +253,7 @@ locomo_init_one_child(struct locomo *lchip, struct locomo_dev_info *info)
dev->mapbase = 0;
dev->length = info->length;
- dev->irq[0] = (lchip->irq_base == NO_IRQ) ?
- NO_IRQ : lchip->irq_base + info->irq[0];
+ dev->irq[0] = lchip->irq_base + info->irq[0];
ret = device_register(&dev->dev);
if (ret) {
@@ -376,6 +375,9 @@ __locomo_probe(struct device *me, struct resource *mem, int irq)
unsigned long r;
int i, ret = -ENODEV;
+ if (!pdata || !pdata->irq_base)
+ return ret;
+
lchip = kzalloc(sizeof(struct locomo), GFP_KERNEL);
if (!lchip)
return -ENOMEM;
@@ -387,7 +389,7 @@ __locomo_probe(struct device *me, struct resource *mem, int irq)
lchip->phys = mem->start;
lchip->irq = irq;
- lchip->irq_base = (pdata) ? pdata->irq_base : NO_IRQ;
+ lchip->irq_base = pdata->irq_base;
/*
* Map the whole region. This also maps the
@@ -454,8 +456,7 @@ __locomo_probe(struct device *me, struct resource *mem, int irq)
* The interrupt controller must be initialised before any
* other device to ensure that the interrupts are available.
*/
- if (lchip->irq != NO_IRQ && lchip->irq_base != NO_IRQ)
- locomo_setup_irq(lchip);
+ locomo_setup_irq(lchip);
for (i = 0; i < ARRAY_SIZE(locomo_devices); i++)
locomo_init_one_child(lchip, &locomo_devices[i]);
@@ -476,9 +477,7 @@ static void __locomo_remove(struct locomo *lchip)
{
device_for_each_child(lchip->dev, NULL, locomo_remove_child);
- if (lchip->irq != NO_IRQ) {
- irq_set_chained_handler_and_data(lchip->irq, NULL, NULL);
- }
+ irq_set_chained_handler_and_data(lchip->irq, NULL, NULL);
iounmap(lchip->base);
kfree(lchip);
next prev parent reply other threads:[~2016-09-06 15:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-06 13:53 [PATCH 1/4] ARM: common/sa1111: remove NO_IRQ check Arnd Bergmann
2016-09-06 13:53 ` Arnd Bergmann
2016-09-06 13:53 ` [PATCH 2/4] ARM: common/locomo: " Arnd Bergmann
2016-09-06 13:53 ` Arnd Bergmann
2016-09-06 14:21 ` Russell King - ARM Linux
2016-09-06 14:21 ` Russell King - ARM Linux
2016-09-06 14:50 ` Arnd Bergmann
2016-09-06 14:50 ` Arnd Bergmann
2016-09-06 15:20 ` Arnd Bergmann [this message]
2016-09-06 15:20 ` [PATCH v2] " Arnd Bergmann
2016-09-06 13:53 ` [PATCH 3/4] mfd: ucb1x00: " Arnd Bergmann
2016-09-07 11:24 ` Lee Jones
2016-09-06 13:53 ` [PATCH 4/4] pcmcia: soc-common: remove incorrect NO_IRQ use Arnd Bergmann
2016-09-06 14:14 ` [PATCH 1/4] ARM: common/sa1111: remove NO_IRQ check Russell King - ARM Linux
2016-09-06 14:14 ` Russell King - ARM Linux
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4429009.oMpylzDcbd@wuerfel \
--to=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.