* [PATCH 1/4 v2] gpio/tc3589x: convert to use the simple irqdomain
@ 2012-10-19 10:53 Linus Walleij
2012-11-21 15:00 ` Grant Likely
0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2012-10-19 10:53 UTC (permalink / raw)
To: linux-kernel; +Cc: Linus Walleij, Grant Likely, Rob Herring, Lee Jones
The special checks for whether we have a base IRQ offset or not
is surplus if we use the simple IRQ domain. The IRQ offset
zero will be interpreted as a linear domain case.
Plus this makes sure we allocate descriptors where need be, or
warn if they are preallocated with SPARSE_IRQ.
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v2: add a comment that explains what is going on,
it fooled me so it could fool somebody else too.
---
drivers/gpio/gpio-tc3589x.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/gpio/gpio-tc3589x.c b/drivers/gpio/gpio-tc3589x.c
index 1e48317..8c8447c 100644
--- a/drivers/gpio/gpio-tc3589x.c
+++ b/drivers/gpio/gpio-tc3589x.c
@@ -292,17 +292,15 @@ static int tc3589x_gpio_irq_init(struct tc3589x_gpio *tc3589x_gpio,
{
int base = tc3589x_gpio->irq_base;
- if (base) {
- tc3589x_gpio->domain = irq_domain_add_legacy(
- NULL, tc3589x_gpio->chip.ngpio, base,
- 0, &tc3589x_irq_ops, tc3589x_gpio);
- }
- else {
- tc3589x_gpio->domain = irq_domain_add_linear(
- np, tc3589x_gpio->chip.ngpio,
- &tc3589x_irq_ops, tc3589x_gpio);
- }
-
+ /*
+ * If this results in a linear domain, irq_create_mapping() will
+ * take care of allocating IRQ descriptors at runtime. When a base
+ * is provided, the IRQ descriptors will be allocated when the
+ * domain is instantiated.
+ */
+ tc3589x_gpio->domain = irq_domain_add_simple(np,
+ tc3589x_gpio->chip.ngpio, base, &tc3589x_irq_ops,
+ tc3589x_gpio);
if (!tc3589x_gpio->domain) {
dev_err(tc3589x_gpio->dev, "Failed to create irqdomain\n");
return -ENOSYS;
--
1.7.11.7
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH 1/4 v2] gpio/tc3589x: convert to use the simple irqdomain
2012-10-19 10:53 [PATCH 1/4 v2] gpio/tc3589x: convert to use the simple irqdomain Linus Walleij
@ 2012-11-21 15:00 ` Grant Likely
0 siblings, 0 replies; 2+ messages in thread
From: Grant Likely @ 2012-11-21 15:00 UTC (permalink / raw)
To: Linus Walleij, linux-kernel; +Cc: Linus Walleij, Rob Herring, Lee Jones
On Fri, 19 Oct 2012 12:53:45 +0200, Linus Walleij <linus.walleij@linaro.org> wrote:
> The special checks for whether we have a base IRQ offset or not
> is surplus if we use the simple IRQ domain. The IRQ offset
> zero will be interpreted as a linear domain case.
>
> Plus this makes sure we allocate descriptors where need be, or
> warn if they are preallocated with SPARSE_IRQ.
>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Applied, thanks.
g.
> ---
> ChangeLog v1->v2: add a comment that explains what is going on,
> it fooled me so it could fool somebody else too.
> ---
> drivers/gpio/gpio-tc3589x.c | 20 +++++++++-----------
> 1 file changed, 9 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpio/gpio-tc3589x.c b/drivers/gpio/gpio-tc3589x.c
> index 1e48317..8c8447c 100644
> --- a/drivers/gpio/gpio-tc3589x.c
> +++ b/drivers/gpio/gpio-tc3589x.c
> @@ -292,17 +292,15 @@ static int tc3589x_gpio_irq_init(struct tc3589x_gpio *tc3589x_gpio,
> {
> int base = tc3589x_gpio->irq_base;
>
> - if (base) {
> - tc3589x_gpio->domain = irq_domain_add_legacy(
> - NULL, tc3589x_gpio->chip.ngpio, base,
> - 0, &tc3589x_irq_ops, tc3589x_gpio);
> - }
> - else {
> - tc3589x_gpio->domain = irq_domain_add_linear(
> - np, tc3589x_gpio->chip.ngpio,
> - &tc3589x_irq_ops, tc3589x_gpio);
> - }
> -
> + /*
> + * If this results in a linear domain, irq_create_mapping() will
> + * take care of allocating IRQ descriptors at runtime. When a base
> + * is provided, the IRQ descriptors will be allocated when the
> + * domain is instantiated.
> + */
> + tc3589x_gpio->domain = irq_domain_add_simple(np,
> + tc3589x_gpio->chip.ngpio, base, &tc3589x_irq_ops,
> + tc3589x_gpio);
> if (!tc3589x_gpio->domain) {
> dev_err(tc3589x_gpio->dev, "Failed to create irqdomain\n");
> return -ENOSYS;
> --
> 1.7.11.7
>
--
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies, Ltd.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-21 15:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-19 10:53 [PATCH 1/4 v2] gpio/tc3589x: convert to use the simple irqdomain Linus Walleij
2012-11-21 15:00 ` Grant Likely
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).