PCI: Annotate pci_cache_line_size variables as __ro_after_init
PATCH 1/1 PCI: Annotate pci_cache_line_size variables as __ro_after_init
Annotate both variables as __ro_after_init, enforcing that they can't be changed after the init phase.
--- drivers/pci/pci.c | 4 ++-- include/linux/pci.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/pci/pci.c +2 -2
@@ -142,8 +142,8 @@ enum pcie_bus_config_types pcie_bus_config = PCIE_BUS_DEFAULT;* the dfl or actual value as it sees fit. Don't forget this is * measured in 32-bit words, not bytes. */ -u8 pci_dfl_cache_line_size =L1_CACHE_BYTES >>2 ; -u8 pci_cache_line_size; +u8 pci_dfl_cache_line_size__ro_after_init =L1_CACHE_BYTES >>2 ; +u8 pci_cache_line_size__ro_after_init ;/* * If we set up a device for bus mastering, we need to check the latency
include/linux/pci.h +2 -2
@@ -2334,8 +2334,8 @@ extern int pci_pci_problems;extern unsigned long pci_cardbus_io_size;extern unsigned long pci_cardbus_mem_size; -extern u8 pci_dfl_cache_line_size; -extern u8 pci_cache_line_size; +extern u8 pci_dfl_cache_line_size__ro_after_init ; +extern u8 pci_cache_line_size__ro_after_init ;/* Architecture-specific versions may override these (weak) */ void pcibios_disable_device (struct pci_dev *dev);
Signature · 1 line
2.44.0
Quoted 29 lines · Heiner Kallweit
Annotate both variables as
__ro_after_init, enforcing that they can't be changed after the init phase.Signed-off-by Heiner Kallweit <[email protected]>--- drivers/pci/pci.c | 4 ++-- include/linux/pci.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)drivers/pci/pci.c +2
-2@@ -142,8 +142,8 @@ enum pcie_bus_config_types pcie_bus_config = PCIE_BUS_DEFAULT;* the dfl or actual value as it sees fit. Don't forget this is * measured in 32-bit words, not bytes. */ -u8 pci_dfl_cache_line_size =L1_CACHE_BYTES >>2 ; -u8 pci_cache_line_size; +u8 pci_dfl_cache_line_size__ro_after_init =L1_CACHE_BYTES >>2 ; +u8 pci_cache_line_size__ro_after_init ;/* * If we set up a device for bus mastering, we need to check the latency include/linux/pci.h +0
-0
include/linux/pci.h extern int pci_pci_problems; · line 2338
Quoted 7 lines
include/linux/pci.h +2
-2@@ -2334,8 +2334,8 @@ extern int pci_pci_problems;extern unsigned long pci_cardbus_io_size;extern unsigned long pci_cardbus_mem_size; -extern u8 pci_dfl_cache_line_size; -extern u8 pci_cache_line_size; +extern u8 pci_dfl_cache_line_size__ro_after_init ; +extern u8 pci_cache_line_size__ro_after_init ;
Is __ro_after_init required on the declaration, too? I see a few uses in .h files, but not very many, and I would think it would be a linker thing that applies to the definition, where space is allocated.
Quoted 5 lines
include/linux/pci.h +0
-0/* Architecture-specific versions may override these (weak) */ void pcibios_disable_device (struct pci_dev *dev);Signature · 1 line
2.44.0
Quoted 31 lines · Bjorn Helgaas
Quoted 30 lines · Heiner Kallweit
Annotate both variables as
__ro_after_init, enforcing that they can't be changed after the init phase.Signed-off-by Heiner Kallweit <[email protected]>--- drivers/pci/pci.c | 4 ++-- include/linux/pci.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)drivers/pci/pci.c +2
-2@@ -142,8 +142,8 @@ enum pcie_bus_config_types pcie_bus_config = PCIE_BUS_DEFAULT;* the dfl or actual value as it sees fit. Don't forget this is * measured in 32-bit words, not bytes. */ -u8 pci_dfl_cache_line_size =L1_CACHE_BYTES >>2 ; -u8 pci_cache_line_size; +u8 pci_dfl_cache_line_size__ro_after_init =L1_CACHE_BYTES >>2 ; +u8 pci_cache_line_size__ro_after_init ;/* * If we set up a device for bus mastering, we need to check the latency include/linux/pci.h +0
-0@@ -2334,8 +2334,8 @@ extern int pci_pci_problems;
Quoted 11 lines
include/linux/pci.h extern int pci_pci_problems; · line 2338
Quoted 6 lines
include/linux/pci.h +2
-2extern unsigned long pci_cardbus_io_size;extern unsigned long pci_cardbus_mem_size; -extern u8 pci_dfl_cache_line_size; -extern u8 pci_cache_line_size; +extern u8 pci_dfl_cache_line_size__ro_after_init ; +extern u8 pci_cache_line_size__ro_after_init ;Is
__ro_after_initrequired on the declaration, too? I see a few uses in .h files, but not very many, and I would think it would be a linker thing that applies to the definition, where space is allocated.
You're right, it's not needed on the declaration. I'll submit a v2.
Quoted 5 lines
Quoted 5 lines
include/linux/pci.h +0
-0/* Architecture-specific versions may override these (weak) */ void pcibios_disable_device (struct pci_dev *dev);Signature · 1 line
2.44.0