public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] don't create regular files in devfs
Date: Sat, 11 Jan 2003 20:56:00 +0100	[thread overview]
Message-ID: <20030111205600.A25947@lst.de> (raw)

Even more devfs creptomancy :)

When devfs is enabled the i386 microcode and mtrr drivers try to create
regular files in devfs in addition to their regular interfaces
(miscdevice and procfs).  The tools work with the normal interfaces
anyway in non-devfs systems and regular files in _dev_fs are a rather
strange concept..

Get rid of it.


--- 1.15/arch/i386/kernel/microcode.c	Thu Dec  5 21:56:34 2002
+++ edited/arch/i386/kernel/microcode.c	Sat Jan 11 16:50:00 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>
 
@@ -122,39 +121,14 @@
 	.fops	= &microcode_fops,
 };
 
-static devfs_handle_t devfs_handle;
-
 static int __init microcode_init(void)
 {
-	int error;
-
-	error = misc_register(&microcode_dev);
-	if (error)
-		printk(KERN_WARNING 
-			"microcode: can't misc_register on minor=%d\n",
-			MICROCODE_MINOR);
-
-	devfs_handle = devfs_register(NULL, "cpu/microcode",
-			DEVFS_FL_DEFAULT, 0, 0, S_IFREG | S_IRUSR | S_IWUSR, 
-			&microcode_fops, NULL);
-	if (devfs_handle == NULL && error) {
-		printk(KERN_ERR "microcode: failed to devfs_register()\n");
-		misc_deregister(&microcode_dev);
-		goto out;
-	}
-	error = 0;
-	printk(KERN_INFO 
-		"IA-32 Microcode Update Driver: v%s <tigran@veritas.com>\n", 
-		MICROCODE_VERSION);
-
-out:
-	return error;
+	return misc_register(&microcode_dev);
 }
 
 static void __exit microcode_exit(void)
 {
 	misc_deregister(&microcode_dev);
-	devfs_unregister(devfs_handle);
 	if (mc_applied)
 		kfree(mc_applied);
 	printk(KERN_INFO "IA-32 Microcode Update Driver v%s unregistered\n", 
@@ -373,7 +347,6 @@
 		ret = (ssize_t)len;
 	}
 out_fsize:
-	devfs_set_file_size(devfs_handle, mc_fsize);
 	vfree(microcode);
 out_unlock:
 	up_write(&microcode_rwsem);
@@ -389,7 +362,6 @@
 			if (mc_applied) {
 				int bytes = NR_CPUS * sizeof(struct microcode);
 
-				devfs_set_file_size(devfs_handle, 0);
 				kfree(mc_applied);
 				mc_applied = NULL;
 				printk(KERN_INFO "microcode: freed %d bytes\n", bytes);
--- 1.4/arch/i386/kernel/cpu/mtrr/if.c	Sat Dec 21 22:17:44 2002
+++ edited/arch/i386/kernel/cpu/mtrr/if.c	Sat Jan 11 16:50:35 2003
@@ -1,6 +1,5 @@
 #include <linux/init.h>
 #include <linux/proc_fs.h>
-#include <linux/devfs_fs_kernel.h>
 #include <linux/ctype.h>
 #include <linux/module.h>
 #include <linux/seq_file.h>
@@ -300,8 +299,6 @@
 
 #  endif			/*  CONFIG_PROC_FS  */
 
-static devfs_handle_t devfs_handle;
-
 char * attrib_to_str(int x)
 {
 	return (x <= 6) ? mtrr_strings[x] : "?";
@@ -337,7 +334,6 @@
 			     attrib_to_str(type), usage_table[i]);
 		}
 	}
-	devfs_set_file_size(devfs_handle, len);	
 	return 0;
 }
 
@@ -350,11 +346,6 @@
 		proc_root_mtrr->owner = THIS_MODULE;
 		proc_root_mtrr->proc_fops = &mtrr_fops;
 	}
-#endif
-#ifdef USERSPACE_INTERFACE
-	devfs_handle = devfs_register(NULL, "cpu/mtrr", DEVFS_FL_DEFAULT, 0, 0,
-				      S_IFREG | S_IRUGO | S_IWUSR,
-				      &mtrr_fops, NULL);
 #endif
 	return 0;
 }

             reply	other threads:[~2003-01-11 19:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-11 19:56 Christoph Hellwig [this message]
2003-01-12  4:07 ` [PATCH] don't create regular files in devfs Valdis.Kletnieks

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030111205600.A25947@lst.de \
    --to=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox