On Thu, Jun 20, 2019 at 12:40 PM Alexey Kardashevskiy <a...@ozlabs.ru> wrote: > > On 19/06/2019 14:27, Sam Bobroff wrote: > > On Tue, Jun 11, 2019 at 03:47:58PM +1000, Alexey Kardashevskiy wrote: > >> > >> On 07/05/2019 14:30, Sam Bobroff wrote: > >>> Also remove useless comment. > >>> > >>> Signed-off-by: Sam Bobroff <sbobr...@linux.ibm.com> > >>> Reviewed-by: Alexey Kardashevskiy <a...@ozlabs.ru> > >>> --- > *snip* > > > > I can see that edev will be non-NULL here, but that pr_debug() pattern > > (using the PDN information to form the PCI address) is quite common > > across the EEH code, so I think rather than changing a couple of > > specific cases, I should do a separate cleanup patch and introduce > > something like pdn_debug(pdn, "...."). What do you think? > > I'd switch them all to already existing dev_dbg/pci_debug rather than > adding pdn_debug as imho it should not have been used in the first place > really... > > > (I don't know exactly when edev->pdev can be NULL.) > > ... and if you switch to dev_dbg/pci_debug, I think quite soon you'll > know if it can or cannot be NULL :)
As far as I can tell edev->pdev is NULL in two cases: 1. Before eeh_device_add_late() has been called on the pdev. The late part of the add maps the pdev to an edev and sets the pdev's edev pointer and vis a vis. 2. While recoverying EEH unaware devices. Unaware devices are destroyed and rescanned and the edev->pdev pointer is cleared by pcibios_device_release() In most of these cases it should be safe to use the pci_*() functions rather than making a new one up for printing pdns. In the cases where we might not have a PCI dev i'd make a new set of prints that take an EEH dev rather than a pci_dn since i'd like pci_dn to die sooner rather than later. Oliver