On Fri, Sep 12, 2014 at 05:35:25PM +0800, Wei Yang wrote: >On Fri, Sep 12, 2014 at 03:05:18PM +1000, Gavin Shan wrote: >>On Fri, Sep 12, 2014 at 01:55:23PM +1000, Michael Ellerman wrote: >>>On Thu, 2014-09-11 at 11:42 +0800, Wei Yang wrote: >>>> diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c >>>> index 4a45ba8..403445e 100644 >>>> --- a/arch/powerpc/kernel/eeh.c >>>> +++ b/arch/powerpc/kernel/eeh.c >>>> @@ -625,7 +625,7 @@ int eeh_pci_enable(struct eeh_pe *pe, int function) >>>> int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum >>>> pcie_reset_state state) >>>> { >>>> struct eeh_dev *edev = pci_dev_to_eeh_dev(dev); >>>> - struct eeh_pe *pe = edev->pe; >>>> + struct eeh_pe *pe = edev ? edev->pe : NULL; >>>> >>>> if (!pe) { >>>> pr_err("%s: No PE found on PCI device %s\n", >>> >>> >>>We seem to do this or something similar in a few places. Is it worth having a >>>pci_dev_to_eeh_pe() inline? >>> >> >>Yes, maybe we just need a eeh_dev_to_pe() because converting >>pci_dev to eeh_dev is already coverred by pci_dev_to_eeh_dev(). >> >>With eeh_dev_to_pe(), it looks like this: >> >>struct pci_dev *pdev; >>struct eeh_dev *edev = pci_dev_to_eeh_dev(pdev); >>struct eeh_pe *pe = eeh_dev_to_pe(edev); >> >>Or another case: >> >>struct device_node *dn; >>struct eeh_dev *edev = of_node_to_eeh_dev(dn); >>struct eeh_pe *pe = eeh_dev_to_pe(edev); > >With these helper, it would be more consolidate to jump between those data. > >Gavin, > >You would add these helpers? Or would like me to add them? >
It would be Richard to help on this :-) Thanks, Gavin _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev