]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
PCI: ls-gen4: Make struct mobiveil_rp_ops constant
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Mon, 24 Jun 2024 20:18:20 +0000 (22:18 +0200)
committerKrzysztof Wilczyński <kwilczynski@kernel.org>
Tue, 25 Jun 2024 00:49:49 +0000 (00:49 +0000)
The struct mobiveil_rp_ops is not modified in this driver.

Thus, make this struct constant, which also moves data to a read-only
section decreasing object size and also improving overall security.

On a x86_64, with allmodconfig, as an example:

Before:
======
   text    data     bss     dec     hex filename
   4446     336      32    4814    12ce drivers/pci/controller/mobiveil/pcie-layerscape-gen4.o

After:
=====
   text    data     bss     dec     hex filename
   4454     328      32    4814    12ce drivers/pci/controller/mobiveil/pcie-layerscape-gen4.o

[kwilczynski: commit log]
Link: https://lore.kernel.org/linux-pci/189fd881cc8fd80220e74e91820e12cf3a5be114.1719260294.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c
drivers/pci/controller/mobiveil/pcie-mobiveil.h

index d7b7350f02dd69feb63ef4b6b476c64efd297f42..5af22bee913bdc7e7cba4e123a202913d930f8f1 100644 (file)
@@ -190,7 +190,7 @@ static void ls_g4_pcie_reset(struct work_struct *work)
        ls_g4_pcie_enable_interrupt(pcie);
 }
 
-static struct mobiveil_rp_ops ls_g4_pcie_rp_ops = {
+static const struct mobiveil_rp_ops ls_g4_pcie_rp_ops = {
        .interrupt_init = ls_g4_pcie_interrupt_init,
 };
 
index 6082b8afbc31ee22c17cbbf9e02541fa37a0e12d..e63abb887ee3c01e5f3da04a72b21e95ce51d471 100644 (file)
@@ -151,7 +151,7 @@ struct mobiveil_rp_ops {
 struct mobiveil_root_port {
        void __iomem *config_axi_slave_base;    /* endpoint config base */
        struct resource *ob_io_res;
-       struct mobiveil_rp_ops *ops;
+       const struct mobiveil_rp_ops *ops;
        int irq;
        raw_spinlock_t intx_mask_lock;
        struct irq_domain *intx_domain;