I am now looking for countless hours in the linux/pci.h and all connected files to understand how the PCI can be securely scanned (read-only) and then picking a pci_slot when the device matches.
However, I am not able to even start a search as i have no root-bridge or root-node to begin the search with. (the search should be as generic as possible - all done in a kernel module).
I observed that I need a starting-point for functions to further search for children/parent. But i do not want to add or register a slot (which e.g. is done by the function pci_scan_bus() -> https://elixir.bootlin.com/linux/v5.5.5/source/drivers/pci/probe.c#L3085 ). As the book "Linux Device Drivers" stated, there is no way to scan the pci-bus the old fashioned way.
Should I register a dummy device/slot to go up the root node and then recheck the whole tree-structure of the PCI-bus? Even the kernel.org documentation from 2004 is missing major information about some mechanics in how the kernel is managing the pci-bus.
Each answer is appreciated :)