linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] use .devfs_name in struct miscdevice
@ 2003-04-30 15:33 Christoph Hellwig
  2003-04-30 18:59 ` H. Peter Anvin
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2003-04-30 15:33 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel

There's three drivers in the tree that workaround the suboptimal
devfs name choice of the misc device layer (/dev/misc/<foo>) using
devfs_mk_symlink.    Switch them to set miscdev.devfs_name instead
to get the right name from the very beginning.



--- 1.18/arch/i386/kernel/microcode.c	Thu Mar 27 11:24:37 2003
+++ edited/arch/i386/kernel/microcode.c	Wed Apr 30 16:19:41 2003
@@ -65,7 +65,6 @@
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 #include <linux/miscdevice.h>
-#include <linux/devfs_fs_kernel.h>
 #include <linux/spinlock.h>
 #include <linux/mm.h>
 
@@ -116,9 +115,10 @@
 };
 
 static struct miscdevice microcode_dev = {
-	.minor = MICROCODE_MINOR,
-	.name	= "microcode",
-	.fops	= &microcode_fops,
+	.minor		= MICROCODE_MINOR,
+	.name		= "microcode",
+	.devfs_name	= "cpu/microcode",
+	.fops		= &microcode_fops,
 };
 
 static int __init microcode_init(void)
@@ -127,26 +127,17 @@
 
 	error = misc_register(&microcode_dev);
 	if (error)
-		goto fail;
-	error = devfs_mk_symlink("cpu/microcode", "../misc/microcode");
-	if (error)
-		goto fail_deregister;
+		return error;
 
 	printk(KERN_INFO 
 		"IA-32 Microcode Update Driver: v%s <tigran@veritas.com>\n", 
 		MICROCODE_VERSION);
 	return 0;
-
-fail_deregister:
-	misc_deregister(&microcode_dev);
-fail:
-	return error;
 }
 
 static void __exit microcode_exit(void)
 {
 	misc_deregister(&microcode_dev);
-	devfs_remove("cpu/microcode");
 	kfree(mc_applied);
 	printk(KERN_INFO "IA-32 Microcode Update Driver v%s unregistered\n", 
 			MICROCODE_VERSION);
--- 1.18/drivers/md/dm-ioctl.c	Sat Apr 26 00:16:28 2003
+++ edited/drivers/md/dm-ioctl.c	Wed Apr 30 16:20:30 2003
@@ -1084,9 +1084,10 @@
 };
 
 static struct miscdevice _dm_misc = {
-	.minor = MISC_DYNAMIC_MINOR,
-	.name  = DM_NAME,
-	.fops  = &_ctl_fops
+	.minor		= MISC_DYNAMIC_MINOR,
+	.name		= DM_NAME,
+	.devfs_name	= "mapper/control",
+	.fops		= &_ctl_fops
 };
 
 /*
@@ -1107,18 +1108,12 @@
 		return r;
 	}
 
-	r = devfs_mk_symlink(DM_DIR "/control", "../misc/" DM_NAME);
-	if (r) {
-		DMERR("devfs_mk_symlink failed for control device");
-		goto failed;
-	}
 	DMINFO("%d.%d.%d%s initialised: %s", DM_VERSION_MAJOR,
 	       DM_VERSION_MINOR, DM_VERSION_PATCHLEVEL, DM_VERSION_EXTRA,
 	       DM_DRIVER_EMAIL);
 	return 0;
 
       failed:
-	devfs_remove(DM_DIR "/control");
 	if (misc_deregister(&_dm_misc) < 0)
 		DMERR("misc_deregister failed for control device");
 	dm_hash_exit();
@@ -1127,7 +1122,6 @@
 
 void dm_interface_exit(void)
 {
-	devfs_remove(DM_DIR "/control");
 	if (misc_deregister(&_dm_misc) < 0)
 		DMERR("misc_deregister failed for control device");
 	dm_hash_exit();
--- 1.9/drivers/media/radio/miropcm20-rds.c	Sat Mar 22 16:37:12 2003
+++ edited/drivers/media/radio/miropcm20-rds.c	Wed Apr 30 16:21:08 2003
@@ -13,7 +13,6 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/miscdevice.h>
-#include <linux/devfs_fs_kernel.h>
 #include <asm/uaccess.h>
 #include "miropcm20-rds-core.h"
 
@@ -114,28 +113,17 @@
 static struct miscdevice rds_miscdev = {
 	.minor		= MISC_DYNAMIC_MINOR,
 	.name		= "radiotext",
+	.devfs_name	= "v4l/rds/radiotext",
 	.fops		= &rds_fops,
 };
 
 static int __init miropcm20_rds_init(void)
 {
-	int error;
-
-	error = misc_register(&rds_miscdev);
-	if (error)
-		return error;
-
-	error = devfs_mk_symlink("v4l/rds/radiotext",
-				 "../misc/radiotext");
-	if (error)
-		misc_deregister(&rds_miscdev);
-
-	return error;
+	return misc_register(&rds_miscdev);
 }
 
 static void __exit miropcm20_rds_cleanup(void)
 {
-	devfs_remove("v4l/rds/radiotext");
 	misc_deregister(&rds_miscdev);
 }
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] use .devfs_name in struct miscdevice
  2003-04-30 15:33 [PATCH] use .devfs_name in struct miscdevice Christoph Hellwig
@ 2003-04-30 18:59 ` H. Peter Anvin
  0 siblings, 0 replies; 2+ messages in thread
From: H. Peter Anvin @ 2003-04-30 18:59 UTC (permalink / raw)
  To: linux-kernel

Followup to:  <20030430173315.A4057@lst.de>
By author:    Christoph Hellwig <hch@lst.de>
In newsgroup: linux.dev.kernel
>
> There's three drivers in the tree that workaround the suboptimal
> devfs name choice of the misc device layer (/dev/misc/<foo>) using
> devfs_mk_symlink.    Switch them to set miscdev.devfs_name instead
> to get the right name from the very beginning.
> 

Understatement of the week :)

	-hpa
-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
Architectures needed: ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-04-30 18:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-30 15:33 [PATCH] use .devfs_name in struct miscdevice Christoph Hellwig
2003-04-30 18:59 ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).