On Wed, 1 Jun 2005, Scott Murray wrote:
> On Wed, 1 Jun 2005, Prarit Bhargava wrote:
>
> > Prarit Bhargava wrote:
> > > Greg KH wrote:
> > >
> > >> [PATCH] PCI Hotplug: more CPCI updates
> > >
> > >
> > >> - Switch to pci_get_slot instead of deprecated pci_find_slot.
> > >> - A bunch of CodingStyle fixes.
> > >
> > >
> > >> - }
> > >> + dev = pci_get_slot(slot->bus, PCI_DEVFN(slot->number, 0));
> > >> + if (dev) {
> > >> + if (update_adapter_status(slot->hotplug_slot, 1))
> > >> + warn("failure to update adapter file");
> > >> + if (update_latch_status(slot->hotplug_slot, 1))
> > >> + warn("failure to update latch file");
> > >> + slot->dev = dev;
> > >> }
> > >> }
> > >
> > >
> > > I don't claim to know the code as well as Scott or Greg does, but I
> > > don't see a pci_put_dev for the slot->dev to clean up the usage count?
> >
> > s/pci_put_dev/pci_dev_put/g
>
> Sorry Prarit, when you suggested I switch over to pci_get_slot in your
> previous comments to me, I didn't look that closely and missed the
> reference counting. Greg, I think the required fix is just a couple of
> lines in my hotplug slot release function, I'll code it up and test it
> ASAP tomorrow with an eye on getting a patch off by early afternoon EDT.
Greg, sorry for the delay, here's a patch that fixes up the pci_dev
refcounting in the CPCI code. I've done some testing against it and it
seems fine here.
cpci_hotplug_core.c | 2 ++
cpci_hotplug_pci.c | 5 ++++-
2 files changed, 6 insertions(+), 1 deletion(-)
Signed-Off-By: [email protected]
diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet --exclude=SOMA linux-2.6/drivers/pci/hotplug/cpci_hotplug_core.c linux-2.6-cpci/drivers/pci/hotplug/cpci_hotplug_core.c
--- linux-2.6/drivers/pci/hotplug/cpci_hotplug_core.c 2005-06-02 15:10:19.000000000 -0400
+++ linux-2.6-cpci/drivers/pci/hotplug/cpci_hotplug_core.c 2005-06-02 15:18:40.000000000 -0400
@@ -217,6 +217,8 @@
kfree(slot->hotplug_slot->info);
kfree(slot->hotplug_slot->name);
kfree(slot->hotplug_slot);
+ if (slot->dev)
+ pci_dev_put(slot->dev);
kfree(slot);
}
diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet --exclude=SOMA linux-2.6/drivers/pci/hotplug/cpci_hotplug_pci.c linux-2.6-cpci/drivers/pci/hotplug/cpci_hotplug_pci.c
--- linux-2.6/drivers/pci/hotplug/cpci_hotplug_pci.c 2005-06-02 15:10:19.000000000 -0400
+++ linux-2.6-cpci/drivers/pci/hotplug/cpci_hotplug_pci.c 2005-06-02 15:22:12.000000000 -0400
@@ -315,9 +315,12 @@
PCI_DEVFN(PCI_SLOT(slot->devfn), i));
if (dev) {
pci_remove_bus_device(dev);
- slot->dev = NULL;
+ pci_dev_put(dev);
}
}
+ pci_dev_put(slot->dev);
+ slot->dev = NULL;
+
dbg("%s - exit", __FUNCTION__);
return 0;
}
--
Scott Murray
SOMA Networks, Inc.
Toronto, Ontario
e-mail: [email protected]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]