Commit 9403fc17 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds

[PATCH] use .devfs_name in struct miscdevice

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.
parent da7ad6cc
...@@ -65,7 +65,6 @@ ...@@ -65,7 +65,6 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/mm.h> #include <linux/mm.h>
...@@ -116,9 +115,10 @@ static struct file_operations microcode_fops = { ...@@ -116,9 +115,10 @@ static struct file_operations microcode_fops = {
}; };
static struct miscdevice microcode_dev = { static struct miscdevice microcode_dev = {
.minor = MICROCODE_MINOR, .minor = MICROCODE_MINOR,
.name = "microcode", .name = "microcode",
.fops = &microcode_fops, .devfs_name = "cpu/microcode",
.fops = &microcode_fops,
}; };
static int __init microcode_init(void) static int __init microcode_init(void)
...@@ -127,26 +127,17 @@ static int __init microcode_init(void) ...@@ -127,26 +127,17 @@ static int __init microcode_init(void)
error = misc_register(&microcode_dev); error = misc_register(&microcode_dev);
if (error) if (error)
goto fail; return error;
error = devfs_mk_symlink("cpu/microcode", "../misc/microcode");
if (error)
goto fail_deregister;
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; return 0;
fail_deregister:
misc_deregister(&microcode_dev);
fail:
return error;
} }
static void __exit microcode_exit(void) static void __exit microcode_exit(void)
{ {
misc_deregister(&microcode_dev); misc_deregister(&microcode_dev);
devfs_remove("cpu/microcode");
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);
......
...@@ -1084,9 +1084,10 @@ static struct file_operations _ctl_fops = { ...@@ -1084,9 +1084,10 @@ static struct file_operations _ctl_fops = {
}; };
static struct miscdevice _dm_misc = { static struct miscdevice _dm_misc = {
.minor = MISC_DYNAMIC_MINOR, .minor = MISC_DYNAMIC_MINOR,
.name = DM_NAME, .name = DM_NAME,
.fops = &_ctl_fops .devfs_name = "mapper/control",
.fops = &_ctl_fops
}; };
/* /*
...@@ -1107,18 +1108,12 @@ int __init dm_interface_init(void) ...@@ -1107,18 +1108,12 @@ int __init dm_interface_init(void)
return r; 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, DMINFO("%d.%d.%d%s initialised: %s", DM_VERSION_MAJOR,
DM_VERSION_MINOR, DM_VERSION_PATCHLEVEL, DM_VERSION_EXTRA, DM_VERSION_MINOR, DM_VERSION_PATCHLEVEL, DM_VERSION_EXTRA,
DM_DRIVER_EMAIL); DM_DRIVER_EMAIL);
return 0; return 0;
failed: failed:
devfs_remove(DM_DIR "/control");
if (misc_deregister(&_dm_misc) < 0) if (misc_deregister(&_dm_misc) < 0)
DMERR("misc_deregister failed for control device"); DMERR("misc_deregister failed for control device");
dm_hash_exit(); dm_hash_exit();
...@@ -1127,7 +1122,6 @@ int __init dm_interface_init(void) ...@@ -1127,7 +1122,6 @@ int __init dm_interface_init(void)
void dm_interface_exit(void) void dm_interface_exit(void)
{ {
devfs_remove(DM_DIR "/control");
if (misc_deregister(&_dm_misc) < 0) if (misc_deregister(&_dm_misc) < 0)
DMERR("misc_deregister failed for control device"); DMERR("misc_deregister failed for control device");
dm_hash_exit(); dm_hash_exit();
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/devfs_fs_kernel.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include "miropcm20-rds-core.h" #include "miropcm20-rds-core.h"
...@@ -114,28 +113,17 @@ static struct file_operations rds_fops = { ...@@ -114,28 +113,17 @@ static struct file_operations rds_fops = {
static struct miscdevice rds_miscdev = { static struct miscdevice rds_miscdev = {
.minor = MISC_DYNAMIC_MINOR, .minor = MISC_DYNAMIC_MINOR,
.name = "radiotext", .name = "radiotext",
.devfs_name = "v4l/rds/radiotext",
.fops = &rds_fops, .fops = &rds_fops,
}; };
static int __init miropcm20_rds_init(void) static int __init miropcm20_rds_init(void)
{ {
int error; return misc_register(&rds_miscdev);
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;
} }
static void __exit miropcm20_rds_cleanup(void) static void __exit miropcm20_rds_cleanup(void)
{ {
devfs_remove("v4l/rds/radiotext");
misc_deregister(&rds_miscdev); misc_deregister(&rds_miscdev);
} }
......
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