diff options
| author | Jonathan Corbet <corbet@lwn.net> | 2004-02-05 22:07:24 -0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <greg@kroah.com> | 2004-02-05 22:07:24 -0800 |
| commit | d4f63c8a506cf37ea05681f824cdd407ea8aeaf8 (patch) | |
| tree | 5c154e128a652b86639c9642cc0a1ff17c6fac1d /include/linux/cdev.h | |
| parent | 50c7fd6f25c58c0740982d1857442dbba10e8955 (diff) | |
[PATCH] Char drivers: cdev_unmap()
To recap my argument: the current cdev implementation keeps an uncounted
reference to every cdev in cdev_map. Creators of cdevs must know to call
cdev_unmap() with the same arguments they passed to cdev_add() before
releasing the device, or that reference will remain and will oops the
kernel should user space attempt to open the (missing) device. It's an
easy mistake to make, and, IMO, entirely unnecessary; the cdev code should
be able to do its own bookkeeping.
Diffstat (limited to 'include/linux/cdev.h')
| -rw-r--r-- | include/linux/cdev.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/cdev.h b/include/linux/cdev.h index 191c800fa127..f1996ec09e96 100644 --- a/include/linux/cdev.h +++ b/include/linux/cdev.h @@ -7,6 +7,8 @@ struct cdev { struct module *owner; struct file_operations *ops; struct list_head list; + dev_t dev; + unsigned int count; }; void cdev_init(struct cdev *, struct file_operations *); @@ -21,8 +23,6 @@ int cdev_add(struct cdev *, dev_t, unsigned); void cdev_del(struct cdev *); -void cdev_unmap(dev_t, unsigned); - void cd_forget(struct inode *); #endif |
