[PATCH 2/2] gpio/omap: warn if bank is not enabled on setting irq type

Felipe Balbi balbi at ti.com
Sat Mar 2 06:49:35 EST 2013


On Fri, Mar 01, 2013 at 11:22:48AM -0600, Jon Hunter wrote:
> For OMAP devices, if a gpio is being used as an interrupt source but has
> not been requested by calling gpio_request(), a call to request_irq()
> may cause the kernel hang because the gpio bank may be disabled and
> hence the register access will fail. To prevent such hangs, test for
> this case and warn if this is detected.
> 
> Signed-off-by: Jon Hunter <jon-hunter at ti.com>
> ---
>  drivers/gpio/gpio-omap.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index c3598d1..0d30c7a 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -427,6 +427,9 @@ static int gpio_irq_type(struct irq_data *d, unsigned type)
>  	int retval;
>  	unsigned long flags;
>  
> +	if (WARN_ON(!bank->mod_usage))

It would be better to use WARN(!bank->mod_usage, "error message\n") IMO.

no strong feelings however:

Reviewed-by: Felipe Balbi <balbi at ti.com>

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130302/236f9c77/attachment.sig>


More information about the linux-arm-kernel mailing list