From: Takashi Iwai Subject: Re: au88x0 Init before create components Date: Wed, 26 Apr 2006 17:05:52 +0200 Message-ID: References: <200604261414.52173.gineera@aspect135.co.uk> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <200604261414.52173.gineera@aspect135.co.uk> Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Alan Horstmann Cc: alsa-devel@lists.sourceforge.net, mjander@embedded.cl List-Id: alsa-devel@alsa-project.org At Wed, 26 Apr 2006 14:14:52 +0100, Alan Horstmann wrote: > > Patch as suggested by Raymond in one of his copious bug-track notes. > > Change the order in vortex_probe to init the card details before creating the > components, meaning for example that card->shortname is available when > registering the midi port. The detection of vendor, device and rev is irrelevant with the definition of driver, shortname and longname. Looking at the code a bit carefully, we can find that chip->vendor and chip->device are not really used in the code. The only referring part is IS_BAD_CHIP() macro in au88x0.h, and it's used nowhere. Moreover, the values are identical with pci->device and pci->vendor. So, basically we can remove these fields. But it's another story. Anyway, I'd suggest to move the definition of driver, shortname and longname there with a short comment that it's needed for mpu401 instance, and keep the rest as it is. Also, I feel "Aureal au8810 MIDI 0" is more intuitive than "MIDI Aureal au8810 0". It's a matter of taste, though... Thanks, Takashi > > I have also added extra to card->shortname, and a line to overwrite the midi > name following snd_mpu401_uart_new, for consideration. > > Do I have the correct address to cc mjander? > > au88x0-init-before-comps-et-al.patch > > Signed-off-by: Alan Horstmann > [2 au88x0-init-before-comps-et-al.patch ] > diff -ru alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/au88x0/au88x0.c alsa-driver-1.0.11rc3/alsa-kernel/pci/au88x0/au88x0.c > --- alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/au88x0/au88x0.c 2006-01-13 17:16:29.000000000 +0000 > +++ alsa-driver-1.0.11rc3/alsa-kernel/pci/au88x0/au88x0.c 2006-04-24 08:12:16.000000000 +0100 > @@ -261,7 +261,28 @@ > return err; > } > snd_vortex_workaround(pci, pcifix[dev]); > - // (4) Alloc components. > + // (4) > + strcpy(card->driver, CARD_NAME_SHORT); > + sprintf(card->shortname, "Aureal Vortex %s", CARD_NAME_SHORT); > + sprintf(card->longname, "%s at 0x%lx irq %i", > + card->shortname, chip->io, chip->irq); > + > + if ((err = pci_read_config_word(pci, PCI_DEVICE_ID, > + &(chip->device))) < 0) { > + snd_card_free(card); > + return err; > + } > + if ((err = pci_read_config_word(pci, PCI_VENDOR_ID, > + &(chip->vendor))) < 0) { > + snd_card_free(card); > + return err; > + } > + if ((err = pci_read_config_byte(pci, PCI_REVISION_ID, > + &(chip->rev))) < 0) { > + snd_card_free(card); > + return err; > + } > + // (5) Alloc components. > // ADB pcm. > if ((err = snd_vortex_new_pcm(chip, VORTEX_PCM_ADB, NR_ADB)) < 0) { > snd_card_free(card); > @@ -322,27 +343,6 @@ > } > #endif > > - // (5) > - strcpy(card->driver, CARD_NAME_SHORT); > - strcpy(card->shortname, CARD_NAME_SHORT); > - sprintf(card->longname, "%s at 0x%lx irq %i", > - card->shortname, chip->io, chip->irq); > - > - if ((err = pci_read_config_word(pci, PCI_DEVICE_ID, > - &(chip->device))) < 0) { > - snd_card_free(card); > - return err; > - } > - if ((err = pci_read_config_word(pci, PCI_VENDOR_ID, > - &(chip->vendor))) < 0) { > - snd_card_free(card); > - return err; > - } > - if ((err = pci_read_config_byte(pci, PCI_REVISION_ID, > - &(chip->rev))) < 0) { > - snd_card_free(card); > - return err; > - } > #ifdef CHIP_AU8830 > if ((chip->rev) != 0xfe && (chip->rev) != 0xfa) { > printk(KERN_ALERT > diff -ru alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/au88x0/au88x0_mpu401.c alsa-driver-1.0.11rc3/alsa-kernel/pci/au88x0/au88x0_mpu401.c > --- alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/au88x0/au88x0_mpu401.c 2006-01-13 17:16:29.000000000 +0000 > +++ alsa-driver-1.0.11rc3/alsa-kernel/pci/au88x0/au88x0_mpu401.c 2006-04-24 07:57:51.000000000 +0100 > @@ -107,6 +107,9 @@ > mpu = rmidi->private_data; > mpu->cport = (unsigned long)(vortex->mmio + VORTEX_MIDI_CMD); > #endif > + /* Overwrite MIDI name */ > + snprintf(rmidi->name, sizeof(rmidi->name), "MIDI %s %d", CARD_NAME_SHORT , vortex->card->number); > + > vortex->rmidi = rmidi; > return 0; > } ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642