Commit 1ab933b5 authored by Christoph Hellwig's avatar Christoph Hellwig

[PATCH] fix devfs support in i386 microcode driver

register a /dev/cpu/microcode symlink instead of a regular file
with the same name - regular file support is gone in devfs.
parent c275257c
...@@ -107,7 +107,6 @@ static unsigned int microcode_num; /* number of chunks in microcode */ ...@@ -107,7 +107,6 @@ static unsigned int microcode_num; /* number of chunks in microcode */
static char *mc_applied; /* array of applied microcode blocks */ static char *mc_applied; /* array of applied microcode blocks */
static unsigned int mc_fsize; /* file size of /dev/cpu/microcode */ static unsigned int mc_fsize; /* file size of /dev/cpu/microcode */
/* we share file_operations between misc and devfs mechanisms */
static struct file_operations microcode_fops = { static struct file_operations microcode_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.read = microcode_read, .read = microcode_read,
...@@ -122,41 +121,33 @@ static struct miscdevice microcode_dev = { ...@@ -122,41 +121,33 @@ static struct miscdevice microcode_dev = {
.fops = &microcode_fops, .fops = &microcode_fops,
}; };
static devfs_handle_t devfs_handle;
static int __init microcode_init(void) static int __init microcode_init(void)
{ {
int error; int error;
error = misc_register(&microcode_dev); error = misc_register(&microcode_dev);
if (error) if (error)
printk(KERN_WARNING goto fail;
"microcode: can't misc_register on minor=%d\n", error = devfs_mk_symlink("cpu/microcode", "../misc/microcode");
MICROCODE_MINOR); if (error)
goto fail_deregister;
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 printk(KERN_INFO
"IA-32 Microcode Update Driver: v%s <tigran@veritas.com>\n", "IA-32 Microcode Update Driver: v%s <tigran@veritas.com>\n",
MICROCODE_VERSION); MICROCODE_VERSION);
return 0;
out: fail_deregister:
misc_deregister(&microcode_dev);
fail:
return error; return error;
} }
static void __exit microcode_exit(void) static void __exit microcode_exit(void)
{ {
misc_deregister(&microcode_dev); misc_deregister(&microcode_dev);
devfs_unregister(devfs_handle); devfs_remove("cpu/microcode");
if (mc_applied) kfree(mc_applied);
kfree(mc_applied);
printk(KERN_INFO "IA-32 Microcode Update Driver v%s unregistered\n", printk(KERN_INFO "IA-32 Microcode Update Driver v%s unregistered\n",
MICROCODE_VERSION); MICROCODE_VERSION);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment