xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Andy Walls <awalls@md.metrocast.net>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Jiri Kosina <jkosina@suse.cz>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	Dominik Brodowski <linux@dominikbrodowski.net>,
	Sebastian Ott <sebott@linux.vnet.ibm.com>,
	"David S. Miller" <davem@davemloft.net>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Michael Buesch <m@bues.ch>, Joerg Roedel <joerg.roedel@amd.com>,
	linux-input@vger.kernel.org, linux-media@vger.kernel.org,
	netdev@vger.kernel.org, linux-pcmcia@lists.infradead.org,
	linux-s390@vger.kernel.org, USB list <linux-usb@vger.kernel.org>,
	xen-devel@lists.xensource.com,
	Kernel development list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 0/5] Get rid of get_driver() and put_driver()
Date: Tue, 24 Jan 2012 16:06:34 -0800	[thread overview]
Message-ID: <20120125000634.GA1178@kroah.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1201241158540.1200-100000@iolanthe.rowland.org>

On Tue, Jan 24, 2012 at 01:33:37PM -0500, Alan Stern wrote:
> Greg:
> 
> This patch series removes the get_driver() and put_driver() routines
> from the kernel.
> 
> Those routines don't do anything useful.  Their comments say that they
> increment and decrement the driver's reference count, just like
> get_device()/put_device() and a lot of other utility routines.  But a
> struct driver is _not_ like a struct device!  It resembles a piece of
> code more than a piece of data -- it acts as an encapsulation of a
> driver.  Incrementing its refcount doesn't have much meaning because a
> driver's lifetime isn't determined by the structure's refcount; it's
> determined by when the driver's module gets unloaded.
> 
> What really matters for a driver is whether or not it is registered.  
> Drivers expect, for example, that none of their methods will be called
> after driver_unregister() returns.  It doesn't matter if some other
> thread still holds a reference to the driver structure; that reference
> mustn't be used for accessing the driver code after unregistration.  
> get_driver() does not do any checking for this.
> 
> People may have been misled by the kerneldoc into thinking that the
> references obtained by get_driver() do somehow pin the driver structure
> in memory.  This simply isn't true; all it pins is the associated
> private structure.  Code that needs to pin a driver must do it some
> other way (probably by calling try_module_get()).
> 
> In short, these routines don't do anything useful and they can actively 
> mislead people.  Removing them won't introduce any bugs that aren't 
> already present.  There is no reason to keep them.

Very nice work, all now applied, thanks for doing this.

greg k-h

      reply	other threads:[~2012-01-25  0:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-24 18:33 [PATCH 0/5] Get rid of get_driver() and put_driver() Alan Stern
2012-01-25  0:06 ` Greg KH [this message]

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=20120125000634.GA1178@kroah.com \
    --to=greg@kroah.com \
    --cc=awalls@md.metrocast.net \
    --cc=davem@davemloft.net \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=jkosina@suse.cz \
    --cc=joerg.roedel@amd.com \
    --cc=konrad.wilk@oracle.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-pcmcia@lists.infradead.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@dominikbrodowski.net \
    --cc=m@bues.ch \
    --cc=netdev@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=sebott@linux.vnet.ibm.com \
    --cc=stern@rowland.harvard.edu \
    --cc=xen-devel@lists.xensource.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;
as well as URLs for NNTP newsgroup(s).