Re: [PATCH] gpiolib:change to use irq_alloc_descs_from to alloc virqs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 9, 2014 at 9:12 AM, Wang, Yalin <Yalin.Wang@xxxxxxxxxxxxxx> wrote:

> this patch change use from irq_create_mapping to irq_alloc_descs_from,
> use irq_create_mapping to alloc virq one by one is not safe,
> it can't promise the allcated virqs are continuous,
> in stead, we use irq_alloc_descs_from() to alloc virqs in one time,
> so that the allocated virqs are in continuous bitmaps.
>
> Signed-off-by: Yalin Wang <yalin.wang@xxxxxxxxxxxxxx>

(...)

> -       for (offset = 0; offset < gpiochip->ngpio; offset++) {
> -               irq_base = irq_create_mapping(gpiochip->irqdomain, offset);
> -               if (offset == 0)
> -                       /*
> -                        * Store the base into the gpiochip to be used when
> -                        * unmapping the irqs.
> -                        */
> -                       gpiochip->irq_base = irq_base;
> +       if (first_irq > 0) {
> +               gpiochip->irq_base = first_irq;

Wait is this safe? Now you assume all descriptors are pre-allocated
and associated in this case, atleast explain what is going on.

> +       } else {
> +               gpiochip->irq_base = irq_alloc_descs_from(1, gpiochip->ngpio,
> +                               of_node_to_nid(of_node));
> +               irq_domain_associate_many(gpiochip->irqdomain,
> +                               gpiochip->irq_base, 0, gpiochip->ngpio);

This part looks OK.

I'm holding this patch back until the above is clarified.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux