From 9285a87efdb7eb1f8829947b57807c4db5b90cf4 Mon Sep 17 00:00:00 2001
From: Poul-Henning Kamp <phk@FreeBSD.org>
Date: Sun, 2 Mar 2003 13:35:30 +0000
Subject: [PATCH] NODEVFS cleanup:

Replace devfs_{create,destroy} hooks with direct function calls.
---
 sys/fs/devfs/devfs_devs.c |  7 +++----
 sys/kern/kern_conf.c      | 12 +++---------
 sys/sys/conf.h            |  8 ++------
 sys/sys/linedisc.h        |  8 ++------
 4 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c
index 95f2e2ee14af..e5e6ffb2cff3 100644
--- a/sys/fs/devfs/devfs_devs.c
+++ b/sys/fs/devfs/devfs_devs.c
@@ -377,7 +377,7 @@ devfs_populate(struct devfs_mount *dm)
 	return (0);
 }
 
-static void
+void
 devfs_create(dev_t dev)
 {
 	int ino, i, *ip;
@@ -426,7 +426,7 @@ devfs_create(dev_t dev)
 		devfs_attemptoverflow(0);
 }
 
-static void
+void
 devfs_destroy(dev_t dev)
 {
 	int ino, i;
@@ -447,8 +447,7 @@ devfs_destroy(dev_t dev)
 static void
 devfs_init(void *junk)
 {
-	devfs_create_hook = devfs_create;
-	devfs_destroy_hook = devfs_destroy;
+
 	devfs_rules_init();
 }
 
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index f0a13c18683c..3d96ce485270 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -62,9 +62,6 @@ static LIST_HEAD(, cdev) dev_hash[DEVT_HASH];
 
 static LIST_HEAD(, cdev) dev_free;
 
-devfs_create_t *devfs_create_hook;
-devfs_destroy_t *devfs_destroy_hook;
-
 static int ready_for_devs;
 
 static int free_devt;
@@ -332,8 +329,7 @@ make_dev(struct cdevsw *devsw, int minor, uid_t uid, gid_t gid, int perms, const
 	dev->si_mode = perms;
 	dev->si_flags |= SI_NAMED;
 
-	if (devfs_create_hook)
-		devfs_create_hook(dev);
+	devfs_create(dev);
 	return (dev);
 }
 
@@ -378,8 +374,7 @@ make_dev_alias(dev_t pdev, const char *fmt, ...)
 	}
 	va_end(ap);
 
-	if (devfs_create_hook)
-		devfs_create_hook(dev);
+	devfs_create(dev);
 	return (dev);
 }
 
@@ -407,8 +402,7 @@ destroy_dev(dev_t dev)
 		return;
 	}
 		
-	if (devfs_destroy_hook)
-		devfs_destroy_hook(dev);
+	devfs_destroy(dev);
 	if (dev->si_flags & SI_CHILD) {
 		LIST_REMOVE(dev, si_siblings);
 		dev->si_flags &= ~SI_CHILD;
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index c9791e6c6d02..0e001ceab51c 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -324,12 +324,8 @@ int	unit2minor(int _unit);
 void	setconf(void);
 dev_t	getdiskbyname(char *_name);
 
-/* This is type of the function DEVFS uses to hook into the kernel with */
-typedef void devfs_create_t(dev_t dev);
-typedef void devfs_destroy_t(dev_t dev);
-
-extern devfs_create_t *devfs_create_hook;
-extern devfs_destroy_t *devfs_destroy_hook;
+void devfs_create(dev_t dev);
+void devfs_destroy(dev_t dev);
 
 #define		UID_ROOT	0
 #define		UID_BIN		3
diff --git a/sys/sys/linedisc.h b/sys/sys/linedisc.h
index c9791e6c6d02..0e001ceab51c 100644
--- a/sys/sys/linedisc.h
+++ b/sys/sys/linedisc.h
@@ -324,12 +324,8 @@ int	unit2minor(int _unit);
 void	setconf(void);
 dev_t	getdiskbyname(char *_name);
 
-/* This is type of the function DEVFS uses to hook into the kernel with */
-typedef void devfs_create_t(dev_t dev);
-typedef void devfs_destroy_t(dev_t dev);
-
-extern devfs_create_t *devfs_create_hook;
-extern devfs_destroy_t *devfs_destroy_hook;
+void devfs_create(dev_t dev);
+void devfs_destroy(dev_t dev);
 
 #define		UID_ROOT	0
 #define		UID_BIN		3