From d4f63c8a506cf37ea05681f824cdd407ea8aeaf8 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Thu, 5 Feb 2004 22:07:24 -0800 Subject: [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. --- include/linux/cdev.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/linux/cdev.h') 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 -- cgit v1.2.3