Re: [PATCH v5] gpio: driver for PrimeCell PL061 GPIO controller

From: Baruch Siach
Date: Tue Jun 16 2009 - 00:21:40 EST


Hi David,

Thank you very much for your review.

On Mon, Jun 15, 2009 at 04:29:11PM -0700, David Brownell wrote:
> On Thursday 11 June 2009, Baruch Siach wrote:
> > +static unsigned int pl061_irq_startup(unsigned irq)
> > +{
> > +       if (gpio_request(irq_to_gpio(irq), "IRQ") == 0)
> > +               pr_warning("%s: warning: GPIO%d has not been requested\n",
> > +                               __func__, irq_to_gpio(irq));
>
> No, that's the responsibility of whoever is setting this up.

The gpio_request() here is only for warning. It is expected to fail. Should I
remove it? Shouldn't there be an is_gpio_requested() as part of gpiolib?

> Normally, platform setup code would request the GPIO since it's
> being dedicated to some task on the board ... and then pass the
> gpio_to_irq() value as a device resource, or maybe the GPIO itself
> (if the driver had to deal with GPIOs per se).
>
> Also, irq_to_gpio() can be problematic in some systems; avoid it.

I use irq_to_gpio() extensively to implement the enable/disable etc. methods
of irq_chip. Is there a way to implement them without irq_to_gpio()?

> > +
> > +       pl061_irq_enable(irq);
> > +
> > +       return 0;
> > +}
>
> Remove that gpio_request(), and the irq_to_gpio(), and you get:
>
> Acked-by: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx>

Thanks,

Baruch

--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@xxxxxxxxxx - tel: +972.2.679.5364, http://www.tkos.co.il -
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/