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]
/
fs
/
char_dev.c
diff --git
a/fs/char_dev.c
b/fs/char_dev.c
index
f3418f7
..
4e163af
100644
(file)
--- a/
fs/char_dev.c
+++ b/
fs/char_dev.c
@@
-20,7
+20,6
@@
#include <linux/kobject.h>
#include <linux/kobj_map.h>
#include <linux/cdev.h>
#include <linux/kobject.h>
#include <linux/kobj_map.h>
#include <linux/cdev.h>
-#include <linux/mutex.h>
#ifdef CONFIG_KMOD
#include <linux/kmod.h>
#ifdef CONFIG_KMOD
#include <linux/kmod.h>
@@
-28,7
+27,7
@@
static struct kobj_map *cdev_map;
static struct kobj_map *cdev_map;
-static DE
FIN
E_MUTEX(chrdevs_lock);
+static DE
CLAR
E_MUTEX(chrdevs_lock);
static struct char_device_struct {
struct char_device_struct *next;
static struct char_device_struct {
struct char_device_struct *next;
@@
-53,10
+52,10
@@
void chrdev_show(struct seq_file *f, off_t offset)
struct char_device_struct *cd;
if (offset < CHRDEV_MAJOR_HASH_SIZE) {
struct char_device_struct *cd;
if (offset < CHRDEV_MAJOR_HASH_SIZE) {
-
mutex_lock
(&chrdevs_lock);
+
down
(&chrdevs_lock);
for (cd = chrdevs[offset]; cd; cd = cd->next)
seq_printf(f, "%3d %s\n", cd->major, cd->name);
for (cd = chrdevs[offset]; cd; cd = cd->next)
seq_printf(f, "%3d %s\n", cd->major, cd->name);
-
mutex_unlock
(&chrdevs_lock);
+
up
(&chrdevs_lock);
}
}
}
}
@@
-81,11
+80,13
@@
__register_chrdev_region(unsigned int major, unsigned int baseminor,
int ret = 0;
int i;
int ret = 0;
int i;
- cd = k
z
alloc(sizeof(struct char_device_struct), GFP_KERNEL);
+ cd = k
m
alloc(sizeof(struct char_device_struct), GFP_KERNEL);
if (cd == NULL)
return ERR_PTR(-ENOMEM);
if (cd == NULL)
return ERR_PTR(-ENOMEM);
- mutex_lock(&chrdevs_lock);
+ memset(cd, 0, sizeof(struct char_device_struct));
+
+ down(&chrdevs_lock);
/* temporary */
if (major == 0) {
/* temporary */
if (major == 0) {
@@
-120,10
+121,10
@@
__register_chrdev_region(unsigned int major, unsigned int baseminor,
}
cd->next = *cp;
*cp = cd;
}
cd->next = *cp;
*cp = cd;
-
mutex_unlock
(&chrdevs_lock);
+
up
(&chrdevs_lock);
return cd;
out:
return cd;
out:
-
mutex_unlock
(&chrdevs_lock);
+
up
(&chrdevs_lock);
kfree(cd);
return ERR_PTR(ret);
}
kfree(cd);
return ERR_PTR(ret);
}
@@
-134,7
+135,7
@@
__unregister_chrdev_region(unsigned major, unsigned baseminor, int minorct)
struct char_device_struct *cd = NULL, **cp;
int i = major_to_index(major);
struct char_device_struct *cd = NULL, **cp;
int i = major_to_index(major);
-
mutex_lock
(&chrdevs_lock);
+
down
(&chrdevs_lock);
for (cp = &chrdevs[i]; *cp; cp = &(*cp)->next)
if ((*cp)->major == major &&
(*cp)->baseminor == baseminor &&
for (cp = &chrdevs[i]; *cp; cp = &(*cp)->next)
if ((*cp)->major == major &&
(*cp)->baseminor == baseminor &&
@@
-144,7
+145,7
@@
__unregister_chrdev_region(unsigned major, unsigned baseminor, int minorct)
cd = *cp;
*cp = cd->next;
}
cd = *cp;
*cp = cd->next;
}
-
mutex_unlock
(&chrdevs_lock);
+
up
(&chrdevs_lock);
return cd;
}
return cd;
}
@@
-185,7
+186,7
@@
int alloc_chrdev_region(dev_t *dev, unsigned baseminor, unsigned count,
}
int register_chrdev(unsigned int major, const char *name,
}
int register_chrdev(unsigned int major, const char *name,
-
const
struct file_operations *fops)
+ struct file_operations *fops)
{
struct char_device_struct *cd;
struct cdev *cdev;
{
struct char_device_struct *cd;
struct cdev *cdev;
@@
-341,7
+342,7
@@
static void cdev_purge(struct cdev *cdev)
* is contain the open that then fills in the correct operations
* depending on the special file...
*/
* is contain the open that then fills in the correct operations
* depending on the special file...
*/
-
const
struct file_operations def_chr_fops = {
+struct file_operations def_chr_fops = {
.open = chrdev_open,
};
.open = chrdev_open,
};
@@
-399,8
+400,9
@@
static struct kobj_type ktype_cdev_dynamic = {
struct cdev *cdev_alloc(void)
{
struct cdev *cdev_alloc(void)
{
- struct cdev *p = k
z
alloc(sizeof(struct cdev), GFP_KERNEL);
+ struct cdev *p = k
m
alloc(sizeof(struct cdev), GFP_KERNEL);
if (p) {
if (p) {
+ memset(p, 0, sizeof(struct cdev));
p->kobj.ktype = &ktype_cdev_dynamic;
INIT_LIST_HEAD(&p->list);
kobject_init(&p->kobj);
p->kobj.ktype = &ktype_cdev_dynamic;
INIT_LIST_HEAD(&p->list);
kobject_init(&p->kobj);
@@
-408,7
+410,7
@@
struct cdev *cdev_alloc(void)
return p;
}
return p;
}
-void cdev_init(struct cdev *cdev,
const
struct file_operations *fops)
+void cdev_init(struct cdev *cdev, struct file_operations *fops)
{
memset(cdev, 0, sizeof *cdev);
INIT_LIST_HEAD(&cdev->list);
{
memset(cdev, 0, sizeof *cdev);
INIT_LIST_HEAD(&cdev->list);