49
static struct pci_device_id emu_tbl[] = {
49
static const struct pci_device_id emu_tbl[] = {
51
51
{ 0x1102, 0x7002, PCI_ANY_ID, PCI_ANY_ID }, /* SB Live gameport */
52
52
{ 0x1102, 0x7003, PCI_ANY_ID, PCI_ANY_ID }, /* Audigy gameport */
60
60
static int __devinit emu_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
64
63
struct gameport *port;
66
if (pci_enable_device(pdev))
69
ioport = pci_resource_start(pdev, 0);
70
iolen = pci_resource_len(pdev, 0);
72
if (!request_region(ioport, iolen, "emu10k1-gp"))
75
66
emu = kzalloc(sizeof(struct emu), GFP_KERNEL);
76
67
port = gameport_allocate_port();
77
68
if (!emu || !port) {
78
69
printk(KERN_ERR "emu10k1-gp: Memory allocation failed\n");
79
release_region(ioport, iolen);
81
gameport_free_port(port);
74
error = pci_enable_device(pdev);
78
emu->io = pci_resource_start(pdev, 0);
79
emu->size = pci_resource_len(pdev, 0);
88
82
emu->gameport = port;
90
84
gameport_set_name(port, "EMU10K1");
91
85
gameport_set_phys(port, "pci%s/gameport0", pci_name(pdev));
92
86
port->dev.parent = &pdev->dev;
89
if (!request_region(emu->io, emu->size, "emu10k1-gp")) {
90
printk(KERN_ERR "emu10k1-gp: unable to grab region 0x%x-0x%x\n",
91
emu->io, emu->io + emu->size - 1);
93
goto err_out_disable_dev;
95
96
pci_set_drvdata(pdev, emu);
97
98
gameport_register_port(port);
103
pci_disable_device(pdev);
105
gameport_free_port(port);
102
110
static void __devexit emu_remove(struct pci_dev *pdev)
106
114
gameport_unregister_port(emu->gameport);
107
115
release_region(emu->io, emu->size);
118
pci_disable_device(pdev);
111
121
static struct pci_driver emu_driver = {