diff -urN --exclude-from=/home/davej/.exclude linux/drivers/sound/es1370.c linux-dj/drivers/sound/es1370.c --- linux/drivers/sound/es1370.c Sun Mar 4 20:08:54 2001 +++ linux-dj/drivers/sound/es1370.c Sun Mar 4 20:16:16 2001 @@ -2544,14 +2544,21 @@ spin_lock_init(&s->lock); s->magic = ES1370_MAGIC; s->dev = pcidev; + + i = pci_enable_device(pcidev); + if (i) { + kfree(s); + return i; + } + s->io = pci_resource_start(pcidev, 0); s->irq = pcidev->irq; + if (!request_region(s->io, ES1370_EXTENT, "es1370")) { printk(KERN_ERR "es1370: io ports %#lx-%#lx in use\n", s->io, s->io+ES1370_EXTENT-1); goto err_region; } - if (pci_enable_device(pcidev)) - goto err_irq; + if (request_irq(s->irq, es1370_interrupt, SA_SHIRQ, "es1370", s)) { printk(KERN_ERR "es1370: irq %u in use\n", s->irq); goto err_irq; diff -urN --exclude-from=/home/davej/.exclude linux/drivers/sound/es1371.c linux-dj/drivers/sound/es1371.c --- linux/drivers/sound/es1371.c Fri Feb 9 19:30:23 2001 +++ linux-dj/drivers/sound/es1371.c Sun Mar 4 20:16:16 2001 @@ -2756,6 +2756,13 @@ spin_lock_init(&s->lock); s->magic = ES1371_MAGIC; s->dev = pcidev; + + i = pci_enable_device(pcidev); + if (i) { + kfree(s); + return i; + } + s->io = pci_resource_start(pcidev, 0); s->irq = pcidev->irq; s->vendor = pcidev->vendor; @@ -2771,8 +2778,6 @@ printk(KERN_ERR PFX "io ports %#lx-%#lx in use\n", s->io, s->io+ES1371_EXTENT-1); goto err_region; } - if (pci_enable_device(pcidev)) - goto err_irq; if (request_irq(s->irq, es1371_interrupt, SA_SHIRQ, "es1371", s)) { printk(KERN_ERR PFX "irq %u in use\n", s->irq); goto err_irq; diff -urN --exclude-from=/home/davej/.exclude linux/drivers/sound/esssolo1.c linux-dj/drivers/sound/esssolo1.c --- linux/drivers/sound/esssolo1.c Fri Feb 9 19:30:23 2001 +++ linux-dj/drivers/sound/esssolo1.c Sun Mar 4 20:16:16 2001 @@ -2275,6 +2275,11 @@ spin_lock_init(&s->lock); s->magic = SOLO1_MAGIC; s->dev = pcidev; + i = pci_enable_device(pcidev); + if (i) { + kfree (s); + return i; + } s->iobase = pci_resource_start(pcidev, 0); s->sbbase = pci_resource_start(pcidev, 1); s->vcbase = pci_resource_start(pcidev, 2); @@ -2302,8 +2307,6 @@ printk(KERN_ERR "solo1: irq %u in use\n", s->irq); goto err_irq; } - if (pci_enable_device(pcidev)) - goto err_irq; printk(KERN_INFO "solo1: joystick port at %#lx\n", s->gpbase+1); /* register devices */ if ((s->dev_audio = register_sound_dsp(&solo1_audio_fops, -1)) < 0) diff -urN --exclude-from=/home/davej/.exclude linux/drivers/sound/maestro.c linux-dj/drivers/sound/maestro.c --- linux/drivers/sound/maestro.c Sun Mar 4 20:08:54 2001 +++ linux-dj/drivers/sound/maestro.c Sun Mar 4 20:16:16 2001 @@ -3322,6 +3322,13 @@ if(((pcidev->class >> 8) & 0xffff) != PCI_CLASS_MULTIMEDIA_AUDIO) return 0; + if (pci_enable_device(pcidev)) { + printk (KERN_ERR "maestro: pci_enable_device() failed\n"); + return 0; + } + /* just to be sure */ + pci_set_master(pcidev); + iobase = SILLY_PCI_BASE_ADDRESS(pcidev); /* stake our claim on the iospace */ @@ -3336,9 +3343,6 @@ printk(KERN_WARNING "maestro: pci subsystem reports irq 0, this might not be correct.\n"); } - /* just to be sure */ - pci_set_master(pcidev); - card = kmalloc(sizeof(struct ess_card), GFP_KERNEL); if(card == NULL) { @@ -3407,19 +3411,6 @@ ess = &card->channels[0]; - if (pci_enable_device(pcidev)) { - printk (KERN_ERR "maestro: pci_enable_device() failed\n"); - for (i = 0; i < NR_DSPS; i++) { - struct ess_state *s = &card->channels[i]; - if (s->dev_audio != -1) - unregister_sound_dsp(s->dev_audio); - } - release_region(card->iobase, 256); - unregister_reboot_notifier(&maestro_nb); - kfree(card); - return 0; - } - /* * Ok card ready. Begin setup proper */ @@ -3432,8 +3423,8 @@ /* turn off power management unless: * - the user explicitly asks for it * or - * - we're not a 2e, lesser chipps seem to have problems. - * - we're not on our _very_ small whitelist. some implemenetations + * - we're not a 2e, lesser chips seem to have problems. + * - we're not on our _very_ small whitelist. some implementations * really dont' like the pm code, others require it. * feel free to expand this as required. */ diff -urN --exclude-from=/home/davej/.exclude linux/drivers/sound/maestro3.c linux-dj/drivers/sound/maestro3.c --- linux/drivers/sound/maestro3.c Sun Mar 4 20:08:54 2001 +++ linux-dj/drivers/sound/maestro3.c Sun Mar 4 20:16:18 2001 @@ -2600,8 +2600,8 @@ return -ENODEV; } - if (pci_enable_device(pci_dev)) - return -EIO; + ret = pci_enable_device(pci_dev); + if (ret) return ret; pci_set_master(pci_dev); diff -urN --exclude-from=/home/davej/.exclude linux/drivers/sound/sonicvibes.c linux-dj/drivers/sound/sonicvibes.c --- linux/drivers/sound/sonicvibes.c Fri Feb 9 19:30:23 2001 +++ linux-dj/drivers/sound/sonicvibes.c Sun Mar 4 20:16:18 2001 @@ -2470,6 +2470,9 @@ char *ddmaname; unsigned ddmanamelen; + i = pci_enable_device(pcidev); + if (i) return i; + if (!RSRCISIOREGION(pcidev, RESOURCE_SB) || !RSRCISIOREGION(pcidev, RESOURCE_ENH) || !RSRCISIOREGION(pcidev, RESOURCE_SYNTH) || @@ -2549,8 +2552,7 @@ printk(KERN_ERR "sv: io ports %#lx-%#lx in use\n", s->iosynth, s->iosynth+SV_EXTENT_SYNTH-1); goto err_region1; } - if (pci_enable_device(pcidev)) - goto err_irq; + /* initialize codec registers */ outb(0x80, s->ioenh + SV_CODEC_CONTROL); /* assert reset */ udelay(50); diff -urN --exclude-from=/home/davej/.exclude linux/drivers/sound/trident.c linux-dj/drivers/sound/trident.c --- linux/drivers/sound/trident.c Sun Mar 4 20:08:54 2001 +++ linux-dj/drivers/sound/trident.c Sun Mar 4 20:16:14 2001 @@ -3307,8 +3307,12 @@ { unsigned long iobase; struct trident_card *card; + int err; u8 revision; + err = pci_enable_device(pci_dev); + if (err) return err; + if (!pci_dma_supported(pci_dev, TRIDENT_DMA_MASK)) { printk(KERN_ERR "trident: architecture does not support" " 30bit PCI busmaster DMA\n"); @@ -3322,9 +3326,6 @@ iobase); return -ENODEV; } - - if (pci_enable_device(pci_dev)) - return -ENODEV; if ((card = kmalloc(sizeof(struct trident_card), GFP_KERNEL)) == NULL) { printk(KERN_ERR "trident: out of memory\n"); diff -urN --exclude-from=/home/davej/.exclude linux/drivers/sound/via82cxxx_audio.c linux-dj/drivers/sound/via82cxxx_audio.c --- linux/drivers/sound/via82cxxx_audio.c Sun Mar 4 20:08:54 2001 +++ linux-dj/drivers/sound/via82cxxx_audio.c Sun Mar 4 20:16:17 2001 @@ -3020,17 +3020,15 @@ if (printed_version++ == 0) printk (KERN_INFO "Via 686a audio driver " VIA_VERSION "\n"); + rc = pci_enable_device (pdev); + if (rc) return rc; + if (!request_region (pci_resource_start (pdev, 0), pci_resource_len (pdev, 0), VIA_MODULE_NAME)) { printk (KERN_ERR PFX "unable to obtain I/O resources, aborting\n"); rc = -EBUSY; goto err_out; - } - - if (pci_enable_device (pdev)) { - rc = -EIO; - goto err_out_none; } card = kmalloc (sizeof (*card), GFP_KERNEL);