From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Joerg Roedel <joerg.roedel@amd.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Michael Buesch <m@bues.ch>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Kernel development list <linux-kernel@vger.kernel.org>
Subject: Re: Incorrect uses of get_driver()/put_driver()
Date: Mon, 9 Jan 2012 12:48:36 -0500 [thread overview]
Message-ID: <20120109174836.GA32181@phenom.dumpdata.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1201091202090.1541-100000@iolanthe.rowland.org>
On Mon, Jan 09, 2012 at 12:35:09PM -0500, Alan Stern wrote:
> The get_driver() and put_driver() routines in the device core are not
> documented well, and what they really do is quite different from what
> people might think they do. In particular, get_driver() does not
> prevent a driver from being unregistered or unloaded -- the API which
> comes closest to doing that is try_module_get().
>
> In fact, get_driver() and put_driver() are pretty much useless for
> normal purposes, and Dmitry and I have been discussing getting rid of
> them entirely. But first we need to make sure that doing so won't mess
> anything up.
>
> The purpose of this email is to check with the maintainers of the
> various drivers that seem to be using these routines in questionable
> ways, to make sure nothing will go wrong. Here are the places we have
> identified:
>
> lib/dma-debug.c:173: drv = get_driver(dev->driver);
> lib/dma-debug.c:188: put_driver(drv);
>
> Joerg, these calls don't seem to do anything, as far as I can tell.
> Is there any reason to keep them?
>
> drivers/pci/xen-pcifront.c:596: if (get_driver(&pdrv->driver)) {
> drivers/pci/xen-pcifront.c:626: put_driver(&pdrv->driver);
>
> Konrad, these calls don't seem to do anything either.
>
Looks like they should be replaced with the try_module_get() equivalant
for the 'struct pci_driver'? Is there such one?
next prev parent reply other threads:[~2012-01-09 17:59 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-05 16:31 Problems with get_driver() and driver_attach() (and new_id too) Alan Stern
2012-01-05 18:01 ` Dmitry Torokhov
2012-01-05 18:55 ` Alan Stern
2012-01-05 20:05 ` Dmitry Torokhov
2012-01-05 20:48 ` Alan Stern
2012-01-05 23:17 ` Greg KH
2012-01-06 14:42 ` Alan Stern
2012-01-06 15:42 ` Alan Stern
2012-01-06 20:29 ` Alan Stern
2012-01-09 8:48 ` Dmitry Torokhov
2012-01-09 16:37 ` Alan Stern
2012-01-09 16:50 ` Dmitry Torokhov
2012-01-09 17:01 ` Alan Stern
2012-01-09 17:05 ` Dmitry Torokhov
2012-01-09 17:35 ` Incorrect uses of get_driver()/put_driver() Alan Stern
2012-01-09 17:48 ` Konrad Rzeszutek Wilk [this message]
2012-01-09 18:20 ` Dmitry Torokhov
2012-01-09 18:34 ` Konrad Rzeszutek Wilk
2012-01-09 18:49 ` Dmitry Torokhov
2012-01-09 19:36 ` Alan Stern
2012-01-09 18:03 ` Michael Büsch
2012-01-09 18:14 ` Dmitry Torokhov
2012-01-09 19:48 ` Alan Stern
2012-01-09 20:07 ` Michael Büsch
2012-01-09 22:44 ` Alan Stern
2012-01-09 23:05 ` Michael Büsch
2012-01-09 18:04 ` Joerg Roedel
2012-01-10 9:05 ` Martin Schwidefsky
2012-01-10 9:20 ` Dmitry Torokhov
2012-01-10 10:03 ` Martin Schwidefsky
2012-01-10 10:18 ` Sebastian Ott
2012-01-10 10:21 ` Sebastian Ott
2012-01-10 20:32 ` Alan Stern
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=20120109174836.GA32181@phenom.dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=dmitry.torokhov@gmail.com \
--cc=joerg.roedel@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=m@bues.ch \
--cc=schwidefsky@de.ibm.com \
--cc=stern@rowland.harvard.edu \
/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).