device_util: Handle domain device in dev_get_domain
When the input device pointer pointing to a domain device, dev_get_domain returns the input device itself. TEST=Build and boot on intel/archercity CRB Change-Id: I3a278a8f573de95406ee256fba17767def4ad75d Signed-off-by: Shuo Liu <shuo.liu@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/81957 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
parent
48097a17f1
commit
101685de0c
2 changed files with 3 additions and 11 deletions
|
|
@ -252,9 +252,9 @@ const struct device *dev_get_domain(const struct device *dev)
|
|||
{
|
||||
/* Walk up the tree up to the domain */
|
||||
while (dev && dev->upstream && !is_root_device(dev)) {
|
||||
dev = dev->upstream->dev;
|
||||
if (dev->path.type == DEVICE_PATH_DOMAIN)
|
||||
return dev;
|
||||
dev = dev->upstream->dev;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -136,11 +136,7 @@ int iio_pci_domain_socket_from_dev(const struct device *dev)
|
|||
const struct device *domain;
|
||||
union xeon_domain_path dn;
|
||||
|
||||
if (dev->path.type == DEVICE_PATH_DOMAIN)
|
||||
domain = dev;
|
||||
else
|
||||
domain = dev_get_domain(dev);
|
||||
|
||||
domain = dev_get_domain(dev);
|
||||
if (!domain)
|
||||
return -1;
|
||||
|
||||
|
|
@ -162,11 +158,7 @@ int iio_pci_domain_stack_from_dev(const struct device *dev)
|
|||
const struct device *domain;
|
||||
union xeon_domain_path dn;
|
||||
|
||||
if (dev->path.type == DEVICE_PATH_DOMAIN)
|
||||
domain = dev;
|
||||
else
|
||||
domain = dev_get_domain(dev);
|
||||
|
||||
domain = dev_get_domain(dev);
|
||||
if (!domain)
|
||||
return -1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue