public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI Update for 2.6.3-rc1
Date: Mon, 9 Feb 2004 15:22:21 -0800	[thread overview]
Message-ID: <10763689413014@kroah.com> (raw)
In-Reply-To: <10763689413661@kroah.com>

ChangeSet 1.1500.11.17, 2004/02/04 10:03:35-08:00, colpatch@us.ibm.com

[PATCH] PCI: fix "pcibus_class" Device Class, release function

John Rose wrote:
> The function release_pcibus_dev() in probe.c defines the release procedure for
> device class pcibus_class.  I want to suggest that this function be scrapped :)
>
> This release function is called in the code path of class_device_unregister().
> The pcibus_class devices aren't currently unregistered anywhere, from what I
> can tell, so this release function is currently unused.  The runtime removal of
> PCI buses from logical partitions on PPC64 requires the unregistration of these
> class devices.  The natural place to do this IMHO is in pci_remove_bus_device()
> in remove.c.

You're right that the class device isn't currently unregistered, and
that was an oversight in the patch I originally sent.  Attatched is a
patch that remedies that situation.  pci_remove_bus_device() *is* the
natural place to unregister the class_dev, and that's just what the
patch does.


> The problem is that this calls pci_destroy_dev(), which calls put() on the same
> "bridge" device that the release function does.  This should only be done once
> in the course of removing a pci_bus, and I doubt that we want to change
> pci_destroy_dev().   The kfree() of the pci_bus struct is also done in both
> pci_remove_bus_device() and release_pcibus_dev().

Yep.  The patch pulls the kfree() out of pci_remove_bus_device() and
calls class_device_unregister() in it's place.  This will put() the
bridge device and free the pci_bus as needed.  put() does need to be
called twice because the bridge device is get()'d twice: once when the
device is registered and once when it's bus device grabs a reference to it.


 drivers/pci/remove.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


diff -Nru a/drivers/pci/remove.c b/drivers/pci/remove.c
--- a/drivers/pci/remove.c	Mon Feb  9 14:58:38 2004
+++ b/drivers/pci/remove.c	Mon Feb  9 14:58:38 2004
@@ -83,7 +83,7 @@
 		list_del(&b->node);
 		spin_unlock(&pci_bus_lock);
 
-		kfree(b);
+		class_device_unregister(&b->class_dev);
 		dev->subordinate = NULL;
 	}
 


  reply	other threads:[~2004-02-09 23:44 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-09 23:13 [BK PATCH] PCI update for 2.6.3-rc1 Greg KH
2004-02-09 23:22 ` [PATCH] PCI Update " Greg KH
2004-02-09 23:22   ` Greg KH
2004-02-09 23:22     ` Greg KH
2004-02-09 23:22       ` Greg KH
2004-02-09 23:22         ` Greg KH
2004-02-09 23:22           ` Greg KH
2004-02-09 23:22             ` Greg KH
2004-02-09 23:22               ` Greg KH
2004-02-09 23:22                 ` Greg KH
2004-02-09 23:22                   ` Greg KH
2004-02-09 23:22                     ` Greg KH
2004-02-09 23:22                       ` Greg KH
2004-02-09 23:22                         ` Greg KH
2004-02-09 23:22                           ` Greg KH
2004-02-09 23:22                             ` Greg KH
2004-02-09 23:22                               ` Greg KH
2004-02-09 23:22                                 ` Greg KH [this message]
2004-02-09 23:22                                   ` Greg KH
2004-02-09 23:22                                     ` Greg KH
2004-02-09 23:22                                       ` Greg KH
2004-02-09 23:22                                         ` Greg KH
2004-02-09 23:22                                           ` Greg KH
2004-02-09 23:22                                             ` Greg KH
2004-02-10 11:11                                               ` Marcelo Tosatti
2004-02-10 16:03     ` Geert Uytterhoeven
2004-02-10 16:46       ` Greg KH
2004-02-10 17:03         ` Kai Germaschewski
2004-02-10 17:49         ` Karsten Keil
2004-02-11 22:27           ` Adrian Bunk
2004-02-10 18:05         ` Adam Belay
2004-02-18 19:40           ` Greg KH

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=10763689413014@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /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