All of lore.kernel.org
 help / color / mirror / Atom feed
From: haojian.zhuang@linaro.org (Haojian Zhuang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v8 03/12] gpio: pl061: allocate irq dynamically
Date: Fri, 15 Feb 2013 01:10:30 +0800	[thread overview]
Message-ID: <CAD6h2NTVCLR2oQEoHyWVt9rzXtbUuYaYfqaC1K8GmwRGW_AFSg@mail.gmail.com> (raw)
In-Reply-To: <CACRpkdaaiVzg2F2R51TTL4=nt_VDWf0bFaJF2SzysdT8FouJAQ@mail.gmail.com>

On 14 February 2013 22:04, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Mon, Feb 11, 2013 at 6:10 PM, Haojian Zhuang
> <haojian.zhuang@linaro.org> wrote:
>
> We don't convert drivers to irqdomain without actually *using*
> the irqdomain. I don't know where this pattern comes from,
> but I'm suspicious about patch sets that just focus on enabling
> DT functionality without considering irqdomain stuff as a concept
> of its own.
>
> The biggest problem with this patch is what is missing from it:
>
> - irq_base shall be *deleted* from struct pl061_gpio
> - instead a struct irqdomain  * shall be stored for offsetting IRQs
> - everywhere chip->irq_base is referenced, use irq_find_mapping()
> - In pl061_to_irq, irq_create_mapping() shall be used, so it will
>   allocate a descriptor even if we're using the driver with
>   SPARSE_IRQ and a linear domain.
>
> Look at e.g. gpio-langwell.c for guidance.
>
>> +       chip->irq_base = irq_alloc_descs(chip->irq_base, 0, PL061_GPIO_NR, 0);
>> +       if (chip->irq_base < 0)
>> +               return chip->irq_base;
>> +       if (!irq_domain_add_legacy(adev->dev.of_node, PL061_GPIO_NR,
>> +                                  chip->irq_base, 0, &pl061_domain_ops, chip))
>>                 return -ENODEV;
>
> Instead of the above, please use:
>
> chip->irqdomain = irq_domain_add_simple(adev->dev.of_node,
>                                          PL061_GPIO_NR,
>                                          chip->irq_base,
>                                          &pl061_domain_ops,
>                                          chip);
>
> Notice that I don't throw the domain away after creation either...
>
> This call will allocate descriptors for you as long as the
> irq_base > 0, which it should be, since 0 is NO_IRQ.
>
> It make things easier the day you start using a purely
> dynamic approach.
>
> Yours,
> Linus Walleij

Thank you. I'll update it.

Regards
Haojian

  reply	other threads:[~2013-02-14 17:10 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-11 17:10 [PATCH v8 00/12] bind pinconf with pinctrl single Haojian Zhuang
2013-02-11 17:10 ` [PATCH v8 01/12] gpio: add gpio offset in gpio range cells property Haojian Zhuang
2013-02-13 13:33   ` Linus Walleij
2013-02-11 17:10 ` [PATCH v8 02/12] gpio: fix wrong checking condition for gpio range Haojian Zhuang
2013-02-14 12:15   ` Linus Walleij
2013-02-11 17:10 ` [PATCH v8 03/12] gpio: pl061: allocate irq dynamically Haojian Zhuang
2013-02-14 14:04   ` Linus Walleij
2013-02-14 17:10     ` Haojian Zhuang [this message]
2013-02-11 17:10 ` [PATCH v8 04/12] pinctrl: verify whether gpio chip overlapps range Haojian Zhuang
2013-02-14 15:23   ` Linus Walleij
2013-02-14 17:01     ` Haojian Zhuang
2013-02-15  9:06       ` Linus Walleij
2013-02-17  9:42         ` Haojian Zhuang
2013-02-11 17:10 ` [PATCH v8 05/12] gpio: pl061: bind pinctrl by gpio request Haojian Zhuang
2013-02-14 15:29   ` Linus Walleij
2013-02-14 17:06     ` Haojian Zhuang
2013-02-11 17:10 ` [PATCH v8 06/12] pinctrl: single: create new gpio function range Haojian Zhuang
2013-02-13 18:39   ` Tony Lindgren
2013-02-17 10:00     ` Haojian Zhuang
2013-02-14 15:24   ` Linus Walleij
2013-02-14 16:25     ` Haojian Zhuang
2013-02-11 17:10 ` [PATCH v8 07/12] pinctrl: generic: dump pin configuration Haojian Zhuang
2013-02-11 17:10 ` [PATCH v8 08/12] pinctrl: single: set function mask as optional Haojian Zhuang
2013-02-13 18:40   ` Tony Lindgren
2013-02-11 17:10 ` [PATCH v8 09/12] pinctrl: generic: add auto pull config parameter Haojian Zhuang
2013-02-13 23:40   ` Tony Lindgren
2013-02-15  8:54   ` Linus Walleij
2013-02-15 16:37     ` Tony Lindgren
2013-02-15 20:55       ` Linus Walleij
2013-02-15 21:06         ` Tony Lindgren
2013-02-11 17:10 ` [PATCH v8 10/12] pinctrl: generic: rename input schmitt disable Haojian Zhuang
2013-02-13 23:41   ` Tony Lindgren
2013-02-11 17:10 ` [PATCH v8 11/12] pinctrl: single: support generic pinconf Haojian Zhuang
2013-02-13 23:50   ` Tony Lindgren
2013-02-11 17:10 ` [PATCH v8 12/12] document: devicetree: bind pinconf with pin single Haojian Zhuang
2013-02-13 23:51   ` Tony Lindgren
2013-02-15  9:11 ` [PATCH v8 00/12] bind pinconf with pinctrl single Linus Walleij

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=CAD6h2NTVCLR2oQEoHyWVt9rzXtbUuYaYfqaC1K8GmwRGW_AFSg@mail.gmail.com \
    --to=haojian.zhuang@linaro.org \
    --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.