From: jayakumar alsa <jayakumar.alsa@gmail.com>
To: Andrew Morton <akpm@osdl.org>
Cc: perex@suse.cz, mj@ucw.cz, alsa-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.6.13.1 1/1] CS5535 AUDIO ALSA driver
Date: Wed, 21 Sep 2005 15:08:26 +0800 [thread overview]
Message-ID: <47f5dce305092100085a13a5a7@mail.gmail.com> (raw)
In-Reply-To: <20050920152830.7ef6733b.akpm@osdl.org>
> > +static int __devinit snd_cs5535audio_probe(struct pci_dev *pci,
> > + const struct pci_device_id *pci_id)
> > +{
> > + static int dev;
> > + snd_card_t *card;
> > + cs5535audio_t *cs5535au;
> > + int err;
> > +
> > + if (dev >= SNDRV_CARDS)
> > + return -ENODEV;
> > + if (!enable[dev]) {
> > + dev++;
> > + return -ENOENT;
> > + }
> > +
> > + card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
> > + if (card == NULL)
> > + return -ENOMEM;
> > +
> > + if ((err = snd_cs5535audio_create(card, pci, &cs5535au)) < 0) {
> > + snd_card_free(card);
> > + return err;
> > + }
> > +
> > + if ((err = snd_cs5535audio_mixer(cs5535au)) < 0) {
> > + snd_card_free(card);
> > + return err;
> > + }
> > +
> > + if ((err = snd_cs5535audio_pcm(cs5535au)) < 0) {
> > + snd_card_free(card);
> > + return err;
> > + }
> > +
> > + strcpy(card->driver, DRIVER_NAME);
> > +
> > + strcpy(card->shortname, "CS5535 Audio");
> > + sprintf(card->longname, "%s %s at 0x%lx, irq %i",
> > + card->shortname, card->driver,
> > + cs5535au->port, cs5535au->irq);
> > +
> > + if ((err = snd_card_register(card)) < 0) {
> > + snd_card_free(card);
> > + return err;
> > + }
> > +
> > + pci_set_drvdata(pci, card);
> > + dev++;
> > + return 0;
> > +}
>
> Ditto.
>
> The handling of `dev' is racy ;)
I took a quick look at the dev handling.
% egrep -B20 "dev\+\+" $lintree/sound/pci/*.c
<snip>
--
../azt3328.c- return -ENODEV;
../azt3328.c- if (!enable[dev]) {
../azt3328.c: dev++;
--
../azt3328.c-
../azt3328.c- pci_set_drvdata(pci, card);
../azt3328.c: dev++;
--
../cmipci.c- return -ENODEV;
../cmipci.c- if (! enable[dev]) {
../cmipci.c: dev++;
--
../cmipci.c- }
../cmipci.c- pci_set_drvdata(pci, card);
../cmipci.c: dev++;
--
<snip>
So I think everyone is doing the same thing. I think probe is called
from driver_probe_device through device_add and in this case that's
from pci_bus_add_device/s from pci_do_scan_bus. I think the device
probe functions are therefore called serially and there is no risk of
a race condition. I hope that's right.
Thanks,
jk
prev parent reply other threads:[~2005-09-21 7:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-19 6:39 [PATCH 2.6.13.1 1/1] CS5535 AUDIO ALSA driver jayakumar.alsa
2005-09-20 22:28 ` Andrew Morton
2005-09-21 0:03 ` jayakumar alsa
2005-09-21 0:03 ` jayakumar alsa
2005-09-21 0:23 ` Andrew Morton
2005-09-21 8:31 ` Christoph Hellwig
2005-09-21 8:31 ` Christoph Hellwig
2005-09-29 13:21 ` [Alsa-devel] " Takashi Iwai
2005-12-06 17:42 ` Christoph Hellwig
2005-12-06 17:42 ` [Alsa-devel] " Christoph Hellwig
2005-12-06 18:41 ` Takashi Iwai
2005-09-29 13:04 ` Takashi Iwai
2005-09-21 7:08 ` jayakumar alsa [this message]
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=47f5dce305092100085a13a5a7@mail.gmail.com \
--to=jayakumar.alsa@gmail.com \
--cc=akpm@osdl.org \
--cc=alsa-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mj@ucw.cz \
--cc=perex@suse.cz \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.