Attention is currently required from: Arthur Heymans, Christian Walter, Johnny Lin, Lean Sheng Tan, Shuo Liu, Tim Chu.
Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/81275?usp=email )
Change subject: device/device_util: Use const qualifier ......................................................................
device/device_util: Use const qualifier
Allows to use the function in more places that expect the struct device to be readonly.
Change-Id: Iac04fe6931a43070f6638b399adbff2ce64829c9 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/device/device_util.c M src/include/device/device.h M src/soc/intel/xeon_sp/chip_common.c M src/soc/intel/xeon_sp/include/soc/chip_common.h M src/soc/intel/xeon_sp/uncore_acpi.c 5 files changed, 14 insertions(+), 14 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/75/81275/1
diff --git a/src/device/device_util.c b/src/device/device_util.c index b5d0d98..5af80a4 100644 --- a/src/device/device_util.c +++ b/src/device/device_util.c @@ -250,7 +250,7 @@ }
/* Returns the PCI domain for the given PCI device */ -struct device *dev_get_pci_domain(struct device *dev) +const struct device *dev_get_pci_domain(const struct device *dev) { /* Walk up the tree up to the PCI domain */ while (dev && dev->upstream && !is_root_device(dev)) { diff --git a/src/include/device/device.h b/src/include/device/device.h index 25f730b..67b641f 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -182,7 +182,7 @@ const char *dev_name(const struct device *dev); const char *dev_path(const struct device *dev); u32 dev_path_encode(const struct device *dev); -struct device *dev_get_pci_domain(struct device *dev); +const struct device *dev_get_pci_domain(const struct device *dev); void dev_set_enabled(struct device *dev, int enable); void disable_children(struct bus *bus); bool dev_is_active_bridge(struct device *dev); diff --git a/src/soc/intel/xeon_sp/chip_common.c b/src/soc/intel/xeon_sp/chip_common.c index a178d3d..d8aaecb 100644 --- a/src/soc/intel/xeon_sp/chip_common.c +++ b/src/soc/intel/xeon_sp/chip_common.c @@ -67,7 +67,7 @@ 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); + const struct device *domain = dev_get_pci_domain(dev); if (!domain) return 0; if (dev->path.type != DEVICE_PATH_PCI) @@ -158,7 +158,7 @@ */ int iio_pci_domain_socket_from_dev(struct device *dev) { - struct device *domain; + const struct device *domain; union xeon_domain_path dn;
if (dev->path.type == DEVICE_PATH_DOMAIN) @@ -184,7 +184,7 @@ */ int iio_pci_domain_stack_from_dev(struct device *dev) { - struct device *domain; + const struct device *domain; union xeon_domain_path dn;
if (dev->path.type == DEVICE_PATH_DOMAIN) @@ -413,7 +413,7 @@ } }
-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; @@ -421,7 +421,7 @@ 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; @@ -433,7 +433,7 @@ 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; @@ -443,7 +443,7 @@
}
-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; diff --git a/src/soc/intel/xeon_sp/include/soc/chip_common.h b/src/soc/intel/xeon_sp/include/soc/chip_common.h index c61e51a..6238ebb 100644 --- a/src/soc/intel/xeon_sp/include/soc/chip_common.h +++ b/src/soc/intel/xeon_sp/include/soc/chip_common.h @@ -74,10 +74,10 @@ int iio_pci_domain_socket_from_dev(struct device *dev); int iio_pci_domain_stack_from_dev(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)) diff --git a/src/soc/intel/xeon_sp/uncore_acpi.c b/src/soc/intel/xeon_sp/uncore_acpi.c index 12d99da..0635671 100644 --- a/src/soc/intel/xeon_sp/uncore_acpi.c +++ b/src/soc/intel/xeon_sp/uncore_acpi.c @@ -316,7 +316,7 @@
// 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)