From: Clemens Ladisch <clemens@ladisch.de>
To: Takashi Iwai <tiwai@suse.de>
Cc: Yong Zhang <yong.zhang0@gmail.com>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] [PATCH 02/62] mpu401:snd_mpu401_uart_new(): split semantic of irq_flags
Date: Mon, 12 Sep 2011 15:16:14 +0200 [thread overview]
Message-ID: <4E6E061E.2010000@ladisch.de> (raw)
In-Reply-To: <s5hvcsy6nr2.wl%tiwai@suse.de>
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
next prev parent reply other threads:[~2011-09-12 13:15 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1315383059-3673-1-git-send-email-yong.zhang0@gmail.com>
2011-09-07 8:10 ` [PATCH 60/62] sound: irq: Remove IRQF_DISABLED Yong Zhang
2011-09-07 8:36 ` Péter Ujfalusi
2011-09-07 17:12 ` Mark Brown
[not found] ` <1315383059-3673-3-git-send-email-yong.zhang0@gmail.com>
2011-09-08 10:53 ` [RFC] [PATCH 02/62] mpu401:snd_mpu401_uart_new(): split semantic of irq_flags Clemens Ladisch
2011-09-08 13:37 ` Yong Zhang
2011-09-08 13:58 ` Clemens Ladisch
2011-09-08 14:45 ` Yong Zhang
2011-09-08 20:27 ` Clemens Ladisch
2011-09-09 1:31 ` Yong Zhang
2011-09-11 15:10 ` Clemens Ladisch
2011-09-12 10:47 ` Takashi Iwai
2011-09-12 13:16 ` Clemens Ladisch [this message]
2011-09-12 20:23 ` Clemens Ladisch
2011-09-13 7:12 ` Takashi Iwai
2011-09-13 8:17 ` Clemens Ladisch
2011-09-13 9:24 ` Clemens Ladisch
2011-09-14 8:49 ` Yong Zhang
2011-09-14 9:06 ` Takashi Iwai
2011-09-14 9:15 ` Yong Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E6E061E.2010000@ladisch.de \
--to=clemens@ladisch.de \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tiwai@suse.de \
--cc=yong.zhang0@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox