linuxkpi: enhance various PCI bits
- In pci_domain_nr() directly return the domain which got set in lkpifill_pci_dev() in all cases. This was missed between D27550 and 105a37cac76b971f7a94409fbdc4f508a7e97fa0 .
- In linux_pci_attach_device() get rid of dinfo apart from the two lines actually needing it. Given we set ivars, we can then use proper pci_get_*() accessor functions instead in either case.
Move some more of these accessor initialisations to lkpifill_pci_dev(), which also avoids duplicat work for "device" and "vendor".
- Move pdev->bus allocation common to lkpinew_pci_dev() and linux_pci_attach_device() into lkpifill_pci_dev().
- Move the pdev->dev.* and kobj initializations from linux_pci_attach_device() into lkpifill_pci_dev() allowing the lkpinew_pci_dev() case to also use them.
- Add a pdev->dev.release function for the lkpinew_pci_dev() case simply freeing the pdev->bus and the pdev called through the normal logic when the kref of the kobj of the dev of the pdev goes to 0.
- With pdev->dev.kobj always initialized and the release function, Implement pci_dev_put() in the expected way (previously discussed as part of D27550).
All but the pci_domain_nr() changes are so that DRM will use the
normal dev/kobj refcount logic and common functions without any
special hack for device management. We keep doing this without
actually adding the allocated pci devices (incl. the kobjb satte)
from lkpinew_pci_dev() to the pci_devices list.
Sponsored-by: The FreeBSD Foundation
Obtained-from: bz_iwlwifi (partially)