From: Jiri Slaby <jirislaby@gmail.com>
To: Rogier Wolff <R.E.Wolff@BitWizard.nl>
Cc: linux-kernel@vger.kernel.org, rth@twiddle.net,
dhowells@redhat.com, kumar.gala@freescale.com,
davem@davemloft.net, mhw@wittsend.com, support@comtrol.com,
nils@kernelconcepts.de, chirag.kantharia@hp.com,
Lionel.Bouton@inet6.fr, benh@kernel.crashing.org,
mchehab@brturbo.com.br, laredo@gnu.org,
rbultje@ronald.bitfreak.net, middelin@polyware.nl, philb@gnu.org,
tim@cyberelk.net, campbell@torque.net, andrea@suse.de,
mulix@mulix.org
Subject: Re: [PATCH] pci_find_device --> pci_get_device
Date: Tue, 19 Jul 2005 12:53:38 +0200 [thread overview]
Message-ID: <42DCDBB2.6070106@gmail.com> (raw)
In-Reply-To: <20050719043621.GA14657@bitwizard.nl>
Rogier Wolff napsal(a):
>On Tue, Jul 19, 2005 at 02:25:23AM +0200, Jiri Slaby wrote:
>
>
>>The patch is for mixed files from all over the tree.
>>
>>Kernel version: 2.6.13-rc3-git4
>>
>>* This patch removes from kernel tree pci_find_device and changes
>>it with pci_get_device. Next, it adds pci_dev_put, to decrease reference
>>count of the variable.
>>* Next, there are some (about 10 or so) gcc warning problems (i. e.
>>variable may be unitialized) solutions, which were around code with old
>>pci_find_device.
>>* Some code was unpretty, or ugly, so the patch provides more readable
>>code, in some cases.
>>* Marks the function as deprecated in pci.h
>>
>>
>
>Hi Jiri,
>
>
Hello,
>The patch grabs reference counts to pdev structures, but almost never
>decreases the reference counts.
>
>
I think, that if there is a loop, the pci_get_device always decrease it, see
pci_get_subsys, line 249 (2.6.13-rc3-git4). This function is called by
pci_get_device.
So the question is, if I really need to decrease count, if it occurs in
while (pdev = pci_get_device(..., pdev))
{
initialize(pdev);
// pci_dev_put(pdev); // uncomment or no?
}
Now one problem came on my mind with initialize(pdev) -- if there is
some global var my = pdev in that and it returns back and calls
pci_get_device, it counts down the reference count of pdev, but we need
it anywhere else. Shouldn't be there pci_dev_get to increase ref count and
decrease it either after it is unused or after module unloads or never in
other cases?
>If you are working in a team, and want others to be able to continue
>where you left off, you should add a comment, even if it is repetitive
>to state what needs to be done.
>
>
I don't know, if you think it global, or if am I here with other fellows
(no, I'm not).
I don't know what kind of comment you have on your mind. Could you, please,
specify it more.
I only changed names of called functions and added some pci_dev_put,
what should
I comment?
>As far as I can see, you grab a reference to the "pdev" on
>initialization, and never release it. Or you only release it in
>certain error conditions. Would this make the driver unable to
>be unloaded and reloaded? That would not be good.
>
>
The only thing, that pci_dev_put do, is that it releases memory of pdev
structure, if
reference count is 0 (as far as I can see, there is no real doc, which
could ensure me,
it is my piece of knowledge found out from source code, maybe wrong??).
It does not
do anything with the device.
So, the question is the same as above... Is it right to NOT release,
when it's in a loop?
--
Jiri Slaby www.fi.muni.cz/~xslaby
~\-/~ jirislaby@gmail.com ~\-/~
241B347EC88228DE51EE A49C4A73A25004CB2A10
next prev parent reply other threads:[~2005-07-19 10:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-19 0:25 [PATCH] pci_find_device --> pci_get_device Jiri Slaby
2005-07-19 4:36 ` Rogier Wolff
2005-07-19 10:53 ` Jiri Slaby [this message]
2005-07-19 11:15 ` Rogier Wolff
2005-07-19 11:27 ` Rolf Eike Beer
2005-07-19 15:44 ` Jiri Slaby
2005-07-19 16:20 ` Rolf Eike Beer
2005-07-20 10:40 ` Jiri Slaby
2005-07-20 11:19 ` Rolf Eike Beer
2005-07-20 12:05 ` Jiri Slaby
2005-07-20 13:56 ` Rolf Eike Beer
2005-07-20 14:40 ` Jiri Slaby
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=42DCDBB2.6070106@gmail.com \
--to=jirislaby@gmail.com \
--cc=Lionel.Bouton@inet6.fr \
--cc=R.E.Wolff@BitWizard.nl \
--cc=andrea@suse.de \
--cc=benh@kernel.crashing.org \
--cc=campbell@torque.net \
--cc=chirag.kantharia@hp.com \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=kumar.gala@freescale.com \
--cc=laredo@gnu.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@brturbo.com.br \
--cc=mhw@wittsend.com \
--cc=middelin@polyware.nl \
--cc=mulix@mulix.org \
--cc=nils@kernelconcepts.de \
--cc=philb@gnu.org \
--cc=rbultje@ronald.bitfreak.net \
--cc=rth@twiddle.net \
--cc=support@comtrol.com \
--cc=tim@cyberelk.net \
/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