Re: [RFC] [PATCH 02/62] mpu401:snd_mpu401_uart_new(): split semantic of irq_flags

Yong Zhang
2011-09-08T14:45:41Z

On Thu, Sep 08, 2011 at 03:58:45PM +0200, Clemens Ladisch wrote:
>
> The MPU-401 in UART mode is a very simple and stupid MIDI interface,
> which is used on very many sound cards. Depending on the actual
> hardware implementation, it gets its own interrupt which may be
> exclusive or sharable, or it is integrated into the interrupt handling
> of the main sound card which means that the sound driver has to call the
> mpu401 interrupt handler explicitly.
>
> Here, "no interrupt" and "already reserved" actually mean the same thing,
> i.e., that the interrupt handling is the responsibility of some other
> driver.

Thanks. If my understanding is correct, in below combination:

irq irq_flags
1) >=0 >0 /* valid */
2) >=0 =0 /* invalid, irq should be '-1' */
3) -1 >0 /* valid, irq_flags just mean real irq_falgs,
but actually there is no irq */
4) -1 =0 /* valid */

my comment will be true, and we could simplify snd_mpu401_uart_new()
like below:

- if (irq >= 0 && irq_flags) {
+ if (irq >= 0) {

right?

And then we should audit all the callers of snd_mpu401_uart_new()
to check if they provide the cerrect irq number, but IMOH, that
would more difficult than keeping 'want_irq/irq_reserved'.

Thanks,
Yong