67 |
vortex_t *vortex = snd_magic_cast(vortex_t, device->device_data, |
vortex_t *vortex = snd_magic_cast(vortex_t, device->device_data, |
68 |
return -ENXIO); |
return -ENXIO); |
69 |
|
|
|
//FIXME: we do stuff here without checking |
|
70 |
vortex_gameport_unregister(vortex); |
vortex_gameport_unregister(vortex); |
71 |
vortex_core_shutdown(vortex); |
vortex_core_shutdown(vortex); |
72 |
// Take down PCI interface. |
// Take down PCI interface. |
100 |
} |
} |
101 |
pci_set_dma_mask(pci, VORTEX_DMA_MASK); |
pci_set_dma_mask(pci, VORTEX_DMA_MASK); |
102 |
|
|
|
if (pci->irq == 0) |
|
|
return -ENODEV; |
|
|
|
|
103 |
chip = snd_magic_kcalloc(vortex_t, 0, GFP_KERNEL); |
chip = snd_magic_kcalloc(vortex_t, 0, GFP_KERNEL); |
104 |
if (chip == NULL) |
if (chip == NULL) |
105 |
return -ENOMEM; |
return -ENOMEM; |
115 |
chip->irq = -1; |
chip->irq = -1; |
116 |
|
|
117 |
// (1) PCI resource allocation |
// (1) PCI resource allocation |
118 |
// Get MMIO area. |
// Get MMIO area |
119 |
if (!request_mem_region(pci_resource_start(pci, 0), |
// |
120 |
pci_resource_len(pci, 0), CARD_NAME_SHORT)) { |
if ((err = pci_request_regions(pci, CARD_NAME_SHORT)) != 0) |
|
printk(KERN_ERR "cannot allocate mmio area.\n"); |
|
|
err = -EBUSY; |
|
|
goto regions_out; |
|
|
} |
|
|
// Get I/O ports. |
|
|
if (check_region(pci_resource_start(pci, 1), 8)) { |
|
|
printk(KERN_ERR "cannot allocate I/O port0.\n"); |
|
|
err = -EBUSY; |
|
121 |
goto regions_out; |
goto regions_out; |
122 |
} |
|
|
chip->port0 = request_region(pci_resource_start(pci, 1), 8, CARD_NAME_SHORT); |
|
|
|
|
|
if (check_region(pci_resource_start(pci, 2), 8)) { |
|
|
printk(KERN_ERR "cannot allocate the I/O port1.\n"); |
|
|
err = -EBUSY; |
|
|
goto regions_out; |
|
|
} |
|
|
chip->port1 = request_region(pci_resource_start(pci, 2), 8, CARD_NAME_SHORT); |
|
|
|
|
|
|
|
123 |
//chip->mmio = ioremap_nocache(pci_resource_start(pci,0), pci_resource_len(pci,0)); |
//chip->mmio = ioremap_nocache(pci_resource_start(pci,0), pci_resource_len(pci,0)); |
124 |
chip->mmio = ioremap(pci_resource_start(pci,0), pci_resource_len(pci,0)); |
chip->mmio = ioremap(pci_resource_start(pci,0), pci_resource_len(pci,0)); |
125 |
if (!chip->mmio) { |
if (!chip->mmio) { |
126 |
printk(KERN_ERR "MMIO area remap failed.\n"); |
printk(KERN_ERR "MMIO area remap failed.\n"); |
127 |
err = -EBUSY; |
err = -ENOMEM; |
128 |
goto ioremap_out; |
goto ioremap_out; |
129 |
} |
} |
130 |
|
|
133 |
* interupts that we do not handle properly and make a mess of things */ |
* interupts that we do not handle properly and make a mess of things */ |
134 |
vortex_core_init(chip); |
vortex_core_init(chip); |
135 |
|
|
136 |
if (request_irq(pci->irq, vortex_interrupt, SA_INTERRUPT | SA_SHIRQ, |
if ((err = request_irq(pci->irq, vortex_interrupt, SA_INTERRUPT | SA_SHIRQ, |
137 |
CARD_NAME_SHORT, (void *) chip)) { |
CARD_NAME_SHORT, (void *) chip)) != 0) { |
138 |
printk(KERN_ERR "cannot grab irq\n"); |
printk(KERN_ERR "cannot grab irq\n"); |
|
err = -EBUSY; |
|
139 |
goto irq_out; |
goto irq_out; |
140 |
} |
} |
141 |
chip->irq = pci->irq; |
chip->irq = pci->irq; |