diff options
author | Arnd Bergmann <arnd@arndb.de> | 2012-11-15 17:41:21 +0100 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-11-15 17:41:21 +0100 |
commit | 8dbd2879e33be37adf40f747a5fb80ef1a6cd150 (patch) | |
tree | c688d7980be8c1c0dbf5e411caaf2c102120102e /fs/char_dev.c | |
parent | b770ea523d95837e968d46c7fe09a3f5edd9bb27 (diff) | |
parent | d308ba50a1234b299a00e63a95e61fdeb2f1a2df (diff) | |
download | linux-8dbd2879e33be37adf40f747a5fb80ef1a6cd150.tar.bz2 |
Merge branch 'omap/dt' into next/drivers
Needed for the omap timer changes.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'fs/char_dev.c')
-rw-r--r-- | fs/char_dev.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/fs/char_dev.c b/fs/char_dev.c index 3f152b92a94a..afc2bb691780 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c @@ -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) @@ -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 = { |