On Mon, Aug 29, 2011 at 10:52:41 -0700, Greg KH wrote:
> On Mon, Aug 29, 2011 at 11:02:49AM +0200, Manohar Vanga wrote:
> > --- a/drivers/staging/vme/vme_bridge.h
> > +++ b/drivers/staging/vme/vme_bridge.h
> > @@ -115,9 +115,8 @@ struct vme_bridge {
> > struct list_head bus_list; /* list of VME buses */
> > struct module *owner; /* module that owns the bridge */
> >
> > - struct device dev[VME_SLOTS_MAX]; /* Device registered with
> > - * device model on VME bus
> > - */
> > + struct vme_dev dev[VME_SLOTS_MAX]; /* Device registered
> > + * on VME bus */
>
> Overall, this is the right way to go, using a vme_dev.
>
> BUT, you should never have a static list of devices, these should be
> pointers, not actual structures here, otherwise your reference counting
> just got all messed up and is wrong.
>
> And yes, I know you didn't create the code this way, but it needs to be
> fixed _before_ you make this kind of a change.
True, I overlooked this while reviewing >_<
Manohar, have a look at vme_unregister_driver_ng() and
__vme_register_driver_bus() in this patch:
http://article.gmane.org/gmane.linux.kernel/1054046
Note that there's no kfree(vme_dev) in those functions. put_device(),
which is also called from device_unregister(), decrements
the underlying kobj's refcount. When this refcount reaches 0,
kobject_release() is called. Eventually dev->release() gets called,
which in this case is set to vme_dev_release_ng(); it's there
(and only there) where vme_dev can be freed.
Emilio
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel