[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4E6E061E.2010000@ladisch.de>
Date: Mon, 12 Sep 2011 15:16:14 +0200
From: Clemens Ladisch <clemens@...isch.de>
To: Takashi Iwai <tiwai@...e.de>
CC: Yong Zhang <yong.zhang0@...il.com>, linux-kernel@...r.kernel.org,
Jaroslav Kysela <perex@...ex.cz>, alsa-devel@...a-project.org
Subject: Re: [RFC] [PATCH 02/62] mpu401:snd_mpu401_uart_new(): split semantic
of irq_flags
Takashi Iwai wrote:
> Clemens Ladisch wrote:
> > --- a/sound/isa/als100.c
> > +++ b/sound/isa/als100.c
> > @@ -245,18 +245,22 @@ static int __devinit snd_card_als100_probe(int dev,
> >
> > if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) {
> > int mpu_type = MPU401_HW_ALS100;
> > + int mpu_flags = 0;
> >
> > - if (mpu_irq[dev] == SNDRV_AUTO_IRQ)
> > + if (mpu_irq[dev] == SNDRV_AUTO_IRQ) {
> > mpu_irq[dev] = -1;
> > + mpu_flags = MPU401_INFO_RX_POLL;
> > + }
>
> When mpu_irq[dev] is set to -1, it won't work.
Thanks for noticing this!
> Instead of setting mpu_flag in this if block, you'd need another check
> of mpu_irq[], i.e.
>
> if (mpu_irq[dev] == SNDRV_AUTO_IRQ)
> mpu_irq[dev] = -1;
> if (mpu_irq[dev] < 0)
> mpu_flags = MPU401_INFO_RX_POLL;
I didn't like all the duplicated code I added to the ISA drivers, and
the more code it becomes, the less I like it.
But it should be possible to avoid this duplication:
snd_mpu401_uart_new() needs to differentiate between three cases:
1) allocate a separate interrupt;
2) do not allocate, use the callback from the driver's interrupt handler;
3) do not allocate, use a timer for polling.
Case 1) is indicated by a valid irq number, the other two cases need
a flag. All drivers that might use polling switch between 1) or 3),
while 2) is always used unconditionally. So if we have this flag for 2)
instead of 3), no additional logic is needed in the drivers.
(Furthermore, snd_mpu401_uart_new() could check for SNDRV_AUTO_IRQ
instead of letting all drivers do this, and the hardware and info_flags
parameters could be merged. But this can wait for later.)
I'll have a new patch until tomorrow.
Regards,
Clemens
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists