summaryrefslogtreecommitdiff
path: root/device/dev_lookup.c
diff options
context:
space:
mode:
Diffstat (limited to 'device/dev_lookup.c')
-rw-r--r--device/dev_lookup.c63
1 files changed, 26 insertions, 37 deletions
diff --git a/device/dev_lookup.c b/device/dev_lookup.c
index 98a2d02c..a80830c2 100644
--- a/device/dev_lookup.c
+++ b/device/dev_lookup.c
@@ -43,6 +43,7 @@
#include <kern/ipc_kobject.h>
#include <device/device_emul.h>
+#include <device/ds_routines.h>
/*
* Device structure routines: reference counting, port->device.
@@ -70,9 +71,9 @@ struct kmem_cache dev_hdr_cache;
*/
void
dev_number_enter(device)
- register mach_device_t device;
+ const mach_device_t device;
{
- register queue_t q;
+ queue_t q;
q = &dev_number_hash_table[DEV_NUMBER_HASH(device->dev_number)];
queue_enter(q, device, mach_device_t, number_chain);
@@ -84,9 +85,9 @@ dev_number_enter(device)
*/
void
dev_number_remove(device)
- register mach_device_t device;
+ const mach_device_t device;
{
- register queue_t q;
+ queue_t q;
q = &dev_number_hash_table[DEV_NUMBER_HASH(device->dev_number)];
queue_remove(q, device, mach_device_t, number_chain);
@@ -98,11 +99,11 @@ dev_number_remove(device)
*/
mach_device_t
dev_number_lookup(ops, devnum)
- dev_ops_t ops;
+ const dev_ops_t ops;
int devnum;
{
- register queue_t q;
- register mach_device_t device;
+ queue_t q;
+ mach_device_t device;
q = &dev_number_hash_table[DEV_NUMBER_HASH(devnum)];
queue_iterate(q, device, mach_device_t, number_chain) {
@@ -119,13 +120,12 @@ dev_number_lookup(ops, devnum)
* table.
*/
mach_device_t
-device_lookup(name)
- char * name;
+device_lookup(char *name)
{
dev_ops_t dev_ops;
int dev_minor;
- register mach_device_t device;
- register mach_device_t new_device;
+ mach_device_t device;
+ mach_device_t new_device;
/*
* Get the device and unit number from the name.
@@ -197,8 +197,7 @@ device_lookup(name)
* Add a reference to the device.
*/
void
-mach_device_reference(device)
- register mach_device_t device;
+mach_device_reference(mach_device_t device)
{
simple_lock(&device->ref_lock);
device->ref_count++;
@@ -210,8 +209,7 @@ mach_device_reference(device)
* structure if no references are left.
*/
void
-mach_device_deallocate(device)
- register mach_device_t device;
+mach_device_deallocate(mach_device_t device)
{
simple_lock(&device->ref_lock);
if (--device->ref_count > 0) {
@@ -242,15 +240,12 @@ mach_device_deallocate(device)
/*
* port-to-device lookup routines.
*/
-decl_simple_lock_data(,
- dev_port_lock)
/*
* Enter a port-to-device mapping.
*/
void
-dev_port_enter(device)
- register mach_device_t device;
+dev_port_enter(mach_device_t device)
{
mach_device_reference(device);
@@ -268,8 +263,7 @@ dev_port_enter(device)
* Remove a port-to-device mapping.
*/
void
-dev_port_remove(device)
- register mach_device_t device;
+dev_port_remove(mach_device_t device)
{
ipc_kobject_set(device->port, IKO_NULL, IKOT_NONE);
mach_device_deallocate(device);
@@ -280,10 +274,9 @@ dev_port_remove(device)
* Doesn't consume the naked send right; produces a device reference.
*/
device_t
-dev_port_lookup(port)
- ipc_port_t port;
+dev_port_lookup(ipc_port_t port)
{
- register device_t device;
+ device_t device;
if (!IP_VALID(port))
return (DEVICE_NULL);
@@ -307,7 +300,7 @@ dev_port_lookup(port)
*/
ipc_port_t
convert_device_to_port(device)
- register device_t device;
+ const device_t device;
{
if (device == DEVICE_NULL)
return IP_NULL;
@@ -322,13 +315,13 @@ convert_device_to_port(device)
* return FALSE.
*/
boolean_t
-dev_map(routine, port)
- boolean_t (*routine)();
- mach_port_t port;
+dev_map(
+ boolean_t (*routine)(),
+ mach_port_t port)
{
- register int i;
- register queue_t q;
- register mach_device_t dev, prev_dev;
+ int i;
+ queue_t q;
+ mach_device_t dev, prev_dev;
for (i = 0, q = &dev_number_hash_table[0];
i < NDEVHASH;
@@ -362,20 +355,16 @@ dev_map(routine, port)
/*
* Initialization
*/
-#define NDEVICES 256
-
void
-dev_lookup_init()
+dev_lookup_init(void)
{
- register int i;
+ int i;
simple_lock_init(&dev_number_lock);
for (i = 0; i < NDEVHASH; i++)
queue_init(&dev_number_hash_table[i]);
- simple_lock_init(&dev_port_lock);
-
kmem_cache_init(&dev_hdr_cache, "mach_device",
sizeof(struct mach_device), 0, NULL, NULL, NULL, 0);
}