Re: Freeing a dynamic struct cdev

2005-08-06 Thread James C. Georgas
Ok, I really blew it with that last post: > > cdev_add() calls: > kobj_map() > kobject_get() [indirectly] > This is wrong. When I first looked at it, I saw: cdev_add() -> kobj_map() -> exact_lock() -> cdev_get() -> kobject_get() but exact_lock() isn't called here; it is only passe

Re: Freeing a dynamic struct cdev

2005-08-06 Thread Randy.Dunlap
On Sat, 06 Aug 2005 15:26:18 -0400 James C. Georgas wrote: > On Sat, 2005-08-06 at 12:21 -0700, Randy.Dunlap wrote: > > On Sat, 06 Aug 2005 09:26:15 -0400 James C. Georgas wrote: > > > > > If I allocate a struct cdev using cdev_alloc(), what function do I call > > > to free it when I'm done with

Re: Freeing a dynamic struct cdev

2005-08-06 Thread James C. Georgas
On Sat, 2005-08-06 at 12:21 -0700, Randy.Dunlap wrote: > On Sat, 06 Aug 2005 09:26:15 -0400 James C. Georgas wrote: > > > If I allocate a struct cdev using cdev_alloc(), what function do I call > > to free it when I'm done with it? > > Should be cdev_put(), which calls kobject_put(), which implem

Re: Freeing a dynamic struct cdev

2005-08-06 Thread Randy.Dunlap
On Sat, 06 Aug 2005 09:26:15 -0400 James C. Georgas wrote: > If I allocate a struct cdev using cdev_alloc(), what function do I call > to free it when I'm done with it? Should be cdev_put(), which calls kobject_put(), which implements ref counting (using krefs), so that when the last reference is