[PATCH 1/2] powerpc/powernv: clear the refcount for pci_dev on powernv platform

Gavin Shan gwshan at linux.vnet.ibm.com
Wed Apr 23 09:00:33 EST 2014


On Tue, Apr 22, 2014 at 06:25:09PM +1000, Benjamin Herrenschmidt wrote:
>On Tue, 2014-04-22 at 15:44 +0800, Wei Yang wrote:
>> So this patch(the 2nd one) doesn't contribute to clear the warning and
>> error.
>> Only the first patch did it. Please ignore this one.
>
>But is it correct ? It's not right to keep a refcount elevated if we
>don't have to.
>
>Gavin, can you get to the bottom of that refcount business ?
>

Ben, "struct pci_dn::pcidev" was used by EEH originally. We don't
use it any more. So it can be removed.

Currently, EEH has following 4 functions to do conversion from
one to another. None of them relies on "struct pci_dn::pcidev".

of_node_to_eeh_dev()	device_node -> pci_dn -> eeh_dev
pci_dev_to_eeh_dev()    pci_dev     -> device -> archdata -> eeh_dev
eeh_dev_to_of_node()    eeh_dev     -> device_node
eeh_dev_to_pci_dev()    eeh_dev     -> pci_dev

The side effect of holding pci_dev refcount is the pci_dev, eeh_dev,
eeh_pe instance can't be free'ed during fully hotplug though EEH can
survive. It's reasonable to remove it.

Thanks,
Gavin



More information about the Linuxppc-dev mailing list