device/device_util: Use const qualifier
Allows to use the function in more places that expect the struct device to be readonly. TEST=Build and boot on intel/archercity CRB Change-Id: Iac04fe6931a43070f6638b399adbff2ce64829c9 Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Shuo Liu <shuo.liu@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/81275 Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
72b8d2fbc7
commit
e56a41b33f
5 changed files with 21 additions and 20 deletions
|
|
@ -41,12 +41,13 @@ struct device *dev_find_device_on_socket(uint8_t socket, u16 vendor, u16 device)
|
|||
static int filter_device_on_stack(struct device *dev, uint8_t socket, uint8_t stack,
|
||||
u16 vendor, u16 device)
|
||||
{
|
||||
struct device *domain = dev_get_pci_domain(dev);
|
||||
if (!domain)
|
||||
return 0;
|
||||
if (dev->path.type != DEVICE_PATH_PCI)
|
||||
return 0;
|
||||
|
||||
const struct device *domain = dev_get_pci_domain(dev);
|
||||
if (!domain)
|
||||
return 0;
|
||||
|
||||
union xeon_domain_path dn;
|
||||
dn.domain_path = domain->path.domain.domain;
|
||||
|
||||
|
|
@ -130,9 +131,9 @@ struct device *dev_find_all_devices_on_domain(struct device *domain, u16 vendor,
|
|||
*
|
||||
* @return Socket ID the device is attached to, negative number on error.
|
||||
*/
|
||||
int iio_pci_domain_socket_from_dev(struct device *dev)
|
||||
int iio_pci_domain_socket_from_dev(const struct device *dev)
|
||||
{
|
||||
struct device *domain;
|
||||
const struct device *domain;
|
||||
union xeon_domain_path dn;
|
||||
|
||||
if (dev->path.type == DEVICE_PATH_DOMAIN)
|
||||
|
|
@ -156,9 +157,9 @@ int iio_pci_domain_socket_from_dev(struct device *dev)
|
|||
*
|
||||
* @return Stack ID the device is attached to, negative number on error.
|
||||
*/
|
||||
int iio_pci_domain_stack_from_dev(struct device *dev)
|
||||
int iio_pci_domain_stack_from_dev(const struct device *dev)
|
||||
{
|
||||
struct device *domain;
|
||||
const struct device *domain;
|
||||
union xeon_domain_path dn;
|
||||
|
||||
if (dev->path.type == DEVICE_PATH_DOMAIN)
|
||||
|
|
@ -224,7 +225,7 @@ void attach_iio_stacks(void)
|
|||
}
|
||||
}
|
||||
|
||||
bool is_pcie_domain(struct device *dev)
|
||||
bool is_pcie_domain(const struct device *dev)
|
||||
{
|
||||
if ((!dev) || (dev->path.type != DEVICE_PATH_DOMAIN))
|
||||
return false;
|
||||
|
|
@ -232,7 +233,7 @@ bool is_pcie_domain(struct device *dev)
|
|||
return strstr(dev->name, DOMAIN_TYPE_PCIE);
|
||||
}
|
||||
|
||||
bool is_ioat_domain(struct device *dev)
|
||||
bool is_ioat_domain(const struct device *dev)
|
||||
{
|
||||
if ((!dev) || (dev->path.type != DEVICE_PATH_DOMAIN))
|
||||
return false;
|
||||
|
|
@ -244,7 +245,7 @@ bool is_ioat_domain(struct device *dev)
|
|||
strstr(dev->name, DOMAIN_TYPE_HQM1));
|
||||
}
|
||||
|
||||
bool is_ubox_domain(struct device *dev)
|
||||
bool is_ubox_domain(const struct device *dev)
|
||||
{
|
||||
if ((!dev) || (dev->path.type != DEVICE_PATH_DOMAIN))
|
||||
return false;
|
||||
|
|
@ -253,7 +254,7 @@ bool is_ubox_domain(struct device *dev)
|
|||
strstr(dev->name, DOMAIN_TYPE_UBX1));
|
||||
}
|
||||
|
||||
bool is_cxl_domain(struct device *dev)
|
||||
bool is_cxl_domain(const struct device *dev)
|
||||
{
|
||||
if ((!dev) || (dev->path.type != DEVICE_PATH_DOMAIN))
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -70,13 +70,13 @@ struct device *dev_find_all_devices_on_stack(uint8_t socket, uint8_t stack,
|
|||
struct device *dev_find_all_devices_on_domain(struct device *domain,
|
||||
u16 vendor, u16 device, struct device *from);
|
||||
|
||||
int iio_pci_domain_socket_from_dev(struct device *dev);
|
||||
int iio_pci_domain_stack_from_dev(struct device *dev);
|
||||
int iio_pci_domain_socket_from_dev(const struct device *dev);
|
||||
int iio_pci_domain_stack_from_dev(const struct device *dev);
|
||||
|
||||
bool is_pcie_domain(struct device *dev);
|
||||
bool is_ioat_domain(struct device *dev);
|
||||
bool is_ubox_domain(struct device *dev);
|
||||
bool is_cxl_domain(struct device *dev);
|
||||
bool is_pcie_domain(const struct device *dev);
|
||||
bool is_ioat_domain(const struct device *dev);
|
||||
bool is_ubox_domain(const struct device *dev);
|
||||
bool is_cxl_domain(const struct device *dev);
|
||||
|
||||
#define is_dev_on_pcie_domain(dev) is_pcie_domain(dev_get_pci_domain(dev))
|
||||
#define is_dev_on_ioat_domain(dev) is_ioat_domain(dev_get_pci_domain(dev))
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ static unsigned long acpi_create_drhd(unsigned long current, struct device *iomm
|
|||
|
||||
// Add PCIe Ports
|
||||
if (!is_dev_on_domain0(iommu)) {
|
||||
struct device *domain = dev_get_pci_domain(iommu);
|
||||
const struct device *domain = dev_get_pci_domain(iommu);
|
||||
struct device *dev = NULL;
|
||||
while ((dev = dev_bus_each_child(domain->downstream, dev)))
|
||||
if ((dev->hdr_type & 0x7f) == PCI_HEADER_TYPE_BRIDGE)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue