#include <linux/module.h>
#include <linux/ioport.h>
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/gameport.h>
#include <linux/slab.h>
struct emu {
struct pci_dev *dev;
- struct gameport gameport;
+ struct gameport *gameport;
+ int io;
int size;
- char phys[32];
};
static struct pci_device_id emu_tbl[] = {
+
{ 0x1102, 0x7002, PCI_ANY_ID, PCI_ANY_ID }, /* SB Live gameport */
{ 0x1102, 0x7003, PCI_ANY_ID, PCI_ANY_ID }, /* Audigy gameport */
+ { 0x1102, 0x7004, PCI_ANY_ID, PCI_ANY_ID }, /* Dell SB Live */
+ { 0x1102, 0x7005, PCI_ANY_ID, PCI_ANY_ID }, /* Audigy LS gameport */
{ 0, }
};
{
int ioport, iolen;
struct emu *emu;
+ struct gameport *port;
if (pci_enable_device(pdev))
return -EBUSY;
if (!request_region(ioport, iolen, "emu10k1-gp"))
return -EBUSY;
- if (!(emu = kmalloc(sizeof(struct emu), GFP_KERNEL))) {
- printk(KERN_ERR "emu10k1-gp: Memory allocation failed.\n");
+ emu = kzalloc(sizeof(struct emu), GFP_KERNEL);
+ port = gameport_allocate_port();
+ if (!emu || !port) {
+ printk(KERN_ERR "emu10k1-gp: Memory allocation failed\n");
release_region(ioport, iolen);
+ kfree(emu);
+ gameport_free_port(port);
return -ENOMEM;
}
- memset(emu, 0, sizeof(struct emu));
-
- sprintf(emu->phys, "pci%s/gameport0", pci_name(pdev));
+ emu->io = ioport;
emu->size = iolen;
emu->dev = pdev;
+ emu->gameport = port;
- emu->gameport.io = ioport;
- emu->gameport.name = pci_name(pdev);
- emu->gameport.phys = emu->phys;
- emu->gameport.id.bustype = BUS_PCI;
- emu->gameport.id.vendor = pdev->vendor;
- emu->gameport.id.product = pdev->device;
+ gameport_set_name(port, "EMU10K1");
+ gameport_set_phys(port, "pci%s/gameport0", pci_name(pdev));
+ port->dev.parent = &pdev->dev;
+ port->io = ioport;
pci_set_drvdata(pdev, emu);
- gameport_register_port(&emu->gameport);
-
- printk(KERN_INFO "gameport: pci%s speed %d kHz\n",
- pci_name(pdev), emu->gameport.speed);
+ gameport_register_port(port);
return 0;
}
static void __devexit emu_remove(struct pci_dev *pdev)
{
struct emu *emu = pci_get_drvdata(pdev);
- gameport_unregister_port(&emu->gameport);
- release_region(emu->gameport.io, emu->size);
+
+ gameport_unregister_port(emu->gameport);
+ release_region(emu->io, emu->size);
kfree(emu);
}
static struct pci_driver emu_driver = {
- .name = "Emu10k1 Gameport",
+ .name = "Emu10k1_gameport",
.id_table = emu_tbl,
.probe = emu_probe,
.remove = __devexit_p(emu_remove),
};
-int __init emu_init(void)
+static int __init emu_init(void)
{
- return pci_module_init(&emu_driver);
+ return pci_register_driver(&emu_driver);
}
-void __exit emu_exit(void)
+static void __exit emu_exit(void)
{
pci_unregister_driver(&emu_driver);
}