device: Add inline method to identify PATH_ROOT

Add and use inline method to identify the root device.

Change-Id: I394c8668245bcfea6414b8ca5f14ef8135897e59
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80169
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Patrick Rudolph 2024-01-22 15:39:46 +01:00 committed by Lean Sheng Tan
commit f95dbcee71
3 changed files with 14 additions and 6 deletions

View file

@ -73,7 +73,7 @@ static bool xhci_port_exists(const struct device *dev, const struct usb_path *pa
static const struct device *get_xhci_dev(const struct device *dev)
{
while (dev && dev->ops != &xhci_pci_ops) {
if (dev->path.type == DEVICE_PATH_ROOT)
if (is_root_device(dev))
return NULL;
dev = dev->bus->dev;