public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: "Emilio G. Cota" <cota@braap.org>
Cc: Manohar Vanga <manohar.vanga@cern.ch>,
	gregkh@suse.de, martyn.welch@ge.com, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] staging: vme: add functions for bridge module refcounting
Date: Mon, 29 Aug 2011 11:54:03 -0700	[thread overview]
Message-ID: <20110829185403.GA20808@kroah.com> (raw)
In-Reply-To: <20110829184012.GA19793@flamenco.cs.columbia.edu>

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

  reply	other threads:[~2011-08-29 18:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-29  9:02 [PATCH 0/3] [RESEND v3] VME Driver Changes Manohar Vanga
2011-08-29  9:02 ` [PATCH 1/3] staging: vme: add functions for bridge module refcounting Manohar Vanga
2011-08-29 14:56   ` Emilio G. Cota
2011-08-29 17:51   ` Greg KH
2011-08-29 18:40     ` Emilio G. Cota
2011-08-29 18:54       ` Greg KH [this message]
2011-08-29  9:02 ` [PATCH 2/3] staging: vme: add struct vme_dev for VME devices Manohar Vanga
2011-08-29 14:57   ` Emilio G. Cota
2011-08-29 17:52   ` Greg KH
2011-08-29 23:55     ` Emilio G. Cota
2011-08-30  7:52       ` Manohar Vanga
2011-08-29  9:02 ` [PATCH 3/3] staging: vme: make match() driver specific to improve non-VME64x support Manohar Vanga
2011-08-29 14:55   ` Emilio G. Cota
2011-08-30 10:39     ` Manohar Vanga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110829185403.GA20808@kroah.com \
    --to=greg@kroah.com \
    --cc=cota@braap.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manohar.vanga@cern.ch \
    --cc=martyn.welch@ge.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox