Skip to content

Commit 8a48281

Browse files
KunWuChanbjorn-helgaas
authored andcommitted
PCI: Make pci_bus_type constant
Since commit d492cc2 ("driver core: device.h: make struct bus_type a const *"), the driver core can properly handle constant struct bus_type, move the pci_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime. Link: https://lore.kernel.org/r/[email protected] Suggested-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Kunwu Chan <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Cc: Greg Kroah-Hartman <[email protected]>
1 parent dbc3171 commit 8a48281

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/pci/pci-driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1670,7 +1670,7 @@ static void pci_dma_cleanup(struct device *dev)
16701670
iommu_device_unuse_default_domain(dev);
16711671
}
16721672

1673-
struct bus_type pci_bus_type = {
1673+
const struct bus_type pci_bus_type = {
16741674
.name = "pci",
16751675
.match = pci_bus_match,
16761676
.uevent = pci_uevent,

include/linux/pci.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ enum pcie_bus_config_types {
10981098

10991099
extern enum pcie_bus_config_types pcie_bus_config;
11001100

1101-
extern struct bus_type pci_bus_type;
1101+
extern const struct bus_type pci_bus_type;
11021102

11031103
/* Do NOT directly access these two variables, unless you are arch-specific PCI
11041104
* code, or PCI core code. */

0 commit comments

Comments
 (0)