[linux-usb-devel] [PATCH 1/5] USB: Make usb_hcd_irq work for multi-role USB controllers w/ shared irq

David Brownell david-b at pacbell.net
Sun Nov 25 04:50:40 EST 2007


On Saturday 24 November 2007, Alan Cox wrote:
> > 
> > What about for platforms where irq 0 is a valid irq?
> 
> There are no such platforms. Linus made that absolutely clear every time
> this came up before
> 
>         0       -       No IRQ
> 
> A platform with a physical or bus IRQ of 0 needs to remap it to a
> different constant.

However it's also common practice to use negative numbers to
flag "this is no IRQ" ... avoiding all confusions with zero.

  - platform_get_irq(), platform_get_irq_byname() ... never
    return zero, they return irq (positive) or errno

  - PNP initializes invalid IRQs to "-1", and pnp_check_irq()
    handles irq zero as in-range

  - I'm sure I've seen negative numbers used elsewhere too

Something like

  #define is_valid_irq(x) ((x) >= 0)

would work better than expecting sudden agreement everywhere
about a single number representing "this is not an IRQ".

- Dave




More information about the Linuxppc-dev mailing list