Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 334677
b: refs/heads/master
c: 2f0157f
h: refs/heads/master
i:
  334675: 6aa9745
v: v3
  • Loading branch information
Dmitry Torokhov authored and Linus Torvalds committed Oct 22, 2012
1 parent 6376871 commit 52bad11
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6f0c0580b70c89094b3422ba81118c7b959c7556
refs/heads/master: 2f0157f13f42800aa3d9017ebb0fb80a65f7b2de
18 changes: 17 additions & 1 deletion trunk/fs/char_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,9 +471,19 @@ static int exact_lock(dev_t dev, void *data)
*/
int cdev_add(struct cdev *p, dev_t dev, unsigned count)
{
int error;

p->dev = dev;
p->count = count;
return kobj_map(cdev_map, dev, count, NULL, exact_match, exact_lock, p);

error = kobj_map(cdev_map, dev, count, NULL,
exact_match, exact_lock, p);
if (error)
return error;

kobject_get(p->kobj.parent);

return 0;
}

static void cdev_unmap(dev_t dev, unsigned count)
Expand All @@ -498,14 +508,20 @@ void cdev_del(struct cdev *p)
static void cdev_default_release(struct kobject *kobj)
{
struct cdev *p = container_of(kobj, struct cdev, kobj);
struct kobject *parent = kobj->parent;

cdev_purge(p);
kobject_put(parent);
}

static void cdev_dynamic_release(struct kobject *kobj)
{
struct cdev *p = container_of(kobj, struct cdev, kobj);
struct kobject *parent = kobj->parent;

cdev_purge(p);
kfree(p);
kobject_put(parent);
}

static struct kobj_type ktype_cdev_default = {
Expand Down

0 comments on commit 52bad11

Please sign in to comment.