patch-2.4.0-test11 linux/drivers/char/joystick/ns558.c
Next file: linux/drivers/char/joystick/sidewinder.c
Previous file: linux/drivers/char/joystick/iforce.c
Back to the patch index
Back to the overall index
- Lines: 63
- Date:
Fri Nov 17 16:52:23 2000
- Orig file:
v2.4.0-test10/linux/drivers/char/joystick/ns558.c
- Orig date:
Tue Oct 31 12:42:26 2000
diff -u --recursive --new-file v2.4.0-test10/linux/drivers/char/joystick/ns558.c linux/drivers/char/joystick/ns558.c
@@ -58,7 +58,7 @@
};
static struct ns558 *ns558;
-static int have_pci_devices;
+static int ns558_pci;
/*
* ns558_isa_probe() tries to find an isa gameport at the
@@ -188,12 +188,10 @@
}
memset(port, 0, sizeof(struct ns558));
- port->next = ns558;
port->type = NS558_PCI;
port->gameport.io = ioport;
port->gameport.size = iolen;
port->dev = pdev;
- ns558 = port;
pdev->driver_data = port;
@@ -316,9 +314,7 @@
* it is the least-invasive probe.
*/
- i = pci_module_init(&ns558_pci_driver);
- if (i == 0)
- have_pci_devices = 1;
+ ns558_pci = !pci_module_init(&ns558_pci_driver);
/*
* Probe for ISA ports.
@@ -339,12 +335,12 @@
}
#endif
- return ns558 ? 0 : -ENODEV;
+ return (ns558 || ns558_pci) ? 0 : -ENODEV;
}
void __exit ns558_exit(void)
{
- struct ns558 *port = ns558;
+ struct ns558 *next, *port = ns558;
while (port) {
gameport_unregister_port(&port->gameport);
@@ -365,10 +361,12 @@
break;
}
- port = port->next;
+ next = port->next;
+ kfree(port);
+ port = next;
}
- if (have_pci_devices)
+ if (ns558_pci)
pci_unregister_driver(&ns558_pci_driver);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)