Re: [PATCH 1/3] staging: vme: add functions for bridge module refcounting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 29, 2011 at 02:40:12PM -0400, Emilio G. Cota wrote:
> On Mon, Aug 29, 2011 at 10:51:04 -0700, Greg KH wrote:
> > On Mon, Aug 29, 2011 at 11:02:48AM +0200, Manohar Vanga wrote:
> > > This patch adds functions that allow for reference counting
> > > bridge modules. The patch introduces the functions
> > > 'vme_bridge_get()' and 'vme_bridge_put()'.
> > > 
> > > The functions are automatically called during .probe and .remove
> > > for drivers.
> > > 
> > > This patch is based on the changes introduced by Emilio G. Cota
> > > in the patch:
> > > 
> > >     https://lkml.org/lkml/2010/10/25/492
> > 
> > Generally do not try to couple a module reference count with a device
> > count, you are locking code, not data, and we really don't want to lock
> > code anymore now that we properly handle device reference counts.
> 
> (snip)
> 
> > > diff --git a/drivers/staging/vme/vme_bridge.h b/drivers/staging/vme/vme_bridge.h
> > > index 8959670..ef751a4 100644
> > > --- a/drivers/staging/vme/vme_bridge.h
> > > +++ b/drivers/staging/vme/vme_bridge.h
> > > @@ -113,6 +113,7 @@ struct vme_bridge {
> > >  	struct device *parent;	/* Parent device (eg. pdev->dev for PCI) */
> > >  	void *driver_priv;	/* Private pointer for the bridge driver */
> > >  	struct list_head bus_list; /* list of VME buses */
> > > +	struct module *owner;	/* module that owns the bridge */
> > 
> > Why?  When you register the device for this bridge, you should properly
> > handle the module reference counting in the vme core for any open sysfs
> > files.
> > 
> > Other than that, you shouldn't care about the module reference at all,
> > right?
> > 
> > What am I missing here?  What is this solving?
> > 
> > confused,
> 
> AFAIK currently a vme bridge driver can be freely removed with rmmod
> even if it has devices under it. The patch avoids this by increasing
> the refcount of the bridge module every time a device is registered
> under it.
> 
> What's the appropriate thing to do when rmmod tries to remove a bridge
> module?

Let it happen and remove all of the devices under it.

That's the way all other bus drivers in the kernel work, why change this
type of behavior?

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux