svn commit: r322279 - head/sys/dev/efidev

Warner Losh imp at FreeBSD.org
Tue Aug 8 21:01:13 UTC 2017


Author: imp
Date: Tue Aug  8 21:01:11 2017
New Revision: 322279
URL: https://svnweb.freebsd.org/changeset/base/322279

Log:
  Turns out to be even simpler to just not create /dev/efi if we don't
  have a efi runtime.

Modified:
  head/sys/dev/efidev/efidev.c

Modified: head/sys/dev/efidev/efidev.c
==============================================================================
--- head/sys/dev/efidev/efidev.c	Tue Aug  8 20:44:16 2017	(r322278)
+++ head/sys/dev/efidev/efidev.c	Tue Aug  8 21:01:11 2017	(r322279)
@@ -39,28 +39,15 @@ __FBSDID("$FreeBSD$");
 #include <machine/efi.h>
 #include <sys/efiio.h>
 
-static d_open_t efidev_open;
 static d_ioctl_t efidev_ioctl;
 
 static struct cdevsw efi_cdevsw = {
 	.d_name = "efi",
 	.d_version = D_VERSION,
-	.d_open = efidev_open,
 	.d_ioctl = efidev_ioctl,
 };
 	
 static int
-efidev_open(struct cdev *dev __unused, int oflags __unused,
-    int devtype __unused, struct thread *td __unused)
-{
-	/*
-	 * Only return success when we have an actual runtime to call.
-	 */
-
-	return efi_rt_ok();
-}
-
-static int
 efidev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t addr,
     int flags __unused, struct thread *td __unused)
 {
@@ -195,6 +182,11 @@ efidev_modevents(module_t m, int event, void *arg __un
 
 	switch (event) {
 	case MOD_LOAD:
+		/*
+		 * If we have no efi environment, then don't create the device.
+		 */
+		if (efi_rt_ok() != 0)
+			return (0);
 		make_dev_args_init(&mda);
 		mda.mda_flags = MAKEDEV_WAITOK | MAKEDEV_CHECKNAME;
 		mda.mda_devsw = &efi_cdevsw;


More information about the svn-src-head mailing list