Re: [RFC] x86/pci: Mark pci_root_ops as const
From: Bjorn Helgaas
Date: Thu Nov 08 2018 - 18:51:40 EST
Hi Zubin,
On Thu, Nov 08, 2018 at 09:11:15AM -0800, Zubin Mithra wrote:
> pci_root_ops is only written to from within intel_mid_pci_init. This
> is linked in only when CONFIG_X86_INTEL_MID is set. If not for this,
> pci_root_ops could be marked as const.
>
> Fix this by replacing pci_root_ops usage with pci_root_ops_ptr. If
> CONFIG_X86_INTEL_MID is set, pci_root_ops_ptr will be set to
> intel_mid_pci_ops inside intel_mid_pci_init.
>
> Introduce pci_acpi_set_ops for intel_mid_pci_init to set
> acpi_pci_root_ops.pci_ops.
>
> This also means that intel_mid_pci_ops cannot be freed after init, hence
> remove __initconst.
>
> Signed-off-by: Zubin Mithra <zsm@xxxxxxxxxxxx>
> ---
> arch/x86/include/asm/pci_x86.h | 4 +++-
> arch/x86/pci/acpi.c | 5 +++++
> arch/x86/pci/common.c | 5 +++--
> arch/x86/pci/intel_mid_pci.c | 5 +++--
> drivers/pci/access.c | 4 ++--
> drivers/pci/probe.c | 4 ++--
> include/linux/pci-acpi.h | 2 +-
> include/linux/pci.h | 11 ++++++-----
> 8 files changed, 25 insertions(+), 15 deletions(-)
Can you:
- Split this into an x86 patch and a PCI core patch (if possible)?
- Make the same fixes for other arches?
Bjorn