git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git]
/
drivers
/
char
/
misc.c
diff --git
a/drivers/char/misc.c
b/drivers/char/misc.c
index
62ebe09
..
3e4c041
100644
(file)
--- a/
drivers/char/misc.c
+++ b/
drivers/char/misc.c
@@
-34,6
+34,7
@@
*/
#include <linux/module.h>
*/
#include <linux/module.h>
+#include <linux/config.h>
#include <linux/fs.h>
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/errno.h>
@@
-43,6
+44,7
@@
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
+#include <linux/devfs_fs_kernel.h>
#include <linux/stat.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/stat.h>
#include <linux/init.h>
#include <linux/device.h>
@@
-113,7
+115,7
@@
static int misc_seq_open(struct inode *inode, struct file *file)
return seq_open(file, &misc_seq_ops);
}
return seq_open(file, &misc_seq_ops);
}
-static
const
struct file_operations misc_proc_fops = {
+static struct file_operations misc_proc_fops = {
.owner = THIS_MODULE,
.open = misc_seq_open,
.read = seq_read,
.owner = THIS_MODULE,
.open = misc_seq_open,
.read = seq_read,
@@
-127,7
+129,7
@@
static int misc_open(struct inode * inode, struct file * file)
int minor = iminor(inode);
struct miscdevice *c;
int err = -ENODEV;
int minor = iminor(inode);
struct miscdevice *c;
int err = -ENODEV;
-
const
struct file_operations *old_fops, *new_fops = NULL;
+ struct file_operations *old_fops, *new_fops = NULL;
down(&misc_sem);
down(&misc_sem);
@@
-176,7
+178,7
@@
fail:
*/
static struct class *misc_class;
*/
static struct class *misc_class;
-static
const
struct file_operations misc_fops = {
+static struct file_operations misc_fops = {
.owner = THIS_MODULE,
.open = misc_open,
};
.owner = THIS_MODULE,
.open = misc_open,
};
@@
-202,7
+204,7
@@
int misc_register(struct miscdevice * misc)
{
struct miscdevice *c;
dev_t dev;
{
struct miscdevice *c;
dev_t dev;
- int err
= 0
;
+ int err;
down(&misc_sem);
list_for_each_entry(c, &misc_list, list) {
down(&misc_sem);
list_for_each_entry(c, &misc_list, list) {
@@
-226,6
+228,10
@@
int misc_register(struct miscdevice * misc)
if (misc->minor < DYNAMIC_MINORS)
misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7);
if (misc->minor < DYNAMIC_MINORS)
misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7);
+ if (misc->devfs_name[0] == '\0') {
+ snprintf(misc->devfs_name, sizeof(misc->devfs_name),
+ "misc/%s", misc->name);
+ }
dev = MKDEV(MISC_MAJOR, misc->minor);
misc->class = class_device_create(misc_class, NULL, dev, misc->dev,
dev = MKDEV(MISC_MAJOR, misc->minor);
misc->class = class_device_create(misc_class, NULL, dev, misc->dev,
@@
-235,6
+241,13
@@
int misc_register(struct miscdevice * misc)
goto out;
}
goto out;
}
+ err = devfs_mk_cdev(dev, S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP,
+ misc->devfs_name);
+ if (err) {
+ class_device_destroy(misc_class, dev);
+ goto out;
+ }
+
/*
* Add it to the front, so that later devices can "override"
* earlier defaults
/*
* Add it to the front, so that later devices can "override"
* earlier defaults
@@
-265,6
+278,7
@@
int misc_deregister(struct miscdevice * misc)
down(&misc_sem);
list_del(&misc->list);
class_device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor));
down(&misc_sem);
list_del(&misc->list);
class_device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor));
+ devfs_remove(misc->devfs_name);
if (i < DYNAMIC_MINORS && i>0) {
misc_minors[i>>3] &= ~(1 << (misc->minor & 7));
}
if (i < DYNAMIC_MINORS && i>0) {
misc_minors[i>>3] &= ~(1 << (misc->minor & 7));
}